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

Template the password secret name #109

Merged
merged 2 commits into from
May 30, 2024
Merged
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
32 changes: 24 additions & 8 deletions charts/trino/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ If release name contains chart name it will be used as a full name.
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- if hasPrefix .Release.Name $name }}
{{- $name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
Expand All @@ -36,10 +36,10 @@ Create chart name and version as used by the chart label.
{{- .Values.coordinatorNameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}-coordinator
{{- if hasPrefix .Release.Name $name }}
{{- printf "%s-%s" $name "coordinator" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}-coordinator
{{- printf "%s-%s-%s" .Release.Name $name "coordinator" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
Expand All @@ -49,10 +49,10 @@ Create chart name and version as used by the chart label.
{{- .Values.workerNameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}-worker
{{- if hasPrefix .Release.Name $name }}
{{- printf "%s-%s" $name "worker" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}-worker
{{- printf "%s-%s-%s" .Release.Name $name "worker" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -120,3 +120,19 @@ Code is inspired from bitnami/common
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create the name of the file auth secret to use
*/}}
{{- define "trino.fileAuthSecretName" -}}
{{- if and .Values.auth .Values.auth.passwordAuthSecret }}
{{- .Values.auth.passwordAuthSecret | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if hasPrefix .Release.Name $name }}
{{- printf "%s-%s" $name "file-authentication" | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s-%s" .Release.Name $name "file-authentication" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 1 addition & 5 deletions charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ spec:
{{- if or .Values.auth.passwordAuth .Values.auth.groups }}
- name: file-authentication-volume
secret:
{{- if and .Values.auth .Values.auth.passwordAuthSecret }}
secretName: {{ .Values.auth.passwordAuthSecret }}
{{- else }}
secretName: trino-file-authentication
{{- end }}
secretName: {{ template "trino.fileAuthSecretName" . }}
items:
{{- if .Values.auth.passwordAuth }}
- key: password.db
Expand Down
6 changes: 1 addition & 5 deletions charts/trino/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
{{- if and .Values.auth .Values.auth.passwordAuthSecret }}
name: {{ .Values.auth.passwordAuthSecret }}
{{- else }}
name: trino-file-authentication
{{- end }}
name: {{ template "trino.fileAuthSecretName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "trino.labels" . | nindent 4 }}
Expand Down