use a slightly cleaner way of generating the authForwardMiddleware Name.

This commit is contained in:
kjeld Schouten-Lebbing 2021-05-04 14:44:59 +02:00
parent 1b9ea26983
commit 5da466c64e
No known key found for this signature in database
GPG Key ID: 4CDAD4A532BC1EDB
2 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,7 @@
apiVersion: v2
kubeVersion: ">=1.16.0-0"
name: common
version: 3.5.3
version: 3.5.4
# upstream_version:
appVersion: none
description: Function library for TrueCharts

View File

@ -27,6 +27,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.dynamicServiceName }}
@ -53,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 }},{{ $ingressName }}-auth-forward@kubernetescrd{{ end }}
traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd{{ if $values.authForwardURL }},{{ printf "%v@%v" $authForwardName "@kubernetescrd" }}{{ end }}
{{- with $values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
@ -124,7 +126,7 @@ spec:
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
name: {{ $ingressName }}-auth-forward
name: {{ $authForwardName }}
spec:
forwardAuth:
address: {{ $values.authForwardURL | quote }}