From 4ffec807dc510bbf2df670b1e5fcf56607374c93 Mon Sep 17 00:00:00 2001 From: Carlos Roberto Marques Junior Date: Wed, 4 Dec 2019 10:42:57 -0300 Subject: [PATCH] [stable/redmine] Add option to use existingSecret for external db (#19007) * [stable/redmine] option use existingSecret for external db Signed-off-by: Carlos Roberto Marques Junior * bumping version Signed-off-by: Carlos Roberto Marques Junior * [stable/redmine] option to use externalDatabase from existingSecret Signed-off-by: Carlos Roberto Marques Junior * removing old info Signed-off-by: Carlos Roberto Marques Junior * [redmine/stable] using correct secret key Signed-off-by: Carlos Roberto Marques Junior * [stable/redmine] better handling of externalDatabase.password Signed-off-by: Carlos Roberto Marques Junior * [stable/redmine] bumping version Signed-off-by: Carlos Roberto Marques Junior --- stable/redmine/Chart.yaml | 2 +- stable/redmine/README.md | 3 ++- stable/redmine/templates/deployment.yaml | 4 ++-- stable/redmine/templates/externaldb-secrets.yaml | 15 --------------- stable/redmine/templates/secrets.yaml | 15 +++++++++++---- stable/redmine/values.yaml | 3 ++- 6 files changed, 18 insertions(+), 24 deletions(-) delete mode 100644 stable/redmine/templates/externaldb-secrets.yaml diff --git a/stable/redmine/Chart.yaml b/stable/redmine/Chart.yaml index d962c48745..8497efa142 100644 --- a/stable/redmine/Chart.yaml +++ b/stable/redmine/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: redmine -version: 13.6.0 +version: 13.7.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 25f9378f4d..da47c0ee62 100644 --- a/stable/redmine/README.md +++ b/stable/redmine/README.md @@ -79,7 +79,8 @@ 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` | +| `existingSecret` | Use existing secret for password details (`redminePassword`, `smtpPassword` and `externalDatabase.password` will be ignored and picked up from this secret). It must contain the keys `redmine-password` and `smtp-password` when `postgresql.enabled=true` or `mariadb.enabled=true`. In case `postgresql.enabled=false` and `mariadb.enabled=false` it must contain the key `external-db-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` | diff --git a/stable/redmine/templates/deployment.yaml b/stable/redmine/templates/deployment.yaml index 15318f7eee..fe397fde39 100644 --- a/stable/redmine/templates/deployment.yaml +++ b/stable/redmine/templates/deployment.yaml @@ -89,8 +89,8 @@ spec: - name: REDMINE_DB_PASSWORD valueFrom: secretKeyRef: - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password + name: {{ template "redmine.secretName" . }} + key: external-db-password - name: REDMINE_DB_PORT_NUMBER value: {{ .Values.externalDatabase.port | quote }} {{- end }} diff --git a/stable/redmine/templates/externaldb-secrets.yaml b/stable/redmine/templates/externaldb-secrets.yaml deleted file mode 100644 index 8b8aa9f5b2..0000000000 --- a/stable/redmine/templates/externaldb-secrets.yaml +++ /dev/null @@ -1,15 +0,0 @@ -{{- if or (and .Values.databaseType.mariadb (not .Values.mariadb.enabled)) (and .Values.databaseType.postgresql (not .Values.postgresql.enabled)) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - labels: - app: {{ printf "%s-%s" .Release.Name "externaldb" }} - chart: "{{ template "redmine.chart" . }}" - release: {{ .Release.Name | quote }} - heritage: {{ .Release.Service | quote }} -type: Opaque -data: - db-admin-user: {{ .Values.externalDatabase.user | b64enc | quote }} - db-password: {{ .Values.externalDatabase.password | b64enc | quote }} -{{- end }} diff --git a/stable/redmine/templates/secrets.yaml b/stable/redmine/templates/secrets.yaml index c1016b3a47..38252b4272 100644 --- a/stable/redmine/templates/secrets.yaml +++ b/stable/redmine/templates/secrets.yaml @@ -10,10 +10,17 @@ metadata: heritage: "{{ .Release.Service }}" type: Opaque data: - {{ if .Values.redminePassword }} + {{- if .Values.redminePassword }} redmine-password: {{ default "" .Values.redminePassword | b64enc | quote }} - {{ else }} + {{- else }} redmine-password: {{ randAlphaNum 10 | b64enc | quote }} - {{ end }} + {{- end }} smtp-password: {{ default "" .Values.smtpPassword | b64enc | quote }} -{{- end }} \ No newline at end of file + {{- if or (and .Values.databaseType.mariadb (not .Values.mariadb.enabled)) (and .Values.databaseType.postgresql (not .Values.postgresql.enabled)) }} + {{- if .Values.externalDatabase.password }} + external-db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} + {{- else }} + external-db-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + {{- end }} +{{- end }} diff --git a/stable/redmine/values.yaml b/stable/redmine/values.yaml index ecd23360d0..0f9870e235 100644 --- a/stable/redmine/values.yaml +++ b/stable/redmine/values.yaml @@ -65,7 +65,8 @@ redmineLanguage: en # smtpPassword: # smtpTls: -# # Use existing secret (ignores redminePassword and smtpPassword) with keys "redmine-password" and "smtp-password" defined +## Use an existing secret with keys "redmine-password", "smtp-password" and "external-db-password" defined. +## This ignores redminePassword, smtpPassword and externalDatabase.password # existingSecret: ## Environment variables, to pass to the entry point