{{- if and .Values.alertmanager.enabled (not .Values.alertmanager.statefulSet.enabled) -}} apiVersion: {{ template "prometheus.deployment.apiVersion" . }} kind: Deployment metadata: {{- if .Values.alertmanager.deploymentAnnotations }} annotations: {{ toYaml .Values.alertmanager.deploymentAnnotations | nindent 4 }} {{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 4 }} name: {{ template "prometheus.alertmanager.fullname" . }} {{ include "prometheus.namespace" . | indent 2 }} spec: selector: matchLabels: {{- include "prometheus.alertmanager.matchLabels" . | nindent 6 }} replicas: {{ .Values.alertmanager.replicaCount }} {{- if .Values.alertmanager.strategy }} strategy: {{ toYaml .Values.alertmanager.strategy | trim | indent 4 }} {{ if eq .Values.alertmanager.strategy.type "Recreate" }}rollingUpdate: null{{ end }} {{- end }} template: metadata: {{- if .Values.alertmanager.podAnnotations }} annotations: {{ toYaml .Values.alertmanager.podAnnotations | nindent 8 }} {{- end }} labels: {{- include "prometheus.alertmanager.labels" . | nindent 8 }} {{- if .Values.alertmanager.podLabels}} {{ toYaml .Values.alertmanager.podLabels | nindent 8 }} {{- end}} spec: {{- if .Values.alertmanager.schedulerName }} schedulerName: "{{ .Values.alertmanager.schedulerName }}" {{- end }} serviceAccountName: {{ template "prometheus.serviceAccountName.alertmanager" . }} {{- if .Values.alertmanager.extraInitContainers }} initContainers: {{ toYaml .Values.alertmanager.extraInitContainers | indent 8 }} {{- end }} {{- if .Values.alertmanager.priorityClassName }} priorityClassName: "{{ .Values.alertmanager.priorityClassName }}" {{- end }} containers: - name: {{ template "prometheus.name" . }}-{{ .Values.alertmanager.name }} image: "{{ .Values.alertmanager.image.repository }}:{{ .Values.alertmanager.image.tag }}" imagePullPolicy: "{{ .Values.alertmanager.image.pullPolicy }}" env: {{- range $key, $value := .Values.alertmanager.extraEnv }} - name: {{ $key }} value: {{ $value }} {{- end }} - name: POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP args: - --config.file=/etc/config/{{ .Values.alertmanager.configFileName }} - --storage.path={{ .Values.alertmanager.persistentVolume.mountPath }} {{- if .Values.alertmanager.service.enableMeshPeer }} - --cluster.listen-address=0.0.0.0:6783 - --cluster.advertise-address=[$(POD_IP)]:6783 {{- else }} - --cluster.listen-address= {{- end }} {{- range $key, $value := .Values.alertmanager.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} {{- if .Values.alertmanager.baseURL }} - --web.external-url={{ .Values.alertmanager.baseURL }} {{- end }} {{- range .Values.alertmanager.clusterPeers }} - --cluster.peer={{ . }} {{- end }} ports: - containerPort: 9093 readinessProbe: httpGet: path: {{ .Values.alertmanager.prefixURL }}/-/ready port: 9093 {{- if .Values.alertmanager.probeHeaders }} httpHeaders: {{- range .Values.alertmanager.probeHeaders }} - name: {{ .name }} value: {{ .value }} {{- end }} {{- end }} initialDelaySeconds: 30 timeoutSeconds: 30 resources: {{ toYaml .Values.alertmanager.resources | indent 12 }} volumeMounts: - name: config-volume mountPath: /etc/config - name: storage-volume mountPath: "{{ .Values.alertmanager.persistentVolume.mountPath }}" subPath: "{{ .Values.alertmanager.persistentVolume.subPath }}" {{- range .Values.alertmanager.extraSecretMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- range .Values.alertmanager.extraConfigmapMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- if .Values.configmapReload.alertmanager.enabled }} - name: {{ template "prometheus.name" . }}-{{ .Values.alertmanager.name }}-{{ .Values.configmapReload.alertmanager.name }} image: "{{ .Values.configmapReload.alertmanager.image.repository }}:{{ .Values.configmapReload.alertmanager.image.tag }}" imagePullPolicy: "{{ .Values.configmapReload.alertmanager.image.pullPolicy }}" args: - --volume-dir=/etc/config - --webhook-url=http://127.0.0.1:9093{{ .Values.alertmanager.prefixURL }}/-/reload {{- range $key, $value := .Values.configmapReload.alertmanager.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} {{- range .Values.configmapReload.alertmanager.extraVolumeDirs }} - --volume-dir={{ . }} {{- end }} {{- if .Values.configmapReload.alertmanager.containerPort }} ports: - containerPort: {{ .Values.configmapReload.alertmanager.containerPort }} {{- end }} resources: {{ toYaml .Values.configmapReload.alertmanager.resources | indent 12 }} volumeMounts: - name: config-volume mountPath: /etc/config readOnly: true {{- range .Values.configmapReload.alertmanager.extraConfigmapMounts }} - name: {{ $.Values.configmapReload.alertmanager.name }}-{{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 8 }} {{- end }} {{- if .Values.alertmanager.nodeSelector }} nodeSelector: {{ toYaml .Values.alertmanager.nodeSelector | indent 8 }} {{- end }} {{- with .Values.alertmanager.dnsConfig }} dnsConfig: {{ toYaml . | indent 8 }} {{- end }} {{- if .Values.alertmanager.securityContext }} securityContext: {{ toYaml .Values.alertmanager.securityContext | indent 8 }} {{- end }} {{- if .Values.alertmanager.tolerations }} tolerations: {{ toYaml .Values.alertmanager.tolerations | indent 8 }} {{- end }} {{- if .Values.alertmanager.affinity }} affinity: {{ toYaml .Values.alertmanager.affinity | indent 8 }} {{- end }} volumes: - name: config-volume {{- if empty .Values.alertmanager.configFromSecret }} configMap: name: {{ if .Values.alertmanager.configMapOverrideName }}{{ .Release.Name }}-{{ .Values.alertmanager.configMapOverrideName }}{{- else }}{{ template "prometheus.alertmanager.fullname" . }}{{- end }} {{- else }} secret: secretName: {{ .Values.alertmanager.configFromSecret }} {{- end }} {{- range .Values.alertmanager.extraSecretMounts }} - name: {{ .name }} secret: secretName: {{ .secretName }} {{- with .optional }} optional: {{ . }} {{- end }} {{- end }} {{- range .Values.alertmanager.extraConfigmapMounts }} - name: {{ .name }} configMap: name: {{ .configMap }} {{- end }} {{- range .Values.configmapReload.alertmanager.extraConfigmapMounts }} - name: {{ $.Values.configmapReload.alertmanager.name }}-{{ .name }} configMap: name: {{ .configMap }} {{- end }} - name: storage-volume {{- if .Values.alertmanager.persistentVolume.enabled }} persistentVolumeClaim: claimName: {{ if .Values.alertmanager.persistentVolume.existingClaim }}{{ .Values.alertmanager.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.alertmanager.fullname" . }}{{- end }} {{- else }} emptyDir: {{- if .Values.alertmanager.emptyDir.sizeLimit }} sizeLimit: {{ .Values.alertmanager.emptyDir.sizeLimit }} {{- else }} {} {{- end -}} {{- end -}} {{- end }}