Files
devops-infra-helm-charts-gcp/helm-templates/mimir-distributed/templates/alertmanager/alertmanager-dep.yaml
T
2026-08-26 03:39:42 +05:30

168 lines
6.6 KiB
YAML

{{- if .Values.alertmanager.enabled -}}
{{- if not .Values.alertmanager.statefulSet.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "alertmanager") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 4 }}
annotations:
{{- toYaml .Values.alertmanager.annotations | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
replicas: {{ .Values.alertmanager.replicas }}
selector:
matchLabels:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 6 }}
strategy:
{{- toYaml .Values.alertmanager.strategy | nindent 4 }}
template:
metadata:
labels:
{{- include "mimir.podLabels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 8 }}
annotations:
{{- include "mimir.podAnnotations" (dict "ctx" . "component" "alertmanager") | nindent 8 }}
{{- if .Values.alertmanager.fallbackConfig }}
checksum/alertmanager-fallback-config: {{ include (print .Template.BasePath "/alertmanager/alertmanager-config.yaml") . | sha256sum }}
{{- end }}
namespace: {{ .Release.Namespace | quote }}
spec:
serviceAccountName: {{ template "mimir.serviceAccountName" . }}
{{- if .Values.alertmanager.priorityClassName }}
priorityClassName: {{ .Values.query_frontend.priorityClassName }}
{{- end }}
securityContext:
{{- include "mimir.lib.podSecurityContext" (dict "ctx" . "component" "alertmanager") | nindent 8 }}
{{- with .Values.alertmanager.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end }}
containers:
- name: alertmanager
image: "{{ include "mimir.imageReference" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=alertmanager"
- "-config.expand-env=true"
- "-config.file=/etc/mimir/mimir.yaml"
{{- range $key, $value := .Values.alertmanager.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
volumeMounts:
{{- if .Values.alertmanager.extraVolumeMounts }}
{{ toYaml .Values.alertmanager.extraVolumeMounts | nindent 12}}
{{- end }}
{{- if .Values.global.extraVolumeMounts }}
{{ toYaml .Values.global.extraVolumeMounts | nindent 12}}
{{- end }}
- name: config
mountPath: /etc/mimir
{{- if .Values.enterprise.enabled }}
- name: license
mountPath: /license
{{- end }}
- name: runtime-config
mountPath: /var/{{ include "mimir.name" . }}
- name: storage
mountPath: "/data"
{{- if .Values.alertmanager.persistence.subPath }}
subPath: {{ .Values.alertmanager.persistence.subPath }}
{{- end }}
{{- if .Values.alertmanager.fallbackConfig }}
- name: alertmanager-fallback-config
mountPath: /configs/
{{- end }}
- name: tmp
mountPath: /tmp
- name: active-queries
mountPath: /active-query-tracker
ports:
- name: http-metrics
containerPort: {{ include "mimir.serverHttpListenPort" . }}
protocol: TCP
- name: grpc
containerPort: {{ include "mimir.serverGrpcListenPort" . }}
protocol: TCP
- name: memberlist
containerPort: {{ include "mimir.memberlistBindPort" . }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.alertmanager.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.alertmanager.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.alertmanager.resources | nindent 12 }}
securityContext:
{{- toYaml .Values.alertmanager.containerSecurityContext | nindent 12 }}
{{- if or .Values.global.extraEnv .Values.alertmanager.env }}
env:
{{- with .Values.global.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.alertmanager.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if or .Values.global.extraEnvFrom .Values.alertmanager.extraEnvFrom }}
envFrom:
{{- with .Values.global.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.alertmanager.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.alertmanager.extraContainers }}
{{ toYaml .Values.alertmanager.extraContainers | indent 8}}
{{- end }}
{{- with .Values.alertmanager.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.alertmanager.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "mimir.lib.topologySpreadConstraints" (dict "ctx" . "component" "alertmanager") | nindent 6 }}
{{- with .Values.alertmanager.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
terminationGracePeriodSeconds: {{ .Values.alertmanager.terminationGracePeriodSeconds }}
volumes:
- name: config
{{- include "mimir.configVolume" . | nindent 10 }}
{{- if .Values.enterprise.enabled }}
- name: license
secret:
secretName: {{ tpl .Values.license.secretName . }}
{{- end }}
- name: runtime-config
configMap:
name: {{ template "mimir.fullname" . }}-runtime
{{- if .Values.alertmanager.extraVolumes }}
{{ toYaml .Values.alertmanager.extraVolumes | indent 8}}
{{- end }}
{{- if .Values.global.extraVolumes }}
{{ toYaml .Values.global.extraVolumes | indent 8}}
{{- end }}
- name: storage
emptyDir: {}
- name: tmp
emptyDir: {}
- name: active-queries
emptyDir: {}
{{- if .Values.alertmanager.fallbackConfig }}
- name: alertmanager-fallback-config
configMap:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "alertmanager") }}-fallback-config
{{- end }}
{{- end -}}
{{- end -}}