fix(infra-monitoring): improve ingress annotations

This commit is contained in:
WrenIX 2024-07-20 16:16:46 +02:00
parent fa9810b8e7
commit c5ef7ce2f5
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
2 changed files with 24 additions and 26 deletions

View file

@ -113,17 +113,18 @@ spec:
ingress: ingress:
enabled: true enabled: true
annotations: annotations:
{{- with $.Values.commons.ingress.annotations }} {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $.Values.commons.auth }} {{- with $.Values.commons.auth }}
{{- if and .enabled (eq .type "authentik") (not $.Values.karma.auth.anonymous.enabled) }} {{- 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 }}
{{- end }} {{- end }}
{{- with .annotations }}
{{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- toYaml $annotations | nindent 8 }}
hosts: hosts:
- "{{ $host }}" - "{{ $host }}"
path: "/" path: "/"

View file

@ -83,17 +83,18 @@ spec:
ingress: ingress:
enabled: true enabled: true
annotations: annotations:
{{- with $.Values.commons.ingress.annotations }} {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with $.Values.commons.auth }} {{- with $.Values.commons.auth }}
{{- if and .enabled (eq .type "authentik") (not $.Values.prometheus.auth.anonymous.enabled) }} {{- 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 }}
{{- end }} {{- end }}
{{- with .annotations }}
{{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
{{- toYaml $annotations | nindent 10 }}
hosts: hosts:
- "{{ $hostPrometheus }}" - "{{ $hostPrometheus }}"
path: "/" path: "/"
@ -128,17 +129,18 @@ spec:
ingress: ingress:
enabled: true enabled: true
annotations: annotations:
{{- with $.Values.commons.ingress.annotations }} {{- $annotations := mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with $.Values.commons.auth }} {{- with $.Values.commons.auth }}
{{- if and .enabled (eq .type "authentik") (not $.Values.alertmanager.auth.anonymous.enabled) }} {{- 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 }}
{{- end }} {{- end }}
{{- with .annotations }}
{{- toYaml . | nindent 10 }}
{{- end }} {{- end }}
{{- toYaml $annotations | nindent 10 }}
hosts: hosts:
- "{{ $hostAlertmanager }}" - "{{ $hostAlertmanager }}"
paths: [ "/" ] paths: [ "/" ]
@ -219,12 +221,7 @@ spec:
ingress: ingress:
enabled: true enabled: true
annotations: annotations:
{{- with $.Values.commons.ingress.annotations }} {{- mergeOverwrite (dict) $.Values.commons.ingress.annotations .annotations | toYaml | nindent 10 }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .annotations }}
{{- toYaml . | nindent 10 }}
{{- end }}
hosts: hosts:
- "{{ $hostGrafana }}" - "{{ $hostGrafana }}"
path: "/" path: "/"