Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

Commit

Permalink
Add existingSecret configuration key to postgresql chart (#9729)
Browse files Browse the repository at this point in the history
* Add existingSecret configuration key to postgresql chart

Signed-off-by: Phillip Kast <phil@yearofcode.com>

* Use existingSecret in new metrics sidecar

Signed-off-by: Phillip Kast <phil@yearofcode.com>

* Bump chart version to 2.7.8

Signed-off-by: Phillip Kast <phil@yearofcode.com>
  • Loading branch information
yeahphil authored and k8s-ci-robot committed Dec 5, 2018
1 parent 309e097 commit 0ab8b4e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stable/postgresql/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: postgresql
version: 2.7.7
version: 2.7.8
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:
Expand Down
2 changes: 2 additions & 0 deletions stable/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ The following tables lists the configurable parameters of the PostgreSQL chart a
| `replication.user` | Replication user | `repl_user` |
| `replication.password` | Replication user password | `repl_password` |
| `replication.slaveReplicas` | Number of slaves replicas | `1` |
| `existingSecret` | Name of existing secret to use for postgresl passwords | `nil` |

| `postgresqlUsername` | PostgreSQL admin user | `postgres` |
| `postgresqlPassword` | PostgreSQL admin password | _random 10 character alphanumeric string_ |
| `postgresqlDatabase` | PostgreSQL database | `nil` |
Expand Down
3 changes: 2 additions & 1 deletion stable/postgresql/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ PostgreSQL can be accessed via port 5432 on the following DNS name from within y

To get the password for "{{ .Values.postgresqlUsername }}" run:

export POSTGRESQL_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "postgresql.fullname" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)
export POSTGRESQL_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }}
{{ if .Values.existingSecret }}{{ .Values.existingSecret }}{{ else }}{{ template "postgresql.fullname" . }}{{ end }} -o jsonpath="{.data.postgresql-password}" | base64 --decode)

To connect to your database run the following command:

Expand Down
2 changes: 2 additions & 0 deletions stable/postgresql/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.existingSecret }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -21,3 +22,4 @@ data:
postgresql-replication-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
{{ end }}
{{- end -}}
4 changes: 4 additions & 0 deletions stable/postgresql/templates/statefulset-slaves.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ spec:
- name: POSTGRESQL_REPLICATION_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "postgresql.fullname" . }}
{{- end }}
key: postgresql-replication-password
- name: POSTGRESQL_MASTER_HOST
value: {{ template "postgresql.fullname" . }}
Expand Down
8 changes: 8 additions & 0 deletions stable/postgresql/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ spec:
- name: POSTGRESQL_PASSWORD
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "postgresql.fullname" . }}
{{- end }}
key: postgresql-password
- name: POSTGRESQL_DATABASE
value: {{ .Values.postgresqlDatabase | quote }}
Expand Down Expand Up @@ -170,7 +174,11 @@ spec:
- name: DATA_SOURCE_PASS
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: {{ .Values.existingSecret }}
{{- else }}
name: {{ template "postgresql.fullname" . }}
{{- end }}
key: postgresql-password
- name: DATA_SOURCE_USER
value: {{ .Values.postgresqlUsername }}
Expand Down

0 comments on commit 0ab8b4e

Please sign in to comment.