From b7dfff744b013726472f03bae2f6c5de8353d25a Mon Sep 17 00:00:00 2001 From: Huw Ayling-Miller Date: Sat, 18 Nov 2023 23:13:59 +0000 Subject: [PATCH] Template the password secret name --- charts/trino/templates/_helpers.tpl | 13 +++++++++++++ charts/trino/templates/deployment-coordinator.yaml | 2 +- charts/trino/templates/secret.yaml | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/trino/templates/_helpers.tpl b/charts/trino/templates/_helpers.tpl index ade06df1..400c6eca 100644 --- a/charts/trino/templates/_helpers.tpl +++ b/charts/trino/templates/_helpers.tpl @@ -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 }} diff --git a/charts/trino/templates/deployment-coordinator.yaml b/charts/trino/templates/deployment-coordinator.yaml index 0941f9c5..8eee813f 100644 --- a/charts/trino/templates/deployment-coordinator.yaml +++ b/charts/trino/templates/deployment-coordinator.yaml @@ -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 diff --git a/charts/trino/templates/secret.yaml b/charts/trino/templates/secret.yaml index 4c072f8c..f6cf1ce9 100644 --- a/charts/trino/templates/secret.yaml +++ b/charts/trino/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: trino-password-authentication + name: {{ template "trino.passwordSecret" . }} labels: {{- include "trino.labels" . | nindent 4 }} data: