Skip to content

Commit

Permalink
allow to provide the users password in an existing secret
Browse files Browse the repository at this point in the history
  • Loading branch information
glehmann committed Sep 29, 2022
1 parent e684210 commit 439073d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cockroachdb/templates/job.init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ spec:
{{- range $user := .Values.init.provisioning.users }}
CREATE USER IF NOT EXISTS {{ $user.name }} WITH
{{- if $user.password }}
{{- if or $user.password $user.passwordSecretName }}
PASSWORD '${{ $user.name }}_PASSWORD'
{{- else }}
PASSWORD null
Expand Down Expand Up @@ -211,6 +211,12 @@ spec:
secretKeyRef:
name: {{ $secretName }}
key: {{ $user.name }}-password
{{- else if $user.passwordSecretName }}
- name: {{ $user.name }}_PASSWORD
valueFrom:
secretKeyRef:
name: {{ $user.passwordSecretName }}
key: {{ $user.passwordSecretKey | default (printf "%s-password" $user.name) }}
{{- end }}
{{- end }}
{{- range $clusterSetting, $clusterSettingValue := .Values.init.provisioning.clusterSettings }}
Expand Down
4 changes: 4 additions & 0 deletions cockroachdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ init:
# password:
# # https://www.cockroachlabs.com/docs/stable/create-user.html#parameters
# options: [LOGIN]
# # existing secret name containing the password. Ignored in password is defined.
# passwordSecretName:
# # password secret key. Defaults to $name-password. Ignored in password is defined.
# passwordSecretKey:
databases: []
# - name:
# # https://www.cockroachlabs.com/docs/stable/create-database.html#parameters
Expand Down

0 comments on commit 439073d

Please sign in to comment.