diff --git a/traefik/templates/ingressclass.yaml b/traefik/templates/ingressclass.yaml index 6a8ff8199..db881878b 100644 --- a/traefik/templates/ingressclass.yaml +++ b/traefik/templates/ingressclass.yaml @@ -8,5 +8,5 @@ metadata: {{- include "traefik.labels" . | nindent 4 }} name: {{ .Values.ingressClass.name | default (include "traefik.fullname" .) }} spec: - controller: traefik.io/ingress-controller + controller: {{ .Values.ingressClass.controller }} {{- end -}} diff --git a/traefik/tests/ingressclass-config_test.yaml b/traefik/tests/ingressclass-config_test.yaml index 804fbe5ef..3343f9f91 100644 --- a/traefik/tests/ingressclass-config_test.yaml +++ b/traefik/tests/ingressclass-config_test.yaml @@ -42,3 +42,24 @@ tests: - equal: path: metadata.name value: nondefaultname + - it: should use default controller value + asserts: + - isKind: + of: IngressClass + - isAPIVersion: + of: networking.k8s.io/v1 + - equal: + path: spec.controller + value: traefik.io/ingress-controller + - it: should be possible to provide a custom controller value + set: + ingressClass: + controller: traefik.io/ingress-controller-internal + asserts: + - isKind: + of: IngressClass + - isAPIVersion: + of: networking.k8s.io/v1 + - equal: + path: spec.controller + value: traefik.io/ingress-controller-internal diff --git a/traefik/values.schema.json b/traefik/values.schema.json index 8be7c4e42..ad326a62a 100644 --- a/traefik/values.schema.json +++ b/traefik/values.schema.json @@ -1501,6 +1501,11 @@ }, "name": { "type": "string" + }, + "controller": { + "description": "The controller value for the IngressClass. This allows running multiple Traefik instances with different IngressClasses.", + "type": "string", + "default": "traefik.io/ingress-controller" } }, "additionalProperties": false diff --git a/traefik/values.yaml b/traefik/values.yaml index 54a55ebbf..c04b6c704 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -128,6 +128,9 @@ ingressClass: # @schema additionalProperties: false enabled: true isDefaultClass: true name: "" + # -- The controller value for the IngressClass. This allows running multiple Traefik instances with different IngressClasses. + # @default -- `traefik.io/ingress-controller` + controller: traefik.io/ingress-controller core: # @schema additionalProperties: false # -- Can be used to use globally v2 router syntax. Deprecated since v3.4 /!\.