-
Notifications
You must be signed in to change notification settings - Fork 164
/
alertmanager-dep.yaml
169 lines (169 loc) · 7.36 KB
/
alertmanager-dep.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
{{- if .Values.alertmanager.enabled -}}
{{- if not .Values.alertmanager.statefulSet.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cortex.alertmanagerFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cortex.alertmanagerLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
annotations:
{{- toYaml .Values.alertmanager.annotations | nindent 4 }}
spec:
replicas: {{ .Values.alertmanager.replicas }}
selector:
matchLabels:
{{- include "cortex.alertmanagerSelectorLabels" . | nindent 6 }}
strategy:
{{- toYaml .Values.alertmanager.strategy | nindent 4 }}
template:
metadata:
labels:
{{- include "cortex.alertmanagerLabels" . | nindent 8 }}
app.kubernetes.io/part-of: memberlist
{{- with .Values.alertmanager.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
checksum/config: {{ include "cortex.configChecksum" . }}
{{- with .Values.alertmanager.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ .Values.alertmanager.serviceAccount.name | default (include "cortex.serviceAccountName" . ) }}
{{- if .Values.alertmanager.priorityClassName }}
priorityClassName: {{ .Values.alertmanager.priorityClassName }}
{{- end }}
{{- if .Values.alertmanager.securityContext.enabled }}
securityContext: {{- omit .Values.alertmanager.securityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- toYaml .Values.alertmanager.initContainers | nindent 8 }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
containers:
{{- if .Values.alertmanager.sidecar.enabled }}
- name: {{ template "cortex.name" . }}-sc-alertmanager
{{- if .Values.alertmanager.sidecar.image.sha }}
image: "{{ .Values.alertmanager.sidecar.image.repository }}:{{ .Values.alertmanager.sidecar.image.tag }}@sha256:{{ .Values.alertmanager.sidecar.image.sha }}"
{{- else }}
image: "{{ .Values.alertmanager.sidecar.image.repository }}:{{ .Values.alertmanager.sidecar.image.tag }}"
{{- end }}
imagePullPolicy: {{ .Values.alertmanager.sidecar.imagePullPolicy }}
env:
{{- if .Values.alertmanager.sidecar.watchMethod }}
- name: METHOD
value: {{ .Values.alertmanager.sidecar.watchMethod }}
{{ end }}
- name: LABEL
value: "{{ .Values.alertmanager.sidecar.label }}"
{{- if .Values.alertmanager.sidecar.labelValue }}
- name: LABEL_VALUE
value: {{ quote .Values.alertmanager.sidecar.labelValue }}
{{- end }}
- name: FOLDER
value: "{{ .Values.alertmanager.sidecar.folder }}{{- with .Values.alertmanager.sidecar.defaultFolderName }}/{{ . }}{{- end }}"
{{- if .Values.alertmanager.sidecar.resource}}
- name: RESOURCE
value: {{ quote .Values.alertmanager.sidecar.resource }}
{{- end }}
{{- if .Values.alertmanager.sidecar.enableUniqueFilenames }}
- name: UNIQUE_FILENAMES
value: "{{ .Values.alertmanager.sidecar.enableUniqueFilenames }}"
{{- end }}
{{- if .Values.alertmanager.sidecar.searchNamespace }}
- name: NAMESPACE
value: "{{ .Values.alertmanager.sidecar.searchNamespace }}"
{{- end }}
{{- if .Values.alertmanager.sidecar.skipTlsVerify }}
- name: SKIP_TLS_VERIFY
value: "{{ .Values.alertmanager.sidecar.skipTlsVerify }}"
{{- end }}
{{- if .Values.alertmanager.sidecar.folderAnnotation }}
- name: FOLDER_ANNOTATION
value: "{{ .Values.alertmanager.sidecar.folderAnnotation }}"
{{- end }}
resources:
{{- toYaml .Values.alertmanager.sidecar.resources | nindent 12 }}
{{- if .Values.alertmanager.sidecar.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.alertmanager.sidecar.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
volumeMounts:
- name: storage
mountPath: "/data"
{{- end }}
- name: alertmanager
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=alertmanager"
- "-config.file=/etc/cortex/cortex.yaml"
{{- range $key, $value := .Values.alertmanager.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
volumeMounts:
{{- if .Values.alertmanager.extraVolumeMounts }}
{{- toYaml .Values.alertmanager.extraVolumeMounts | nindent 12}}
{{- end }}
- name: config
mountPath: /etc/cortex
- name: runtime-config
mountPath: /etc/cortex-runtime-config
- name: storage
mountPath: "/data"
{{- with .Values.alertmanager.persistentVolume.subPath }}
subPath: {{ . }}
{{- end }}
ports:
- name: http-metrics
containerPort: {{ .Values.config.server.http_listen_port }}
protocol: TCP
- name: gossip
containerPort: {{ .Values.config.memberlist.bind_port }}
protocol: TCP
startupProbe:
{{- toYaml .Values.alertmanager.startupProbe | nindent 12 }}
livenessProbe:
{{- toYaml .Values.alertmanager.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.alertmanager.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.alertmanager.resources | nindent 12 }}
{{- if .Values.alertmanager.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.alertmanager.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.alertmanager.env }}
env:
{{- toYaml .Values.alertmanager.env | nindent 12 }}
{{- end }}
{{- if .Values.alertmanager.extraContainers }}
{{- toYaml .Values.alertmanager.extraContainers | nindent 8}}
{{- end }}
nodeSelector:
{{- toYaml .Values.alertmanager.nodeSelector | nindent 8 }}
{{- if .Values.alertmanager.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml .Values.alertmanager.topologySpreadConstraints | nindent 8}}
{{- end }}
affinity:
{{- toYaml .Values.alertmanager.affinity | nindent 8 }}
tolerations:
{{- toYaml .Values.alertmanager.tolerations | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.alertmanager.terminationGracePeriodSeconds }}
volumes:
{{- include "cortex.configVolume" . | nindent 8 }}
- name: runtime-config
configMap:
name: {{ template "cortex.fullname" . }}-runtime-config
- name: storage
emptyDir: {}
{{- if .Values.alertmanager.extraVolumes }}
{{- toYaml .Values.alertmanager.extraVolumes | nindent 8 }}
{{- end }}
{{- end -}}
{{- end -}}