Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow to provide the users password in an existing secret #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions build/templates/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
nameOverride:
fullNameOverride:

image:
repository: cockroachdb/cockroach
tag: v{{ .AppVersion }}
Expand Down Expand Up @@ -314,6 +317,9 @@ ingress:
# - hosts: [cockroachlabs.com]
# secretName: cockroachlabs-tls

prometheus:
enabled: true

# CockroachDB's Prometheus operator ServiceMonitor support
serviceMonitor:
enabled: false
Expand Down Expand Up @@ -403,11 +409,17 @@ 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
# options: [encoding='utf-8']
# owners: []
# # Backup schedules are not idemponent for now and will fail on next run
# # https://github.com/cockroachdb/cockroach/issues/57892
# backup:
# into: s3://
# # Enterprise-only option (revision_history)
Expand Down
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: {{ tpl $user.passwordSecretName $ }}
key: {{ $user.passwordSecretKey | default (printf "%s-password" $user.name) }}
{{- end }}
{{- end }}
{{- range $clusterSetting, $clusterSettingValue := .Values.init.provisioning.clusterSettings }}
Expand Down