11{{- if .Values.prometheusCollector.enabled }}
2+ {{- $tlsEnabled := .Values.prometheusCollector.tls.enabled }}
3+ {{- $basicAuthEnabled := .Values.prometheusCollector.basicAuth.enabled }}
4+ {{- $webConfigEnabled := or $tlsEnabled $basicAuthEnabled }}
25apiVersion : apps/v1
36kind : Deployment
47metadata :
3336 - " --web.enable-lifecycle"
3437 - " --storage.tsdb.retention.time={{ .Values.prometheusCollector.retention.time }}"
3538 - " --storage.tsdb.retention.size={{ .Values.prometheusCollector.retention.size }}"
36- {{- if .Values.prometheusCollector.basicAuth.enabled }}
39+ {{- if $webConfigEnabled }}
3740 - " --web.config.file=/etc/prometheus-web/web.yml"
3841 {{- end }}
3942 ports :
@@ -49,21 +52,47 @@ spec:
4952 mountPath : /etc/prometheus
5053 - name : storage
5154 mountPath : /prometheus
52- {{- if .Values.prometheusCollector.basicAuth.enabled }}
55+ {{- if $webConfigEnabled }}
5356 - name : web-config
5457 mountPath : /etc/prometheus-web
5558 readOnly : true
5659 {{- end }}
5760 livenessProbe :
61+ {{- if or $tlsEnabled $basicAuthEnabled }}
62+ exec :
63+ command :
64+ - /bin/sh
65+ - -c
66+ - |
67+ {{- if $basicAuthEnabled }}
68+ wget -q --spider {{ if $tlsEnabled }}--no-check-certificate https{{ else }}http{{ end }}://{{ .Values.prometheusCollector.basicAuth.username }}:$(cat /etc/prometheus-web/password)@localhost:{{ .Values.prometheusCollector.port }}/-/healthy
69+ {{- else }}
70+ wget -q --spider --no-check-certificate https://localhost:{{ .Values.prometheusCollector.port }}/-/healthy
71+ {{- end }}
72+ {{- else }}
5873 httpGet :
5974 path : /-/healthy
6075 port : prometheus
76+ {{- end }}
6177 initialDelaySeconds : 30
6278 periodSeconds : 15
6379 readinessProbe :
80+ {{- if or $tlsEnabled $basicAuthEnabled }}
81+ exec :
82+ command :
83+ - /bin/sh
84+ - -c
85+ - |
86+ {{- if $basicAuthEnabled }}
87+ wget -q --spider {{ if $tlsEnabled }}--no-check-certificate https{{ else }}http{{ end }}://{{ .Values.prometheusCollector.basicAuth.username }}:$(cat /etc/prometheus-web/password)@localhost:{{ .Values.prometheusCollector.port }}/-/ready
88+ {{- else }}
89+ wget -q --spider --no-check-certificate https://localhost:{{ .Values.prometheusCollector.port }}/-/ready
90+ {{- end }}
91+ {{- else }}
6492 httpGet :
6593 path : /-/ready
6694 port : prometheus
95+ {{- end }}
6796 initialDelaySeconds : 5
6897 periodSeconds : 5
6998 volumes :
73102 - name : storage
74103 emptyDir :
75104 sizeLimit : {{ .Values.prometheusCollector.storage.size }}
76- {{- if .Values.prometheusCollector.basicAuth.enabled }}
105+ {{- if $webConfigEnabled }}
77106 - name : web-config
78107 secret :
79108 secretName : {{ include "pgdog.fullname" . }}-prometheus-collector
0 commit comments