Skip to content

Commit

Permalink
Template the password secret name
Browse files Browse the repository at this point in the history
  • Loading branch information
huw0 committed Nov 18, 2023
1 parent 2fff599 commit b7dfff7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions charts/trino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,16 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "trino.passwordSecret" -}}
{{- if .Values.passwordSecretNameOverride }}
{{- .Values.passwordSecretNameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.passwordSecretNameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}-password-authentication
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}-password-authentication
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
{{- if eq .Values.server.config.authenticationType "PASSWORD" }}
- name: password-volume
secret:
secretName: trino-password-authentication
secretName: {{ template "trino.passwordSecret" . }}
items:
- key: password.db
path: password.db
Expand Down
2 changes: 1 addition & 1 deletion charts/trino/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: trino-password-authentication
name: {{ template "trino.passwordSecret" . }}
labels:
{{- include "trino.labels" . | nindent 4 }}
data:
Expand Down

0 comments on commit b7dfff7

Please sign in to comment.