Skip to content

Commit

Permalink
allow to use an existing secret for the user password
Browse files Browse the repository at this point in the history
  • Loading branch information
glehmann committed Oct 13, 2023
1 parent b90c016 commit 1612008
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python

secret_settings(disable_scrub=True)
config.define_bool("no-volumes")
cfg = config.parse()

Expand Down
12 changes: 9 additions & 3 deletions cockroachdb/templates/job.init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
{{- if and .Values.init.securityContext.enabled }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
capabilities:
drop: ["ALL"]
{{- end }}
volumeMounts:
Expand Down Expand Up @@ -169,7 +169,7 @@ spec:
{{- range $user := .Values.init.provisioning.users }}
CREATE USER IF NOT EXISTS {{ $user.name }} WITH
{{- if $user.password }}
{{- if or $user.password $user.password_existing_secret}}
PASSWORD '${{ $user.name }}_PASSWORD'
{{- else }}
PASSWORD null
Expand Down Expand Up @@ -239,6 +239,12 @@ spec:
secretKeyRef:
name: {{ $secretName }}
key: {{ $user.name }}-password
{{- else if $user.password_existing_secret }}
- name: {{ $user.name }}_PASSWORD
valueFrom:
secretKeyRef:
name: {{ tpl $user.password_existing_secret $ }}
key: {{ $user.password_existing_secret_key }}
{{- end }}
{{- end }}
{{- range $clusterSetting, $clusterSettingValue := .Values.init.provisioning.clusterSettings }}
Expand All @@ -261,7 +267,7 @@ spec:
{{- if and .Values.init.securityContext.enabled }}
securityContext:
allowPrivilegeEscalation: false
capabilities:
capabilities:
drop: ["ALL"]
{{- end }}
{{- if .Values.tls.enabled }}
Expand Down

0 comments on commit 1612008

Please sign in to comment.