From 6c19ae6d72c20e8774e75ae991f26118e134bc37 Mon Sep 17 00:00:00 2001 From: Michel Loiseleur Date: Thu, 9 Jan 2025 17:25:57 +0100 Subject: [PATCH] fix(Gateway API): status should not use default service when it's disabled --- traefik/tests/traefik-config_test.yaml | 22 ++++++++++++++++++++++ traefik/values.yaml | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/traefik/tests/traefik-config_test.yaml b/traefik/tests/traefik-config_test.yaml index 5b78a816b..c395ba345 100644 --- a/traefik/tests/traefik-config_test.yaml +++ b/traefik/tests/traefik-config_test.yaml @@ -107,6 +107,28 @@ tests: - contains: path: spec.template.spec.containers[0].args content: "--providers.kubernetesingress.ingressendpoint.publishedservice=foo/bar" + - it: should not set default publishedService when service is disabled + set: + service: + enabled: false + asserts: + - notContains: + path: spec.template.spec.containers[0].args + content: "--providers.kubernetesingress.ingressendpoint.publishedservice=NAMESPACE/RELEASE-NAME-traefik" + - it: should not set default statusAddress when service is disabled + set: + service: + enabled: false + providers: + kubernetesGateway: + enabled: true + asserts: + - notContains: + path: spec.template.spec.containers[0].args + content: "--providers.kubernetesgateway.statusaddress.service.name=RELEASE-NAME-traefik" + - notContains: + path: spec.template.spec.containers[0].args + content: "--providers.kubernetesgateway.statusaddress.service.namespace=NAMESPACE" - it: should be possible to set statusAddress fields set: providers: diff --git a/traefik/values.yaml b/traefik/values.yaml index 4ab3d8007..1575ab0b2 100644 --- a/traefik/values.yaml +++ b/traefik/values.yaml @@ -319,8 +319,8 @@ providers: # @schema additionalProperties: false hostname: "" # -- The Kubernetes service to copy status addresses from. When using third parties tools like External-DNS, this option can be used to copy the service loadbalancer.status (containing the service's endpoints IPs) to the gateways. Default to Service of this Chart. service: - name: "{{ (include \"traefik.fullname\" .) }}" - namespace: "{{ include \"traefik.namespace\" . }}" + name: "{{ .Values.service.enabled | ternary (include \"traefik.fullname\" .) nil }}" + namespace: "{{ .Values.service.enabled | ternary (include \"traefik.namespace\" .) nil }}" file: # -- Create a file provider