feat(stable/prometheus-mysql-exporter): store MySQL password in a k8s Secret (#14712)

The DATA_SOURCE_NAME environment variable contains a secret key for
authenticating to th MySQL instance (.Values.mysql.pass). This secret
should be stored in a K8s Secret object rather than directly on the
Deployment. Kubernetes RBAC requires more elevated permissions for
viewing Secret data than for viewing Deployment configuration.

Signed-off-by: Thomas Lovett <tklovett@gmail.com>
This commit is contained in:
Thomas Lovett
2019-06-20 09:26:49 -07:00
committed by Kubernetes Prow Robot
parent 5be1dd36fb
commit ee98b028d7
3 changed files with 11 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart for prometheus mysql exporter with cloudsqlproxy
name: prometheus-mysql-exporter
version: 0.3.4
version: 0.4.0
home: https://github.com/prometheus/mysqld_exporter
appVersion: v0.11.0
sources:
@@ -48,9 +48,9 @@ spec:
{{- end }}
]
{{- end }}
env:
- name: DATA_SOURCE_NAME
value: "{{ .Values.mysql.user }}:{{ .Values.mysql.pass }}@{{ if .Values.mysql.protocol }}{{ .Values.mysql.protocol }}{{ end }}({{ .Values.mysql.host }}:{{ .Values.mysql.port }})/{{ if .Values.mysql.db }}{{ .Values.mysql.db }}{{ end }}{{ if .Values.mysql.param }}?{{ .Values.mysql.param }}{{ end }}"
envFrom:
- secretRef:
name: {{ template "prometheus-mysql-exporter.fullname" . }}
ports:
- containerPort: {{ .Values.service.internalPort }}
livenessProbe:
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ template "prometheus-mysql-exporter.fullname" . }}
type: Opaque
stringData:
DATA_SOURCE_NAME: "{{ .Values.mysql.user }}:{{ .Values.mysql.pass }}@{{ if .Values.mysql.protocol }}{{ .Values.mysql.protocol }}{{ end }}({{ .Values.mysql.host }}:{{ .Values.mysql.port }})/{{ if .Values.mysql.db }}{{ .Values.mysql.db }}{{ end }}{{ if .Values.mysql.param }}?{{ .Values.mysql.param }}{{ end }}"