rancher-partner-charts/charts/kubecost/cost-analyzer/2.3.1/templates/prometheus-alertmanager-dep...

149 lines
6.5 KiB
YAML

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