[stable/prometheus-postgres-exporter] add support for Google Cloud SQL (#6009)

* add support for Google Cloud SQL

Cloud SQL, Google's managed database product, requires use of an authentication
proxy when accessed from dynamic IPs. To limit access to the proxy, it is
recommended to use a sidecar.
More info: https://cloud.google.com/sql/docs/postgres/connect-kubernetes-engine

Cloud SQL, like other managed databases, does not allow use of
superuser accounts. Therefore, add support for a configurable
database in `datasource`.
More info: https://github.com/wrouesnel/postgres_exporter#running-as-non-superuser

* re-bump chart version

* use extraContainers & extraVolumes
This commit is contained in:
Michael Raimondi
2018-06-24 07:20:03 -07:00
committed by k8s-ci-robot
parent 89b3e3104b
commit 0c1ec955e5
5 changed files with 19 additions and 4 deletions
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.4.6"
description: A Helm chart for prometheus postgres-exporter
name: prometheus-postgres-exporter
version: 0.3.0
version: 0.4.0
home: https://github.com/wrouesnel/postgres_exporter
sources:
- https://github.com/wrouesnel/postgres_exporter
@@ -55,6 +55,8 @@ The following table lists the configurable parameters of the postgres Exporter c
| `nodeSelector` | node labels for pod assignment | `{}` |
| `affinity` | node/pod affinities | `{}` |
| `annotations` | Deployment annotations | `{}` |
| `extraContainers` | Additional sidecar containers | `""` |
| `extraVolumes` | Additional volumes for use in extraContainers | `""` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -29,7 +29,7 @@ spec:
- name: {{ .Chart.Name }}
args:
- "--extend.query-path=/etc/config.yaml"
env:
env:
- name: DATA_SOURCE_NAME
valueFrom:
secretKeyRef:
@@ -55,6 +55,9 @@ spec:
- name: queries
mountPath: /etc/config.yaml
subPath: config.yaml
{{- with .Values.extraContainers }}
{{ tpl . $ | indent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | indent 8 }}
@@ -71,4 +74,7 @@ spec:
- configMap:
defaultMode: 420
name: {{ template "prometheus-postgres-exporter.fullname" . }}
name: queries
name: queries
{{- with .Values.extraVolumes }}
{{ tpl . $ | indent 6 }}
{{- end }}
@@ -9,4 +9,4 @@ metadata:
release: {{ .Release.Name }}
type: Opaque
data:
data_source_name: "{{ printf "postgresql://%s:%s@%s:%s/?sslmode=%s" .Values.config.datasource.user .Values.config.datasource.password .Values.config.datasource.host .Values.config.datasource.port .Values.config.datasource.sslmode | b64enc }}"
data_source_name: "{{ printf "postgresql://%s:%s@%s:%s/%s?sslmode=%s" .Values.config.datasource.user .Values.config.datasource.password .Values.config.datasource.host .Values.config.datasource.port .Values.config.datasource.database .Values.config.datasource.sslmode | b64enc }}"
@@ -44,6 +44,7 @@ config:
user:
password:
port: "5432"
database: ''
sslmode: disable
# this are the defaults queries that the exporter will run, extracted from: https://github.com/wrouesnel/postgres_exporter/blob/master/queries.yaml
queries: |-
@@ -145,3 +146,9 @@ tolerations: []
affinity: {}
annotations: {}
# Additional sidecar containers, e. g. for a database proxy, such as Google's cloudsql-proxy
extraContainers: |
# Additional volumes, e. g. for secrets used in an extraContainer
extraVolumes: |