fix: change to extraNames

- change to support extraNames instead of splitting string

Signed-off-by: slimm609 <dbrian@vmware.com>
This commit is contained in:
slimm609 2023-11-06 13:19:19 -05:00
parent d15bdd153d
commit 43fc43ef07
6 changed files with 34 additions and 26 deletions

View file

@ -326,12 +326,13 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
| controller.image.runAsUser | int | `101` | | | controller.image.runAsUser | int | `101` | |
| controller.image.seccompProfile.type | string | `"RuntimeDefault"` | | | controller.image.seccompProfile.type | string | `"RuntimeDefault"` | |
| controller.image.tag | string | `"v1.9.4"` | | | controller.image.tag | string | `"v1.9.4"` | |
| controller.ingressClass | string | `"nginx"` | For backwards compatibility with ingress.class annotation, use ingressClass. (comma-seperated list NOT supported) Algorithm is as follows, first ingressClassName is considered, if not present, controller looks for ingress.class annotation | | controller.ingressClass | string | `"nginx"` | For backwards compatibility with ingress.class annotation, use ingressClass. Algorithm is as follows, first ingressClassName is considered, if not present, controller looks for ingress.class annotation |
| controller.ingressClassByName | bool | `false` | Process IngressClass per name (additionally as per spec.controller). | | controller.ingressClassByName | bool | `false` | Process IngressClass per name (additionally as per spec.controller). |
| controller.ingressClassResource.controllerValue | string | `"k8s.io/ingress-nginx"` | Controller-value of the controller that is processing this ingressClass | | controller.ingressClassResource.controllerValue | string | `"k8s.io/ingress-nginx"` | Controller-value of the controller that is processing this ingressClass |
| controller.ingressClassResource.default | bool | `false` | If multiple ingressClassResources are set, the default will always be the first in the list | | controller.ingressClassResource.default | bool | `false` | Is this the default ingressClass for the cluster |
| controller.ingressClassResource.enabled | bool | `true` | Is this ingressClass enabled or not | | controller.ingressClassResource.enabled | bool | `true` | Is this ingressClass enabled or not |
| controller.ingressClassResource.name | string | `"nginx"` | Name of the ingressClass (comma-seperated list supported) | | controller.ingressClassResource.extraNames | list | `[]` | Additional ingressClass names |
| controller.ingressClassResource.name | string | `"nginx"` | Name of the ingressClass |
| controller.ingressClassResource.parameters | object | `{}` | Parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters. | | controller.ingressClassResource.parameters | object | `{}` | Parameters is a link to a custom resource containing additional configuration for the controller. This is optional if the controller does not require extra parameters. |
| controller.keda.apiVersion | string | `"keda.sh/v1alpha1"` | | | controller.keda.apiVersion | string | `"keda.sh/v1alpha1"` | |
| controller.keda.behavior | object | `{}` | | | controller.keda.behavior | object | `{}` | |

View file

