Add support for prometheus
[ric-plt/ric-dep.git] / helm / infrastructure / subcharts / prometheus / templates / pushgateway-deployment.yaml
1 {{- if .Values.pushgateway.enabled -}}
2 apiVersion: {{ template "prometheus.deployment.apiVersion" . }}
3 kind: Deployment
4 metadata:
5   labels:
6     {{- include "prometheus.pushgateway.labels" . | nindent 4 }}
7   name: {{ template "prometheus.pushgateway.fullname" . }}
8 {{ include "prometheus.namespace" . | indent 2 }}
9 spec:
10   selector:
11     {{- if .Values.schedulerName }}
12     schedulerName: "{{ .Values.schedulerName }}"
13     {{- end }}
14     matchLabels:
15       {{- include "prometheus.pushgateway.matchLabels" . | nindent 6 }}
16   replicas: {{ .Values.pushgateway.replicaCount }}
17   {{- if .Values.pushgateway.strategy }}
18   strategy:
19 {{ toYaml .Values.pushgateway.strategy | trim | indent 4 }}
20     {{ if eq .Values.pushgateway.strategy.type "Recreate" }}rollingUpdate: null{{ end }}
21 {{- end }}
22   template:
23     metadata:
24     {{- if .Values.pushgateway.podAnnotations }}
25       annotations:
26 {{ toYaml .Values.pushgateway.podAnnotations | indent 8 }}
27     {{- end }}
28       labels:
29         {{- include "prometheus.pushgateway.labels" . | nindent 8 }}
30     spec:
31       serviceAccountName: {{ template "prometheus.serviceAccountName.pushgateway" . }}
32       {{- if .Values.pushgateway.extraInitContainers }}
33       initContainers:
34 {{ toYaml .Values.pushgateway.extraInitContainers | indent 8 }}
35       {{- end }}
36 {{- if .Values.pushgateway.priorityClassName }}
37       priorityClassName: "{{ .Values.pushgateway.priorityClassName }}"
38 {{- end }}
39       containers:
40         - name: {{ template "prometheus.name" . }}-{{ .Values.pushgateway.name }}
41           image: "{{ .Values.pushgateway.image.repository }}:{{ .Values.pushgateway.image.tag }}"
42           imagePullPolicy: "{{ .Values.pushgateway.image.pullPolicy }}"
43           args:
44           {{- range $key, $value := .Values.pushgateway.extraArgs }}
45             - --{{ $key }}={{ $value }}
46           {{- end }}
47           ports:
48             - containerPort: 9091
49           livenessProbe:
50             httpGet:
51             {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
52               path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/healthy
53             {{- else }}
54               path: /-/healthy
55             {{- end }}
56               port: 9091
57             initialDelaySeconds: 10
58             timeoutSeconds: 10
59           readinessProbe:
60             httpGet:
61             {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
62               path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/ready
63             {{- else }}
64               path: /-/ready
65             {{- end }}
66               port: 9091
67             initialDelaySeconds: 10
68             timeoutSeconds: 10
69           resources:
70 {{ toYaml .Values.pushgateway.resources | indent 12 }}
71           {{- if .Values.pushgateway.persistentVolume.enabled }}
72           volumeMounts:
73             - name: storage-volume
74               mountPath: "{{ .Values.pushgateway.persistentVolume.mountPath }}"
75               subPath: "{{ .Values.pushgateway.persistentVolume.subPath }}"
76           {{- end }}
77     {{- if .Values.imagePullSecrets }}
78       imagePullSecrets:
79       {{ toYaml .Values.imagePullSecrets | indent 2 }}
80     {{- end }}
81     {{- if .Values.pushgateway.nodeSelector }}
82       nodeSelector:
83 {{ toYaml .Values.pushgateway.nodeSelector | indent 8 }}
84     {{- end }}
85     {{- if .Values.pushgateway.securityContext }}
86       securityContext:
87 {{ toYaml .Values.pushgateway.securityContext | indent 8 }}
88     {{- end }}
89     {{- if .Values.pushgateway.tolerations }}
90       tolerations:
91 {{ toYaml .Values.pushgateway.tolerations | indent 8 }}
92     {{- end }}
93     {{- if .Values.pushgateway.affinity }}
94       affinity:
95 {{ toYaml .Values.pushgateway.affinity | indent 8 }}
96     {{- end }}
97       {{- if .Values.pushgateway.persistentVolume.enabled }}
98       volumes:
99         - name: storage-volume
100           persistentVolumeClaim:
101             claimName: {{ if .Values.pushgateway.persistentVolume.existingClaim }}{{ .Values.pushgateway.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.pushgateway.fullname" . }}{{- end }}
102       {{- end -}}
103 {{- end }}