Skip to content

Commit

Permalink
Make existing secret name customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
xcompass committed Oct 29, 2024
1 parent 524edb4 commit 6af2cc7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion moodle/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: moodle
version: 0.1.11
version: 0.1.12
description: Moodle is a learning platform designed to provide educators, administrators and learners with a single robust, secure and integrated system to create personalised learning environments
keywords:
- moodle
Expand Down
26 changes: 21 additions & 5 deletions moodle/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end -}}
{{- end -}}

{{- define "moodle.db.secretname" -}}
{{- if .Values.db.auth.existingSecret }}
{{- .Values.db.auth.existingSecret -}}
{{- else -}}
{{ include "call-nested" (list . "db" "common.names.fullname") }}
{{- end -}}
{{- end -}}

{{- define "moodle.secretname" -}}
{{- if .Values.moodleExistingSecret }}
{{- .Values.moodleExistingSecret -}}
{{- else -}}
{{ template "moodle.fullname" . }}
{{- end -}}
{{- end -}}

{{- define "common_labels" }}
app: {{ template "moodle.fullname" . }}
stage: {{ .Values.stage }}
Expand Down Expand Up @@ -106,7 +122,7 @@ env:
valueFrom:
secretKeyRef:
{{- if .Values.db.disableExternal }}
name: {{ include "call-nested" (list . "db" "common.names.fullname") }}
name: {{ template "moodle.db.secretname" }}
key: mariadb-password
{{- else }}
name: {{ template "moodle.fullname" . }}
Expand All @@ -125,7 +141,7 @@ env:
- name: MOODLE_ADMIN_PASS
valueFrom:
secretKeyRef:
name: {{ template "moodle.fullname" . }}
name: {{ template "moodle.secretname" . }}
key: moodle_password
- name: MOODLE_ADMIN_EMAIL
value: {{ default "" .Values.moodleEmail | quote }}
Expand All @@ -146,7 +162,7 @@ env:
- name: SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "moodle.fullname" . }}
name: {{ template "moodle.secretname" . }}
key: smtp_password
- name: SMTP_PROTOCOL
value: {{ default "" .Values.smtpProtocol | quote }}
Expand All @@ -166,7 +182,7 @@ env:
valueFrom:
secretKeyRef:
{{- if .Values.db.disableExternal }}
name: {{ include "call-nested" (list . "db" "common.names.fullname") }}
name: {{ template "moodle.db.secretname" }}
key: mariadb-password
{{- else }}
name: {{ template "moodle.fullname" . }}
Expand Down Expand Up @@ -252,7 +268,7 @@ env:
valueFrom:
secretKeyRef:
{{- if .Values.db.disableExternal }}
name: {{ include "call-nested" (list . "db" "common.names.fullname") }}
name: {{ template "moodle.db.secretname" }}
key: mariadb-password
{{- else }}
name: {{ template "moodle.fullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion moodle/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
valueFrom:
secretKeyRef:
{{- if .Values.db.disableExternal }}
name: {{ include "call-nested" (list . "db" "common.names.fullname") }}
name: {{ template "moodle.db.secretname" }}
key: mariadb-password
{{- else }}
name: {{ template "moodle.fullname" . }}
Expand Down
2 changes: 1 addition & 1 deletion moodle/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ spec:
valueFrom:
secretKeyRef:
{{- if .Values.db.disableExternal }}
name: {{ include "call-nested" (list . "db" "common.names.fullname") }}
name: {{ template "moodle.db.secretname" }}
key: mariadb-password
{{- else }}
name: {{ template "moodle.fullname" . }}
Expand Down
1 change: 1 addition & 0 deletions moodle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ db:
# password: &dbPass
# replicationUser: replicator
# replicationPassword:
# existingSecret:

## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
Expand Down

0 comments on commit 6af2cc7

Please sign in to comment.