{{- if .Values.alertmanager.enabled }} {{/* This file is applied when the operation is helm install and the target secret does not exist. */}} {{- $secretName := (printf "%s-alertmanager-secret" (include "project-prometheus-stack.fullname" .)) }} {{- if (not (lookup "v1" "Secret" (include "project-prometheus-stack.namespace" .) $secretName)) }} apiVersion: v1 kind: Secret metadata: name: {{ $secretName }} namespace: {{ template "project-prometheus-stack.namespace" . }} annotations: "helm.sh/hook": pre-install, pre-upgrade "helm.sh/hook-weight": "3" "helm.sh/resource-policy": keep {{- if .Values.alertmanager.secret.annotations }} {{ toYaml .Values.alertmanager.secret.annotations | indent 4 }} {{- end }} labels: app: {{ template "project-prometheus-stack.name" . }}-alertmanager {{ include "project-prometheus-stack.labels" . | indent 4 }} data: {{- if .Values.alertmanager.tplConfig }} {{- if eq (typeOf .Values.alertmanager.config) "string" }} alertmanager.yaml: {{ tpl (.Values.alertmanager.config) . | b64enc | quote }} {{- else }} alertmanager.yaml: {{ tpl (toYaml .Values.alertmanager.config) . | b64enc | quote }} {{- end }} {{- else }} alertmanager.yaml: {{ toYaml .Values.alertmanager.config | b64enc | quote }} {{- end}} {{- range $key, $val := .Values.alertmanager.templateFiles }} {{ $key }}: {{ $val | b64enc | quote }} {{- end }} {{- end }}{{- end }}