[stable/postgresql] Merge metrics into master statefulset as sidecar. (#9574)

Signed-off-by: Cédric de Saint Martin <cdesaintmartin@wiremind.fr>
This commit is contained in:
Cédric de Saint Martin
2018-12-04 23:42:32 -08:00
committed by Kubernetes Prow Robot
parent 49d70a7fd7
commit 6d29127913
7 changed files with 50 additions and 108 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: postgresql
version: 2.7.6
version: 2.7.7
appVersion: 10.6.0
description: Chart for PostgreSQL, an object-relational database management system (ORDBMS) with an emphasis on extensibility and on standards-compliance.
keywords:
+1 -1
View File
@@ -105,7 +105,7 @@ The following tables lists the configurable parameters of the PostgreSQL chart a
| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed | 1 |
| `metrics.enabled` | Start a prometheus exporter | `false` |
| `metrics.service.type` | Kubernetes Service type | `ClusterIP` |
| `metrics.service.annotatios` | Additional annotations for metrics exporter pod | `{}` |
| `metrics.service.annotations` | Additional annotations for metrics exporter pod | `{}` |
| `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` |
| `metrics.image.registry` | PostgreSQL Image registry | `docker.io` |
| `metrics.image.repository` | PostgreSQL Image name | `wrouesnel/postgres_exporter` |
@@ -1,88 +0,0 @@
{{- if .Values.metrics.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "postgresql.fullname" . }}-metrics
labels:
app: {{ template "postgresql.name" . }}
chart: {{ template "postgresql.chart" . }}
release: {{ .Release.Name | quote}}
heritage: {{ .Release.Service | quote }}
spec:
selector:
matchLabels:
release: {{ .Release.Name | quote }}
app: {{ template "postgresql.name" . }}
role: metrics
template:
metadata:
labels:
release: {{ .Release.Name | quote }}
app: {{ template "postgresql.name" . }}
chart: {{ template "postgresql.chart" . }}
role: metrics
{{- if .Values.metrics.podLabels }}
{{ toYaml .Values.metrics.podLabels | indent 8 }}
{{- end }}
{{- if .Values.metrics.podAnnotations }}
annotations:
{{ toYaml .Values.metrics.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.metrics.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end}}
{{- if .Values.metrics.nodeSelector }}
nodeSelector:
{{ toYaml .Values.metrics.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.metrics.tolerations }}
tolerations:
{{ toYaml .Values.metrics.tolerations | indent 8 }}
{{- end }}
containers:
- name: metrics
image: {{ template "metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
env:
{{- $database := required "In order to enable metrics you need to specify a database (.Values.postgresqlDatabase)" .Values.postgresqlDatabase }}
- name: DATA_SOURCE_URI
value: {{ printf "%s:%d/%s?sslmode=disable" ( include "postgresql.fullname" . ) (int .Values.service.port) $database | quote }}
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
name: {{ template "postgresql.fullname" . }}
key: postgresql-password
- name: DATA_SOURCE_USER
value: {{ .Values.postgresqlUsername }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: metrics
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /
port: metrics
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- end }}
ports:
- name: metrics
containerPort: 9187
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
+1 -1
View File
@@ -22,5 +22,5 @@ spec:
selector:
app: {{ template "postgresql.name" . }}
release: {{ .Release.Name }}
role: metrics
role: master
{{- end }}
+47 -1
View File
@@ -32,11 +32,14 @@ spec:
fsGroup: {{ .Values.securityContext.fsGroup }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
{{- if .Values.image.pullSecrets }}
{{- if or .Values.image.pullSecrets .Values.metrics.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- range .Values.metrics.image.pullSecrets }}
- name: {{ . }}
{{- end}}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
@@ -156,6 +159,49 @@ spec:
mountPath: /opt/bitnami/postgresql/conf/pg_hba.conf
subPath: pg_hba.conf
{{ end }}
{{- if .Values.metrics.enabled }}
- name: metrics
image: {{ template "metrics.image" . }}
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
env:
{{- $database := required "In order to enable metrics you need to specify a database (.Values.postgresqlDatabase)" .Values.postgresqlDatabase }}
- name: DATA_SOURCE_URI
value: {{ printf "localhost:%d/%s?sslmode=disable" (int .Values.service.port) $database | quote }}
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
name: {{ template "postgresql.fullname" . }}
key: postgresql-password
- name: DATA_SOURCE_USER
value: {{ .Values.postgresqlUsername }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
httpGet:
path: /
port: metrics
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
successThreshold: {{ .Values.livenessProbe.successThreshold }}
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
httpGet:
path: /
port: metrics
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
{{- end }}
ports:
- name: metrics
containerPort: 9187
resources:
{{ toYaml .Values.metrics.resources | indent 10 }}
{{- end }}
volumes:
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: {{ .Values.persistence.existingClaim }}
-8
View File
@@ -182,7 +182,6 @@ readinessProbe:
metrics:
enabled: true
# resources: {}
# podAnnotations: {}
service:
type: ClusterIP
annotations:
@@ -201,13 +200,6 @@ metrics:
# pullSecrets:
# - myRegistrKeySecretName
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod Annotation and Labels
# podLabels: {}
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
## Configure extra options for liveness and readiness probes
livenessProbe:
-8
View File
@@ -189,7 +189,6 @@ readinessProbe:
metrics:
enabled: false
# resources: {}
# podAnnotations: {}
service:
type: ClusterIP
annotations:
@@ -208,13 +207,6 @@ metrics:
# pullSecrets:
# - myRegistrKeySecretName
## Metrics exporter labels and tolerations for pod assignment
# nodeSelector: {"beta.kubernetes.io/arch": "amd64"}
# tolerations: []
## Metrics exporter pod Annotation and Labels
# podLabels: {}
## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes)
## Configure extra options for liveness and readiness probes
livenessProbe: