Skip to content

Commit

Permalink
Merge pull request #114 from tryretool/fix-postgres-subchart-usage
Browse files Browse the repository at this point in the history
use the correct password for the postgresql subchart based on username
  • Loading branch information
anna-yn authored Aug 7, 2023
2 parents 774118a + 712b9a3 commit 60c7051
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/retool/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: retool
description: A Helm chart for Kubernetes
type: application
version: 5.0.9
version: 5.0.10
maintainers:
- name: Retool Engineering
email: [email protected]
Expand Down
10 changes: 10 additions & 0 deletions charts/retool/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

{{- if and .Values.postgresql.enabled (and (not .Values.postgresql.auth.postgresPassword) (eq .Values.postgresql.auth.username "postgres")) }}
***************************************************************************
Warning: Using in-cluster postgresql setup. `.Values.postgresql.auth.username username` is set to the default admin username "postgres", but the admin password field `.Values.postgresql.auth.postgresPassword` is not set, so a random password is generated and used. This wouldn't affect your usage, but if you choose to uninstall and reinstall this helm chart, please make sure you remove the existing PersistentVolumeClaim backing the in-cluster postgresql by running:
kubectl --namespace {{ .Release.Namespace }} delete pvc/data-{{ include "retool.fullname" . }}-postgresql-0
Alternatively, you can fetch the randomly generated password and set the value in `.Values.postgresql.auth.postgresPassword` to make sure it never changes unexpectedly:
echo $(kubectl --namespace {{ .Release.Namespace }} get secret/{{ include "retool.fullname" . }}-postgresql -o jsonpath='{.data.postgres-password}' | base64 -d)
We highly recommend you do NOT use this subchart as is to run Postgres in a container for your production instance of Retool. It is only suitable for proof-of-concepts. Please use a managed Postgres, or self-host more permanantly.
***************************************************************************
{{- end }}
6 changes: 6 additions & 0 deletions charts/retool/templates/deployment_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ spec:
secretKeyRef:
{{- if .Values.postgresql.enabled }}
name: {{ template "retool.postgresql.fullname" . }}
# `postgres` is the default admin username for postgres in the subchart we use, so it needs the admin password
# if a different username is picked, then it needs the custom password instead.
{{- if eq .Values.postgresql.auth.username "postgres" }}
key: postgres-password
{{- else }}
key: password
{{- end }}
{{- else }}
{{- if .Values.config.postgresql.passwordSecretName }}
name: {{ .Values.config.postgresql.passwordSecretName }}
Expand Down
2 changes: 2 additions & 0 deletions charts/retool/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ postgresql:
database: hammerhead_production
username: postgres
password: retool
# IMPORTANT: When setting username to `postgres` a random password will be generated unless the postgresPassword field is uncommented
# postgresPassword: retool
service:
port: 5432
# Use the offical docker image rather than bitnami/docker
Expand Down
2 changes: 2 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ postgresql:
database: hammerhead_production
username: postgres
password: retool
# IMPORTANT: When setting username to `postgres` a random password will be generated unless the postgresPassword field is uncommented
# postgresPassword: retool
service:
port: 5432
# Use the offical docker image rather than bitnami/docker
Expand Down

0 comments on commit 60c7051

Please sign in to comment.