{{- if and (.Values.alertmanager.enabled) (not .Values.alertmanager.alertmanagerSpec.useExistingSecret) }} {{/* This file is applied when the operation is helm install and the target secret does not exist. */}} {{- $secretName := (printf "alertmanager-%s-alertmanager" (include "kube-prometheus-stack.fullname" .)) }} {{- if (not (lookup "v1" "Secret" (include "kube-prometheus-stack.namespace" .) $secretName)) }} apiVersion: v1 kind: Secret metadata: name: {{ $secretName }} namespace: {{ template "kube-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 "kube-prometheus-stack.name" . }}-alertmanager {{ include "kube-prometheus-stack.labels" . | indent 4 }} data: {{- if .Values.alertmanager.tplConfig }} alertmanager.yaml: {{ tpl (toYaml .Values.alertmanager.config) . | b64enc | quote }} {{- else }} alertmanager.yaml: {{ toYaml .Values.alertmanager.config | b64enc | quote }} {{- end}} {{- range $key, $val := .Values.alertmanager.templateFiles }} {{ $key }}: {{ $val | b64enc | quote }} {{- end }} {{- end }}{{- end }}