added repo

This commit is contained in:
Your Name
2026-08-26 03:39:42 +05:30
parent 45c25a95af
commit b8575bb8b9
6889 changed files with 1217125 additions and 0 deletions
@@ -0,0 +1,16 @@
{{- if .Values.alertmanager.enabled -}}
{{- if .Values.alertmanager.fallbackConfig -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "alertmanager") }}-fallback-config
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 4 }}
annotations:
{{- toYaml .Values.alertmanager.annotations | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
data:
alertmanager_fallback_config.yaml: |
{{- .Values.alertmanager.fallbackConfig | nindent 4 }}
{{- end -}}
{{- end -}}
@@ -0,0 +1,167 @@
{{- 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 -}}
@@ -0,0 +1,3 @@
{{- if .Values.alertmanager.enabled -}}
{{- include "mimir.lib.podDisruptionBudget" (dict "ctx" $ "component" "alertmanager" "memberlist" true) }}
{{- end -}}
@@ -0,0 +1,3 @@
{{- if .Values.alertmanager.enabled -}}
{{- include "mimir.lib.serviceMonitor" (dict "ctx" $ "component" "alertmanager" "memberlist" true) }}
{{- end -}}
@@ -0,0 +1,226 @@
{{- if .Values.alertmanager.enabled -}}
{{- if .Values.alertmanager.statefulSet.enabled -}}
{{- $args := dict "ctx" . "component" "alertmanager" "memberlist" true -}}
{{- $zonesMap := include "mimir.zoneAwareReplicationMap" $args | fromYaml -}}
{{- range $zoneName, $rolloutZone := $zonesMap }}
{{- with $ -}}
{{- $_ := set $args "rolloutZoneName" $zoneName -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "mimir.resourceName" $args }}
labels:
{{- include "mimir.labels" $args | nindent 4 }}
annotations:
{{- include "mimir.componentAnnotations" $args | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
replicas: {{ $rolloutZone.replicas }}
{{- if and (semverCompare ">= 1.23-0" (include "mimir.kubeVersion" .)) (.Values.alertmanager.persistentVolume.enableRetentionPolicy) }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: {{ .Values.alertmanager.persistentVolume.whenDeleted }}
whenScaled: {{ .Values.alertmanager.persistentVolume.whenScaled }}
{{- end }}
selector:
matchLabels:
{{- include "mimir.selectorLabels" $args | nindent 6 }}
updateStrategy:
{{- if $zoneName }}
type: OnDelete
{{- else }}
{{- toYaml .Values.alertmanager.statefulStrategy | nindent 4 }}
{{- end }}
serviceName: {{ template "mimir.fullname" . }}-alertmanager
{{- if .Values.alertmanager.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: storage
{{- if .Values.alertmanager.persistentVolume.annotations }}
annotations:
{{ toYaml .Values.alertmanager.persistentVolume.annotations | nindent 10 }}
{{- end }}
spec:
{{- $storageClass := default .Values.alertmanager.persistentVolume.storageClass $rolloutZone.storageClass }}
{{- if $storageClass }}
{{- if (eq "-" $storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: {{ $storageClass }}
{{- end }}
{{- end }}
accessModes:
{{- toYaml .Values.alertmanager.persistentVolume.accessModes | nindent 10 }}
resources:
requests:
storage: "{{ .Values.alertmanager.persistentVolume.size }}"
{{- end }}
template:
metadata:
labels:
{{- include "mimir.podLabels" $args | nindent 8 }}
annotations:
{{- include "mimir.podAnnotations" $args | 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:
{{- with .Values.alertmanager.schedulerName }}
schedulerName: {{ . | quote }}
{{- end }}
serviceAccountName: {{ template "mimir.serviceAccountName" . }}
{{- if .Values.alertmanager.priorityClassName }}
priorityClassName: {{ .Values.alertmanager.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 }}
{{- with $rolloutZone.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $rolloutZone.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 not .Values.alertmanager.persistentVolume.enabled }}
- name: storage
emptyDir: {}
{{- end }}
- 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 }}
{{- if .Values.alertmanager.extraVolumes }}
{{ toYaml .Values.alertmanager.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.global.extraVolumes }}
{{ toYaml .Values.global.extraVolumes | nindent 8 }}
{{- end }}
containers:
{{- if .Values.alertmanager.extraContainers }}
{{ toYaml .Values.alertmanager.extraContainers | nindent 8 }}
{{- end }}
- name: alertmanager
image: "{{ include "mimir.imageReference" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=alertmanager"
- "-config.expand-env=true"
- "-config.file=/etc/mimir/mimir.yaml"
{{- if $zoneName }}
- "-alertmanager.sharding-ring.instance-availability-zone={{ $zoneName }}"
{{- else }}
{{- if .Values.alertmanager.zoneAwareReplication.enabled }}
- "-alertmanager.sharding-ring.instance-availability-zone=zone-default"
{{- end }}
{{- end }}
{{- 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.persistentVolume.subPath }}
subPath: {{ .Values.alertmanager.persistentVolume.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 }}
{{- $jaeger_queue_size := dig "jaegerReporterMaxQueueSize" nil .Values.alertmanager }}
{{- if or .Values.global.extraEnv .Values.alertmanager.env $jaeger_queue_size }}
env:
{{- with .Values.global.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.alertmanager.env }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if $jaeger_queue_size }}
- name: "JAEGER_REPORTER_MAX_QUEUE_SIZE"
value: {{$jaeger_queue_size | toString | toYaml }}
{{- 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 }}
---
{{ end }}
{{ end }}
{{ end }}
{{ end }}
@@ -0,0 +1,34 @@
{{- if .Values.alertmanager.enabled -}}
{{- $clusterPort := regexReplaceAll ".+[:]" (default "0.0.0.0:9094" (include "mimir.alertmanagerClusterBindAddress" .) ) "" -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "alertmanager") }}-headless
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 4 }}
prometheus.io/service-monitor: "false"
{{- with .Values.alertmanager.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- toYaml .Values.alertmanager.service.annotations | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
type: ClusterIP
clusterIP: None
publishNotReadyAddresses: true
ports:
- port: {{ include "mimir.serverHttpListenPort" . }}
protocol: TCP
name: http-metrics
targetPort: http-metrics
- port: {{ include "mimir.serverGrpcListenPort" . }}
protocol: TCP
name: grpc
targetPort: grpc
- port: {{ $clusterPort }}
protocol: TCP
name: cluster
selector:
{{- include "mimir.selectorLabels" (dict "ctx" . "component" "alertmanager" "memberlist" true) | nindent 4 }}
{{- end -}}
@@ -0,0 +1,40 @@
{{- if .Values.alertmanager.enabled -}}
{{- $args := dict "ctx" . "component" "alertmanager" "memberlist" true -}}
{{- $zonesMap := include "mimir.zoneAwareReplicationMap" $args | fromYaml -}}
{{- range $zoneName, $rolloutZone := $zonesMap }}
{{- with $ -}}
{{- $_ := set $args "rolloutZoneName" $zoneName -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "mimir.resourceName" $args }}
labels:
{{- include "mimir.labels" $args | nindent 4 }}
{{- if and $zoneName .Values.alertmanager.zoneAwareReplication.migration.enabled }}
# Prevent scraping PODs via this service during migration as the original non zone-aware service already scrapes all PODs and you get duplicate metrics.
prometheus.io/service-monitor: "false"
{{- end }}
{{- with .Values.alertmanager.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- toYaml .Values.alertmanager.service.annotations | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
spec:
type: ClusterIP
ports:
- port: {{ include "mimir.serverHttpListenPort" . }}
protocol: TCP
name: http-metrics
targetPort: http-metrics
- port: {{ include "mimir.serverGrpcListenPort" . }}
protocol: TCP
name: grpc
targetPort: grpc
selector:
{{- include "mimir.selectorLabels" $args | nindent 4 }}
---
{{ end }}
{{ end }}
{{ end }}