diff --git a/infra-monitoring/templates/karma/release.yaml b/infra-monitoring/templates/karma/release.yaml index 5bcd1b1..7b48687 100644 --- a/infra-monitoring/templates/karma/release.yaml +++ b/infra-monitoring/templates/karma/release.yaml @@ -113,17 +113,18 @@ spec: ingress: enabled: true annotations: - {{- with $.Values.commons.ingress.annotations }} - {{- toYaml . | nindent 8 }} - {{- end }} + {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }} {{- with $.Values.commons.auth }} {{- if and .enabled (eq .type "authentik") (not $.Values.karma.auth.anonymous.enabled) }} - "traefik.ingress.kubernetes.io/router.middlewares": "{{ .namespace }}-mycloud-authentik-outpost@kubernetescrd" + {{- $currentMiddleware := get $annotations "traefik.ingress.kubernetes.io/router.middlewares" }} + {{- if $currentMiddleware }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s,%s-mycloud-authentik-outpost@kubernetescrd" $currentMiddleware .namespace) }} + {{- else }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s-mycloud-authentik-outpost@kubernetescrd" .namespace) }} {{- end }} {{- end }} - {{- with .annotations }} - {{- toYaml . | nindent 8 }} {{- end }} + {{- toYaml $annotations | nindent 8 }} hosts: - "{{ $host }}" path: "/" diff --git a/infra-monitoring/templates/kube-prometheus-stack/release.yaml b/infra-monitoring/templates/kube-prometheus-stack/release.yaml index 6c7ed31..35e8a23 100644 --- a/infra-monitoring/templates/kube-prometheus-stack/release.yaml +++ b/infra-monitoring/templates/kube-prometheus-stack/release.yaml @@ -83,17 +83,18 @@ spec: ingress: enabled: true annotations: - {{- with $.Values.commons.ingress.annotations }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }} {{- with $.Values.commons.auth }} - {{- if and .enabled (eq .type "authentik") (not $.Values.prometheus.auth.anonymous.enabled) }} - "traefik.ingress.kubernetes.io/router.middlewares": "{{ .namespace }}-mycloud-authentik-outpost@kubernetescrd" + {{- if and .enabled (eq .type "authentik") (not $.Values.karma.auth.anonymous.enabled) }} + {{- $currentMiddleware := get $annotations "traefik.ingress.kubernetes.io/router.middlewares" }} + {{- if $currentMiddleware }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s,%s-mycloud-authentik-outpost@kubernetescrd" $currentMiddleware .namespace) }} + {{- else }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s-mycloud-authentik-outpost@kubernetescrd" .namespace) }} {{- end }} {{- end }} - {{- with .annotations }} - {{- toYaml . | nindent 10 }} {{- end }} + {{- toYaml $annotations | nindent 10 }} hosts: - "{{ $hostPrometheus }}" path: "/" @@ -128,17 +129,18 @@ spec: ingress: enabled: true annotations: - {{- with $.Values.commons.ingress.annotations }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }} {{- with $.Values.commons.auth }} - {{- if and .enabled (eq .type "authentik") (not $.Values.alertmanager.auth.anonymous.enabled) }} - "traefik.ingress.kubernetes.io/router.middlewares": "{{ .namespace }}-mycloud-authentik-outpost@kubernetescrd" + {{- if and .enabled (eq .type "authentik") (not $.Values.karma.auth.anonymous.enabled) }} + {{- $currentMiddleware := get $annotations "traefik.ingress.kubernetes.io/router.middlewares" }} + {{- if $currentMiddleware }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s,%s-mycloud-authentik-outpost@kubernetescrd" $currentMiddleware .namespace) }} + {{- else }} + {{- $_ := set $annotations "traefik.ingress.kubernetes.io/router.middlewares" (printf "%s-mycloud-authentik-outpost@kubernetescrd" .namespace) }} {{- end }} {{- end }} - {{- with .annotations }} - {{- toYaml . | nindent 10 }} {{- end }} + {{- toYaml $annotations | nindent 10 }} hosts: - "{{ $hostAlertmanager }}" paths: [ "/" ] @@ -219,12 +221,7 @@ spec: ingress: enabled: true annotations: - {{- with $.Values.commons.ingress.annotations }} - {{- toYaml . | nindent 10 }} - {{- end }} - {{- with .annotations }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations | toYaml | nindent 10 }} hosts: - "{{ $hostGrafana }}" path: "/"