Skip to content

Commit 95efaf3

Browse files
authored
Accept user defined annotations in IngressClass (#11362)
1 parent 20d9a60 commit 95efaf3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

charts/ingress-nginx/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,9 @@ As of version `1.26.0` of this chart, by simply not providing any clusterIP valu
332332
| controller.image.tag | string | `"v1.10.0"` | |
333333
| 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 |
334334
| controller.ingressClassByName | bool | `false` | Process IngressClass per name (additionally as per spec.controller). |
335-
| controller.ingressClassResource | object | `{"aliases":[],"controllerValue":"k8s.io/ingress-nginx","default":false,"enabled":true,"name":"nginx","parameters":{}}` | This section refers to the creation of the IngressClass resource. IngressClasses are immutable and cannot be changed after creation. We do not support namespaced IngressClasses, yet, so a ClusterRole and a ClusterRoleBinding is required. |
335+
| controller.ingressClassResource | object | `{"aliases":[],"annotations":{},"controllerValue":"k8s.io/ingress-nginx","default":false,"enabled":true,"name":"nginx","parameters":{}}` | This section refers to the creation of the IngressClass resource. IngressClasses are immutable and cannot be changed after creation. We do not support namespaced IngressClasses, yet, so a ClusterRole and a ClusterRoleBinding is required. |
336336
| controller.ingressClassResource.aliases | list | `[]` | Aliases of this IngressClass. Creates copies with identical settings but the respective alias as name. Useful for development environments with only one Ingress Controller but production-like Ingress resources. `default` gets enabled on the original IngressClass only. |
337+
| controller.ingressClassResource.annotations | object | `{}` | Annotations to be added to the IngressClass resource. |
337338
| controller.ingressClassResource.controllerValue | string | `"k8s.io/ingress-nginx"` | Controller of the IngressClass. An Ingress Controller looks for IngressClasses it should reconcile by this value. This value is also being set as the `--controller-class` argument of this Ingress Controller. Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class |
338339
| controller.ingressClassResource.default | bool | `false` | If true, Ingresses without `ingressClassName` get assigned to this IngressClass on creation. Ingress creation gets rejected if there are multiple default IngressClasses. Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class |
339340
| controller.ingressClassResource.enabled | bool | `true` | Create the IngressClass or not |

charts/ingress-nginx/templates/controller-ingressclass.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ metadata:
99
{{- toYaml . | nindent 4 }}
1010
{{- end }}
1111
name: {{ .Values.controller.ingressClassResource.name }}
12-
{{- if .Values.controller.ingressClassResource.default }}
1312
annotations:
13+
{{- if .Values.controller.ingressClassResource.default }}
1414
ingressclass.kubernetes.io/is-default-class: "true"
15-
{{- end }}
15+
{{- end }}
16+
{{- if .Values.controller.ingressClassResource.annotations }}
17+
{{- toYaml .Values.controller.ingressClassResource.annotations | nindent 4 }}
18+
{{- end }}
1619
spec:
1720
controller: {{ .Values.controller.ingressClassResource.controllerValue }}
1821
{{- with .Values.controller.ingressClassResource.parameters }}

charts/ingress-nginx/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ controller:
127127
# Ingress creation gets rejected if there are multiple default IngressClasses.
128128
# Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#default-ingress-class
129129
default: false
130+
# -- Annotations to be added to the IngressClass resource.
131+
annotations: {}
130132
# -- Controller of the IngressClass. An Ingress Controller looks for IngressClasses it should reconcile by this value.
131133
# This value is also being set as the `--controller-class` argument of this Ingress Controller.
132134
# Ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#ingress-class

0 commit comments

Comments
 (0)