From 0ee78865e15af4043543d60193a8672e1711d430 Mon Sep 17 00:00:00 2001 From: Jan Meerkamp Date: Fri, 12 Feb 2021 18:34:55 +0100 Subject: [PATCH 1/3] Helm: Made SecretEnv a secret and added default mongodb name as Wekan --- helm/wekan/Chart.yaml | 2 +- helm/wekan/templates/_helpers.tpl | 2 +- helm/wekan/templates/deployment.yaml | 5 ++++- helm/wekan/templates/secret.yaml | 9 +++++++++ helm/wekan/values.yaml | 2 ++ 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 helm/wekan/templates/secret.yaml diff --git a/helm/wekan/Chart.yaml b/helm/wekan/Chart.yaml index 355f5bf24..b7b508278 100644 --- a/helm/wekan/Chart.yaml +++ b/helm/wekan/Chart.yaml @@ -1,5 +1,5 @@ name: wekan -version: 1.0.2 +version: 1.0.3 apiVersion: v1 description: Open Source kanban home: https://wekan.github.io/ diff --git a/helm/wekan/templates/_helpers.tpl b/helm/wekan/templates/_helpers.tpl index fab37c9d9..5ee1b10e9 100644 --- a/helm/wekan/templates/_helpers.tpl +++ b/helm/wekan/templates/_helpers.tpl @@ -81,7 +81,7 @@ else use user-provided URL. {{- $release := .Release.Name -}} {{- $replicaSetName := (index .Values "mongodb" "replicaSetName") -}} {{- $mongodbSvcName := include "wekan.mongodb.svcname" . -}} -mongodb://{{- range $v := until $count }}{{ $release }}-mongodb-{{ $v }}.{{ $mongodbSvcName }}:27017{{ if ne $v (sub $count 1) }},{{- end -}}{{- end -}}?replicaSet={{ $replicaSetName }} +mongodb://{{- range $v := until $count }}{{ $release }}-mongodb-{{ $v }}.{{ $mongodbSvcName }}:27017{{ if ne $v (sub $count 1) }},{{- end -}}{{- end -}}/{{ .Values.dbname }}?replicaSet={{ $replicaSetName }} {{- else -}} {{- index .Values "mongodb" "url" -}} {{- end -}} diff --git a/helm/wekan/templates/deployment.yaml b/helm/wekan/templates/deployment.yaml index 89b75aa15..c7f192f1e 100644 --- a/helm/wekan/templates/deployment.yaml +++ b/helm/wekan/templates/deployment.yaml @@ -46,7 +46,10 @@ spec: {{- range $key := .Values.secretEnv }} {{- if .value }} - name: {{ .name }} - value: {{ .value | quote }} + valueFrom: + secretKeyRef: + name: {{ template "wekan.fullname" $ }}-secret + key: {{ .name }} {{- end }} {{- end }} livenessProbe: diff --git a/helm/wekan/templates/secret.yaml b/helm/wekan/templates/secret.yaml new file mode 100644 index 000000000..0198782ae --- /dev/null +++ b/helm/wekan/templates/secret.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "wekan.fullname" $ }}-secret +type: Opaque +data: + {{- range $key := .Values.secretEnv }} + {{ $key.name }}: {{ $key.value | b64enc }} + {{- end}} diff --git a/helm/wekan/values.yaml b/helm/wekan/values.yaml index 24e5413cb..a64219dc2 100644 --- a/helm/wekan/values.yaml +++ b/helm/wekan/values.yaml @@ -21,6 +21,7 @@ image: ## replicaCount: 1 +dbname: wekan ## Specify additional environmental variables for the Deployment ## @@ -32,6 +33,7 @@ env: ## Deployment. These can e.g. be provided by a Secret and allow ## to store passwords separately ## +secretname: wekanlocal-secret secretEnv: - name: "" value: "" From d64a61bab9b3a3c8026619325058af66351b0a45 Mon Sep 17 00:00:00 2001 From: Jan Meerkamp Date: Fri, 12 Feb 2021 18:42:05 +0100 Subject: [PATCH 2/3] removed not used var --- helm/wekan/values.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/helm/wekan/values.yaml b/helm/wekan/values.yaml index a64219dc2..0f7bb61b7 100644 --- a/helm/wekan/values.yaml +++ b/helm/wekan/values.yaml @@ -33,7 +33,6 @@ env: ## Deployment. These can e.g. be provided by a Secret and allow ## to store passwords separately ## -secretname: wekanlocal-secret secretEnv: - name: "" value: "" From 79a2921e1d5d39a0f27ef7e2bb7022224644f8f5 Mon Sep 17 00:00:00 2001 From: Jan Meerkamp Date: Fri, 12 Feb 2021 18:54:56 +0100 Subject: [PATCH 3/3] fixed fail when no secretEnv was defined --- helm/wekan/templates/secret.yaml | 2 ++ helm/wekan/values.yaml | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helm/wekan/templates/secret.yaml b/helm/wekan/templates/secret.yaml index 0198782ae..3674692cd 100644 --- a/helm/wekan/templates/secret.yaml +++ b/helm/wekan/templates/secret.yaml @@ -1,3 +1,4 @@ +{{ if .Values.secretEnv }} apiVersion: v1 kind: Secret metadata: @@ -7,3 +8,4 @@ data: {{- range $key := .Values.secretEnv }} {{ $key.name }}: {{ $key.value | b64enc }} {{- end}} +{{ end }} diff --git a/helm/wekan/values.yaml b/helm/wekan/values.yaml index 0f7bb61b7..280289187 100644 --- a/helm/wekan/values.yaml +++ b/helm/wekan/values.yaml @@ -33,9 +33,9 @@ env: ## Deployment. These can e.g. be provided by a Secret and allow ## to store passwords separately ## -secretEnv: - - name: "" - value: "" +secretEnv: {} + # - name: "" + # value: "" service: type: NodePort