Skip to content

Commit

Permalink
helm: Output database-specific connection command
Browse files Browse the repository at this point in the history
When the helm chart finishes installing, it prints out instructions for
connecting to the newly created deployment. Previously, these
instructions were only provided for mysql, and they were provided
regardless of the database type.

This commit looks at adapter.type and prints out the appropriate mysql
or psql command accordingly.

Refs: REA-2744
Change-Id: Iad41b5cfb9271b9c1eb906cdefa878a2849e09a6
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/5533
Tested-by: Buildkite CI
Reviewed-by: Jason Camp <jason@readyset.io>
  • Loading branch information
lukoktonos committed Jul 25, 2023
1 parent 9b50ec9 commit 94d833f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion helm/readyset/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ APP VERSION: {{ .Chart.AppVersion }}

Give the chart approximately 5 minutes to deploy. When the service is ready, you should see all pods up.

{{- if eq .Values.readyset.adapter.type "mysql" }}
For connecting to MySQL:

mysql -u $(kubectl get secret readyset-upstream-database -o jsonpath="{.data.username}" | base64 -d) \
mysql \
-u $(kubectl get secret readyset-upstream-database -o jsonpath="{.data.username}" | base64 -d) \
-h $(kubectl get svc readyset-adapter --template {{ "\"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}\"" }}) \
--password=$(kubectl get secret readyset-upstream-database -o jsonpath="{.data.password}" | base64 -d) \
--database=$(kubectl get secret readyset-upstream-database -o jsonpath="{.data.database}" | base64 -d)

{{- else if eq .Values.readyset.adapter.type "postgresql" }}
For connecting to PostgreSQL:

PGPASS=$(kubectl get secret readyset-upstream-database -o jsonpath="{.data.password}" | base64 -d) \
psql \
-U $(kubectl get secret readyset-upstream-database -o jsonpath="{.data.username}" | base64 -d) \
-h $(kubectl get svc readyset-adapter --template {{ "\"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}\"" }}) \
--dbname=$(kubectl get secret readyset-upstream-database -o jsonpath="{.data.database}" | base64 -d)

{{- end }}

0 comments on commit 94d833f

Please sign in to comment.