Skip to content

Commit

Permalink
Update tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
amanpruthi committed Sep 23, 2024
1 parent 08a75d8 commit 3009718
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spec:
valueFrom:
secretKeyRef:
name: {{ include "wandb.mysql.passwordSecret" . }}
key: {{ if .Values.global.mysql.passwordSecret.key }}{{ .Values.global.mysql.passwordSecret.key }}{{ else }}MYSQL_ROOT_PASSWORD{{ end }}
key: {{ if .Values.global.mysql.passwordSecret.rootKey }}{{ .Values.global.mysql.passwordSecret.rootKey }}{{ else }}MYSQL_ROOT_PASSWORD{{ end }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
Expand Down
20 changes: 16 additions & 4 deletions charts/operator-wandb/templates/_mysql.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{/*
Return name of the secret where information is stored, considering if the custom secret is defined
Return the name of the secret where information is stored, considering if the custom secret is defined
*/}}
{{- define "wandb.mysql.passwordSecret" -}}
{{- if .Values.global.mysql.passwordSecret.name }}
Expand All @@ -10,16 +10,28 @@ Return name of the secret where information is stored, considering if the custom
{{- end -}}

{{/*
Return key of the secret where information is stored, considering if the custom key is defined
Return the key of the secret where the password is stored, considering if the custom key is defined
*/}}
{{- define "wandb.mysql.passwordSecret.key" -}}
{{- if .Values.global.mysql.passwordSecret.key }}
{{- .Values.global.mysql.passwordSecret.key -}}
{{- if .Values.global.mysql.passwordSecret.userKey }}
{{- .Values.global.mysql.passwordSecret.userKey -}}
{{- else }}
MYSQL_PASSWORD
{{- end -}}
{{- end -}}

{{/*
Return the key of the secret where the root password is stored, considering if the custom root key is defined
*/}}
{{- define "wandb.mysql.passwordSecret.rootKey" -}}
{{- if .Values.global.mysql.passwordSecret.rootKey }}
{{- .Values.global.mysql.passwordSecret.rootKey -}}
{{- else }}
MYSQL_ROOT_PASSWORD
{{- end -}}
{{- end -}}


{{/*
Return the db port
*/}}
Expand Down
2 changes: 1 addition & 1 deletion charts/operator-wandb/templates/mysql.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if and .Values.global.mysql.passwordSecret (or (not .Values.global.mysql.passwordSecret.name) (not .Values.global.mysql.passwordSecret.key)) }}
{{- if or (not .Values.global.mysql.passwordSecret.name) (eq .Values.global.mysql.passwordSecret.name "") }}
{{- $secretName := (include "wandb.mysql.passwordSecret" .) }}
{{- $secret := (lookup "v1" "Secret" .Release.Namespace $secretName) }}
apiVersion: v1
Expand Down
3 changes: 2 additions & 1 deletion charts/operator-wandb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ global:
password: ""
passwordSecret:
name: ""
key: ""
rootKey: "MYSQL_ROOT_PASSWORD"
userKey: "MYSQL_PASSWORD"

slack:
secret: ""
Expand Down

0 comments on commit 3009718

Please sign in to comment.