From b9a46bc3a43382bdf756bcc5d5e352050717f50d Mon Sep 17 00:00:00 2001 From: Carlos Roberto Marques Junior Date: Thu, 21 Nov 2019 04:29:28 -0300 Subject: [PATCH] [stable/redmine] Add option to use existingSecret for Redmine passwords (#19011) * option to customize securityContext Signed-off-by: Carlos Roberto Marques Junior * new line Signed-off-by: Carlos Roberto Marques Junior * [stable/redmine] adding existingSecret option Signed-off-by: Carlos Roberto Marques Junior --- stable/redmine/Chart.yaml | 2 +- stable/redmine/README.md | 2 ++ stable/redmine/templates/_helpers.tpl | 11 +++++++++++ stable/redmine/templates/deployment.yaml | 8 ++++++-- stable/redmine/templates/secrets.yaml | 2 ++ stable/redmine/values.yaml | 8 ++++++++ 6 files changed, 30 insertions(+), 3 deletions(-) diff --git a/stable/redmine/Chart.yaml b/stable/redmine/Chart.yaml index 141ae7103c..804fab2e88 100644 --- a/stable/redmine/Chart.yaml +++ b/stable/redmine/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: redmine -version: 13.0.1 +version: 13.4.0 appVersion: 4.0.5 description: A flexible project management web application. keywords: diff --git a/stable/redmine/README.md b/stable/redmine/README.md index 50999ee147..bb52d9fa96 100644 --- a/stable/redmine/README.md +++ b/stable/redmine/README.md @@ -79,6 +79,7 @@ The following table lists the configurable parameters of the Redmine chart and t | `smtpUser` | SMTP user | `nil` | | `smtpPassword` | SMTP password | `nil` | | `smtpTls` | Use TLS encryption with SMTP | `nil` | +| `existingSecret` | Use existing secret for password details (`smtpPassword` and `redminePassword` will be ignored and picked up from this secret). The secret has to contain the keys `redmine-password` and `smtp-password`. | `nil` | | `databaseType.postgresql` | Select PostgreSQL as database | `false` | | `databaseType.mariadb` | Select MariaDB as database | `true` | | `mariadb.enabled` | Whether to deploy a MariaDB server to satisfy the applications database requirements | `true` | @@ -122,6 +123,7 @@ The following table lists the configurable parameters of the Redmine chart and t | `podDisruptionBudget.maxUnavailable`| Maximum unavailable pods | `nil` | | `replicas` | The number of pod replicas | `1` | | `resources` | Resources allocation (Requests and Limits) | `{}` | +| `securityContext` | Security Context | `{}` | The above parameters map to the env variables defined in [bitnami/redmine](http://github.com/bitnami/bitnami-docker-redmine). For more information please refer to the [bitnami/redmine](http://github.com/bitnami/bitnami-docker-redmine) image documentation. diff --git a/stable/redmine/templates/_helpers.tpl b/stable/redmine/templates/_helpers.tpl index 9d092bf565..7252ebcc33 100644 --- a/stable/redmine/templates/_helpers.tpl +++ b/stable/redmine/templates/_helpers.tpl @@ -143,3 +143,14 @@ Return the appropriate apiVersion for deployment. {{- print "apps/v1" -}} {{- end -}} {{- end -}} + +{{/* +Return the name of the Secret used to store the passwords +*/}} +{{- define "redmine.secretName" -}} +{{- if .Values.existingSecret -}} +{{ .Values.existingSecret }} +{{- else -}} +{{ template "redmine.fullname" . }} +{{- end -}} +{{- end -}} diff --git a/stable/redmine/templates/deployment.yaml b/stable/redmine/templates/deployment.yaml index f64beda188..2ca0eae92f 100644 --- a/stable/redmine/templates/deployment.yaml +++ b/stable/redmine/templates/deployment.yaml @@ -99,7 +99,7 @@ spec: - name: REDMINE_PASSWORD valueFrom: secretKeyRef: - name: {{ template "redmine.fullname" . }} + name: {{ template "redmine.secretName" . }} key: redmine-password - name: REDMINE_EMAIL value: {{ .Values.redmineEmail | quote }} @@ -121,7 +121,7 @@ spec: - name: SMTP_PASSWORD valueFrom: secretKeyRef: - name: {{ template "redmine.fullname" . }} + name: {{ template "redmine.secretName" . }} key: smtp-password {{- end }} {{- if .Values.smtpTls }} @@ -154,4 +154,8 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- with .Values.securityContext }} + securityContext: +{{ toYaml . | indent 8 }} + {{- end }} {{- end }} diff --git a/stable/redmine/templates/secrets.yaml b/stable/redmine/templates/secrets.yaml index 4624c9df83..c1016b3a47 100644 --- a/stable/redmine/templates/secrets.yaml +++ b/stable/redmine/templates/secrets.yaml @@ -1,3 +1,4 @@ +{{- if (not .Values.existingSecret) -}} apiVersion: v1 kind: Secret metadata: @@ -15,3 +16,4 @@ data: redmine-password: {{ randAlphaNum 10 | b64enc | quote }} {{ end }} smtp-password: {{ default "" .Values.smtpPassword | b64enc | quote }} +{{- end }} \ No newline at end of file diff --git a/stable/redmine/values.yaml b/stable/redmine/values.yaml index 86483628f5..495270caab 100644 --- a/stable/redmine/values.yaml +++ b/stable/redmine/values.yaml @@ -65,6 +65,9 @@ redmineLanguage: en # smtpPassword: # smtpTls: +# # Use existing secret (ignores redminePassword and smtpPassword) with keys "redmine-password" and "smtp-password" defined +# existingSecret: + ## Environment variables, to pass to the entry point ## # extraVars: @@ -297,3 +300,8 @@ resources: {} # limits: # cpu: "2" # memory: "1G" + +## Pod Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ +## +securityContext: {}