@ -124,14 +124,6 @@ Users can provide an override for an explicit service they want bound via `.Valu
{{- print $servicePath | trimSuffix "-" -}} {{- print $servicePath | trimSuffix "-" -}}
{{- end -}} {{- end -}}
{{/*
Create a default fully qualified default backend name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "ingress-nginx.defaultBackend.fullname" -}}
{{- printf "%s-%s" (include "ingress-nginx.fullname" .) .Values.defaultBackend.name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/* {{/*
Common labels Common labels
*/}} */}}

View file

@ -16,9 +16,7 @@
- --election-id={{ include "ingress-nginx.controller.electionID" . }} - --election-id={{ include "ingress-nginx.controller.electionID" . }}
- --controller-class={{ .Values.controller.ingressClassResource.controllerValue }} - --controller-class={{ .Values.controller.ingressClassResource.controllerValue }}
{{- if .Values.controller.ingressClass }} {{- if .Values.controller.ingressClass }}
{{- range $index, $name := ( split "," .Values.controller.ingressClassResource.name ) }} - --ingress-class={{ .Values.controller.ingressClass }}
- --ingress-class={{ $name | trim }}
{{- end }}
{{- end }} {{- end }}
- --configmap={{ default "$(POD_NAMESPACE)" .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }} - --configmap={{ default "$(POD_NAMESPACE)" .Values.controller.configMapNamespace }}/{{ include "ingress-nginx.controller.fullname" . }}
{{- if .Values.tcp }} {{- if .Values.tcp }}

View file

@ -0,0 +1,18 @@
{{- if and (.Values.controller.ingressClassResource.enabled) (.Values.controller.ingressClassResource.extraNames) -}}
{{- range $v := .Values.controller.ingressClassResource.extraNames }}
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
{{- include "ingress-nginx.labels" $ | nindent 4 }}
app.kubernetes.io/component: controller
{{- with $.Values.controller.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ $v | trim }}
spec:
controller: {{ $.Values.controller.ingressClassResource.controllerValue }}
{{ template "ingressClass.parameters" $ }}
{{- end }}
{{- end }}

View file

@ -1,24 +1,21 @@
{{- if .Values.controller.ingressClassResource.enabled -}} {{- if .Values.controller.ingressClassResource.enabled -}}
{{- range $index, $name := ( split "," .Values.controller.ingressClassResource.name ) }}
---
# We don't support namespaced ingressClass yet # We don't support namespaced ingressClass yet
# So a ClusterRole and a ClusterRoleBinding is required # So a ClusterRole and a ClusterRoleBinding is required
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: IngressClass kind: IngressClass
metadata: metadata:
labels: labels:
{{- include "ingress-nginx.labels" $ | nindent 4 }} {{- include "ingress-nginx.labels" . | nindent 4 }}
app.kubernetes.io/component: controller app.kubernetes.io/component: controller
{{- with $.Values.controller.labels }} {{- with .Values.controller.labels }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
name: {{ $name | trim }} name: {{ .Values.controller.ingressClassResource.name }}
{{- if and ($.Values.controller.ingressClassResource.default) (eq $index "_0") }} {{- if .Values.controller.ingressClassResource.default }}
annotations: annotations:
ingressclass.kubernetes.io/is-default-class: "true" ingressclass.kubernetes.io/is-default-class: "true"
{{- end }} {{- end }}
spec: spec:
controller: {{ $.Values.controller.ingressClassResource.controllerValue }} controller: {{ .Values.controller.ingressClassResource.controllerValue }}
{{ template "ingressClass.parameters" $ }} {{ template "ingressClass.parameters" . }}
{{- end }} {{- end }}
{{- end }}

View file

@ -112,12 +112,11 @@ controller:
## This section refers to the creation of the IngressClass resource ## This section refers to the creation of the IngressClass resource
## IngressClass resources are supported since k8s >= 1.18 and required since k8s >= 1.19 ## IngressClass resources are supported since k8s >= 1.18 and required since k8s >= 1.19
ingressClassResource: ingressClassResource:
# -- Name of the ingressClass (comma-seperated list supported) # -- Name of the ingressClass
name: nginx name: nginx
# -- Is this ingressClass enabled or not # -- Is this ingressClass enabled or not
enabled: true enabled: true
# -- Is this the default ingressClass for the cluster # -- Is this the default ingressClass for the cluster
# -- If multiple ingressClassResources are set, the default will always be the first in the list
default: false default: false
# -- Controller-value of the controller that is processing this ingressClass # -- Controller-value of the controller that is processing this ingressClass
controllerValue: "k8s.io/ingress-nginx" controllerValue: "k8s.io/ingress-nginx"
@ -125,7 +124,10 @@ controller:
# configuration for the controller. This is optional if the controller # configuration for the controller. This is optional if the controller
# does not require extra parameters. # does not require extra parameters.
parameters: {} parameters: {}
# -- For backwards compatibility with ingress.class annotation, use ingressClass. (comma-seperated list NOT supported) # -- Additional ingressClass names
extraNames: []
# - nginx-external
# -- For backwards compatibility with ingress.class annotation, use ingressClass.
# Algorithm is as follows, first ingressClassName is considered, if not present, controller looks for ingress.class annotation # Algorithm is as follows, first ingressClassName is considered, if not present, controller looks for ingress.class annotation
ingressClass: nginx ingressClass: nginx
# -- Labels to add to the pod container metadata # -- Labels to add to the pod container metadata