diff --git a/stable/postgresql/Chart.yaml b/stable/postgresql/Chart.yaml index 797fd8ecce..ec8b2aaed1 100644 --- a/stable/postgresql/Chart.yaml +++ b/stable/postgresql/Chart.yaml @@ -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: diff --git a/stable/postgresql/README.md b/stable/postgresql/README.md index 8215966e97..ba3a5822c6 100644 --- a/stable/postgresql/README.md +++ b/stable/postgresql/README.md @@ -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` | diff --git a/stable/postgresql/templates/metrics-deployment.yaml b/stable/postgresql/templates/metrics-deployment.yaml deleted file mode 100644 index c8665b59eb..0000000000 --- a/stable/postgresql/templates/metrics-deployment.yaml +++ /dev/null @@ -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 }} diff --git a/stable/postgresql/templates/metrics-svc.yaml b/stable/postgresql/templates/metrics-svc.yaml index 0559c8cfdc..2e210e349a 100644 --- a/stable/postgresql/templates/metrics-svc.yaml +++ b/stable/postgresql/templates/metrics-svc.yaml @@ -22,5 +22,5 @@ spec: selector: app: {{ template "postgresql.name" . }} release: {{ .Release.Name }} - role: metrics + role: master {{- end }} diff --git a/stable/postgresql/templates/statefulset.yaml b/stable/postgresql/templates/statefulset.yaml index c6da94813e..3b6a3a05b8 100644 --- a/stable/postgresql/templates/statefulset.yaml +++ b/stable/postgresql/templates/statefulset.yaml @@ -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 }} diff --git a/stable/postgresql/values-production.yaml b/stable/postgresql/values-production.yaml index dc29308171..0e7232417a 100644 --- a/stable/postgresql/values-production.yaml +++ b/stable/postgresql/values-production.yaml @@ -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: diff --git a/stable/postgresql/values.yaml b/stable/postgresql/values.yaml index ffb15b4657..9d2f435479 100644 --- a/stable/postgresql/values.yaml +++ b/stable/postgresql/values.yaml @@ -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: