From 57b28dc8689e29238ad20f14089cdaefce19db98 Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Tue, 4 May 2021 17:18:37 +0200 Subject: [PATCH] try prefixing namespace for auth forward --- .tools/tests/charts/common-test_spec.rb | 2 +- library/common/Chart.yaml | 2 +- library/common/templates/classes/ingress/_ingress.tpl | 2 +- library/common/templates/classes/ingress/_ingressRoute.tpl | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.tools/tests/charts/common-test_spec.rb b/.tools/tests/charts/common-test_spec.rb index c7585dc53fe..b1c86b7dbdd 100644 --- a/.tools/tests/charts/common-test_spec.rb +++ b/.tools/tests/charts/common-test_spec.rb @@ -984,7 +984,7 @@ class Test < ChartTest it 'HTTP-ingressRoute+selfsigned+forwardAuth is evaluated is evaluated ' do expectedHostString = 'Host(`hostname`) && PathPrefix(`/`)' expectedName1 = 'common-test-test1-auth-forward' - expectedName2 = 'common-test-test1-auth-forward@kubernetescrd' + expectedName2 = 'default-common-test-test1-auth-forward@kubernetescrd' values = { ingress: { test1: { diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index 4cea053ced6..67d13c13e62 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: common -version: 3.5.4 +version: 3.5.5 # upstream_version: appVersion: none description: Function library for TrueCharts diff --git a/library/common/templates/classes/ingress/_ingress.tpl b/library/common/templates/classes/ingress/_ingress.tpl index 497da3a114e..a5dcda2ebcc 100644 --- a/library/common/templates/classes/ingress/_ingress.tpl +++ b/library/common/templates/classes/ingress/_ingress.tpl @@ -55,7 +55,7 @@ metadata: traefik.ingress.kubernetes.io/service.serversscheme: https {{- end }} traefik.ingress.kubernetes.io/router.entrypoints: {{ $values.entrypoint | default "websecure" }} - traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ printf "%v@%v" $authForwardName "@kubernetescrd" }}{{ end }} + traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ printf "%v-%v@%v" .Release.Namespace $authForwardName "kubernetescrd" }}{{ end }} {{- with $values.annotations }} {{- toYaml . | nindent 4 }} {{- end }} diff --git a/library/common/templates/classes/ingress/_ingressRoute.tpl b/library/common/templates/classes/ingress/_ingressRoute.tpl index b3c2f1f8a38..a44fe553ac7 100644 --- a/library/common/templates/classes/ingress/_ingressRoute.tpl +++ b/library/common/templates/classes/ingress/_ingressRoute.tpl @@ -26,6 +26,8 @@ within the common library. {{- $portProtocol = $.Values.services.main.port.protocol | default "" }} {{ end -}} +{{- $authForwardName := ( printf "%v-%v" $ingressName "auth-forward" ) -}} + {{- $svcName := $values.serviceName | default $ingressName -}} {{- if $values.servicePort }} @@ -81,7 +83,7 @@ spec: middlewares: - name: traefik-middlewares-chain-public@kubernetescrd {{- if $values.authForwardURL }} - - name: "{{ $ingressName }}-auth-forward@kubernetescrd" + - name: "{{ printf "%v-%v@%v" .Release.Namespace $authForwardName "kubernetescrd" }}" {{- end }} {{- end }} @@ -108,7 +110,7 @@ spec: apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: - name: {{ $ingressName }}-auth-forward + name: {{ $authForwardName }} spec: forwardAuth: address: {{ $values.authForwardURL | quote }}