Skip to content

Commit

Permalink
feat: allow passing postgresql username and password from secret as e…
Browse files Browse the repository at this point in the history
…nvironment variables separately

This allows the use of postgres-operator which provides the username and password as separate keys
  • Loading branch information
danielr1996 committed Jul 9, 2024
1 parent dab41d2 commit 9f55635
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/vaultwarden/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ maintainers:
- name: guerzon
email: [email protected]
url: https://github.com/guerzon
version: 0.23.1
version: 0.24.0
kubeVersion: ">=1.12.0-0"
19 changes: 18 additions & 1 deletion charts/vaultwarden/templates/_podSpec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,24 @@ containers:
- name: DISABLE_ADMIN_TOKEN
value: "true"
{{- end }}
{{- if ne "default" .Values.database.type }}
{{- if and ( eq .Values.database.type "postgresql") (not .Values.database.existingSecretKey)}}
- name: PGHOST
value: {{ .Values.database.host }}
- name: PGPORT
value: {{ .Values.database.port }}
- name: PGDATABASE
value: {{ .Values.database.dbName }}
- name: PGUSER
valueFrom:
secretKeyRef:
name: {{ .Values.database.existingSecret }}
key: {{ .Values.database.existingSecretUserKey }}
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.database.existingSecret }}
key: {{ .Values.database.existingSecretPasswordKey }}
{{- else if ne "default" .Values.database.type }}
- name: DATABASE_URL
{{- if .Values.database.existingSecret }}
valueFrom:
Expand Down
6 changes: 5 additions & 1 deletion charts/vaultwarden/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ database:
existingSecret: ""
## @param database.existingSecretKey Key in the existing secret
##
existingSecretKey: ""
existingSecretKey: null
existingSecretUserKey: username
existingSecretPasswordKey: password
# existingSecretKey: uri

## @param database.connectionRetries Number of times to retry the database connection during startup, with 1 second delay between each retry, set to 0 to retry indefinitely.
##
connectionRetries: 15
Expand Down

0 comments on commit 9f55635

Please sign in to comment.