feat: add support for multiple ingress class names
- add support for multiple ingress class names on a single controller Signed-off-by: slimm609 <dbrian@vmware.com>
This commit is contained in:
parent
6c92b04edc
commit
85b2e0f858
6 changed files with 75 additions and 19 deletions
|
@ -326,12 +326,12 @@ 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. 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. (comma-seperated list NOT supported) 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` | Is this the default ingressClass for the cluster |
|
| controller.ingressClassResource.default | bool | `false` | If multiple ingressClassResources are set, the default will always be the first in the list |
|
||||||
| 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 |
|
| controller.ingressClassResource.name | string | `"nginx"` | Name of the ingressClass (comma-seperated list supported) |
|
||||||
| 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 | `{}` | |
|
||||||
|
|
|
@ -124,27 +124,55 @@ 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 -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Set the version of the Chart to include in the labels mapping
|
||||||
|
*/}}
|
||||||
|
{{- define "ingress-nginx.version" -}}
|
||||||
|
{{- default .Chart.Version .Chart.AppVersion | quote -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Common labels
|
Common labels
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "ingress-nginx.labels" -}}
|
{{- define "ingress-nginx.labels" -}}
|
||||||
helm.sh/chart: {{ include "ingress-nginx.chart" . }}
|
{{- if and (hasKey . "customLabels") (hasKey . "context") -}}
|
||||||
|
{{ merge
|
||||||
|
(include "tplvalues.render" (dict "value" .customLabels "context" .context) | fromYaml)
|
||||||
|
(dict
|
||||||
|
"app.kubernetes.io/version" (include "ingress-nginx.version" .context)
|
||||||
|
"app.kubernetes.io/name" (include "ingress-nginx.name" .context)
|
||||||
|
"helm.sh/chart" (include "ingress-nginx.chart" .context)
|
||||||
|
"app.kubernetes.io/part-of" .context.Release.Name
|
||||||
|
"app.kubernetes.io/managed-by" .context.Release.Service
|
||||||
|
)
|
||||||
|
| toYaml
|
||||||
|
}}
|
||||||
|
{{- else -}}
|
||||||
|
app.kubernetes.io/version: {{ include "ingress-nginx.version" . }}
|
||||||
{{ include "ingress-nginx.selectorLabels" . }}
|
{{ include "ingress-nginx.selectorLabels" . }}
|
||||||
{{- if .Chart.AppVersion }}
|
app.kubernetes.io/name: {{ include "ingress-nginx.name" . }}
|
||||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
helm.sh/chart: {{ include "ingress-nginx.chart" . }}
|
||||||
{{- end }}
|
app.kubernetes.io/part-of: {{ .Release.Name }}
|
||||||
app.kubernetes.io/part-of: {{ template "ingress-nginx.name" . }}
|
|
||||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
{{- if .Values.commonLabels}}
|
{{- if .Values.commonLabels }}
|
||||||
{{ toYaml .Values.commonLabels }}
|
{{ toYaml .Values.commonLabels }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Selector labels
|
Selector labels
|
||||||
*/}}
|
*/}}
|
||||||
{{- define "ingress-nginx.selectorLabels" -}}
|
{{- define "ingress-nginx.selectorLabels" -}}
|
||||||
app.kubernetes.io/name: {{ include "ingress-nginx.name" . }}
|
|
||||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
- --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 }}
|
||||||
- --ingress-class={{ .Values.controller.ingressClass }}
|
{{- range $index, $name := ( split "," .Values.controller.ingressClassResource.name ) }}
|
||||||
|
- --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 }}
|
||||||
|
|
22
charts/ingress-nginx/templates/_tplvalues.tpl
Normal file
22
charts/ingress-nginx/templates/_tplvalues.tpl
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{{/* vim: set filetype=mustache: */}}
|
||||||
|
{{/*
|
||||||
|
Renders a value that contains template perhaps with scope if the scope is present.
|
||||||
|
Usage:
|
||||||
|
{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ ) }}
|
||||||
|
{{ include "tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $ "scope" $app ) }}
|
||||||
|
*/}}
|
||||||
|
{{- define "tplvalues.render" -}}
|
||||||
|
{{- if .scope }}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl (cat "{{- with $.RelativeScope -}}" .value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (cat "{{- with $.RelativeScope -}}" (.value | toYaml) "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }}
|
||||||
|
{{- end }}
|
||||||
|
{{- else }}
|
||||||
|
{{- if typeIs "string" .value }}
|
||||||
|
{{- tpl .value .context }}
|
||||||
|
{{- else }}
|
||||||
|
{{- tpl (.value | toYaml) .context }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
|
@ -1,21 +1,24 @@
|
||||||
{{- 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" ( dict "customLabels" $.Values.commonLabels "context" $ ) | 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: {{ .Values.controller.ingressClassResource.name }}
|
name: {{ $name | trim }}
|
||||||
{{- if .Values.controller.ingressClassResource.default }}
|
{{- if and ($.Values.controller.ingressClassResource.default) (eq $index "_0") }}
|
||||||
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 }}
|
|
@ -112,11 +112,12 @@ 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
|
# -- Name of the ingressClass (comma-seperated list supported)
|
||||||
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"
|
||||||
|
@ -124,7 +125,7 @@ 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.
|
# -- 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
|
# 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
|
||||||
|
|
Loading…
Reference in a new issue