mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
* [stable/prometheus-postgres-exporter] Add support to configure datasource from secret in Kubernetes Signed-off-by: Nick Metz <nick.metz@ptvgroup.com> * fix typo in values.yaml Signed-off-by: Nick Metz <nick.metz@ptvgroup.com>
119 lines
4.1 KiB
YAML
119 lines
4.1 KiB
YAML
{{- if and .Values.config.datasource.passwordSecret .Values.config.datasource.password -}}
|
|
{{ fail (printf "ERROR: only one of .Values.config.datasource.passwordSecret and .Values.config.datasource.password must be defined") }}
|
|
{{- end -}}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "prometheus-postgres-exporter.fullname" . }}
|
|
labels:
|
|
app: {{ template "prometheus-postgres-exporter.name" . }}
|
|
chart: {{ template "prometheus-postgres-exporter.chart" . }}
|
|
release: {{ .Release.Name }}
|
|
heritage: {{ .Release.Service }}
|
|
spec:
|
|
replicas: {{ .Values.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app: {{ template "prometheus-postgres-exporter.name" . }}
|
|
release: {{ .Release.Name }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ template "prometheus-postgres-exporter.name" . }}
|
|
release: {{ .Release.Name }}
|
|
{{- if .Values.podLabels }}
|
|
{{ toYaml .Values.podLabels | trim | indent 8 }}
|
|
{{- end }}
|
|
annotations:
|
|
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
|
{{- if .Values.annotations }}
|
|
{{ toYaml .Values.annotations | indent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceAccountName: {{ template "prometheus-postgres-exporter.serviceAccountName" . }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
args:
|
|
- "--extend.query-path=/etc/config.yaml"
|
|
{{- if .Values.config.disableDefaultMetrics }}
|
|
- "--disable-default-metrics"
|
|
{{- end }}
|
|
{{- if .Values.config.disableSettingsMetrics }}
|
|
- "--disable-settings-metrics"
|
|
{{- end }}
|
|
{{- if .Values.config.autoDiscoverDatabases }}
|
|
- "--auto-discover-databases"
|
|
{{- if .Values.config.excludeDatabases }}
|
|
- "--exclude-databases"
|
|
- {{ .Values.config.excludeDatabases | join "," }}
|
|
{{- end }}
|
|
{{- end }}
|
|
env:
|
|
{{- if .Values.config.datasourceSecret }}
|
|
- name: DATA_SOURCE_NAME
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ .Values.config.datasourceSecret.name }}
|
|
key: {{ .Values.config.datasourceSecret.key }}
|
|
{{- else }}
|
|
- name: DATA_SOURCE_URI
|
|
value: {{ template "prometheus-postgres-exporter.data_source_uri" . }}
|
|
- name: DATA_SOURCE_USER
|
|
value: {{ .Values.config.datasource.user }}
|
|
- name: DATA_SOURCE_PASS
|
|
valueFrom:
|
|
secretKeyRef:
|
|
{{- if .Values.config.datasource.passwordSecret }}
|
|
name: {{ .Values.config.datasource.passwordSecret.name }}
|
|
key: {{ .Values.config.datasource.passwordSecret.key }}
|
|
{{- else }}
|
|
name: {{ template "prometheus-postgres-exporter.fullname" . }}
|
|
key: data_source_password
|
|
{{- end }}
|
|
{{- end }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.service.targetPort }}
|
|
protocol: TCP
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /
|
|
port: http
|
|
resources:
|
|
{{ toYaml .Values.resources | indent 12 }}
|
|
volumeMounts:
|
|
- name: queries
|
|
mountPath: /etc/config.yaml
|
|
subPath: config.yaml
|
|
{{- with .Values.extraContainers }}
|
|
{{ tpl . $ | indent 8 }}
|
|
{{- end }}
|
|
securityContext:
|
|
{{ toYaml .Values.securityContext | indent 8 }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{ toYaml . | indent 8 }}
|
|
{{- end }}
|
|
volumes:
|
|
- configMap:
|
|
defaultMode: 420
|
|
name: {{ template "prometheus-postgres-exporter.fullname" . }}
|
|
name: queries
|
|
{{- with .Values.extraVolumes }}
|
|
{{ tpl . $ | indent 6 }}
|
|
{{- end }}
|