From f29ed36b84c522972fc403e4d624f4d093c2837e Mon Sep 17 00:00:00 2001 From: Sarah Soo Date: Fri, 17 May 2024 11:34:56 +0100 Subject: [PATCH] feat: Ability to specify existing secrets for values in helm existingSecretkeySecret for secretkey, existingAdminCredsSecret for admin_username and admin_password Closes #790 --- charts/planka/Chart.yaml | 2 +- charts/planka/templates/deployment.yaml | 24 ++++++++++++++++++++++-- charts/planka/values.yaml | 10 ++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/charts/planka/Chart.yaml b/charts/planka/Chart.yaml index 8e83e0b7..5ed95c57 100644 --- a/charts/planka/Chart.yaml +++ b/charts/planka/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.35 +version: 0.2.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/planka/templates/deployment.yaml b/charts/planka/templates/deployment.yaml index d2e179fe..60457a64 100644 --- a/charts/planka/templates/deployment.yaml +++ b/charts/planka/templates/deployment.yaml @@ -90,17 +90,37 @@ spec: value: http://localhost:3000 {{- end }} - name: SECRET_KEY + {{- if .Values.existingSecretkeySecret }} + valueFrom: + secretKeyRef: + name: {{ .Values.existingSecretkeySecret }} + key: key + {{- else }} value: {{ required "A secret key needs to be generated using 'openssl rand -hex 64' and assigned to secretkey." .Values.secretkey }} + {{- end }} - name: TRUST_PROXY value: "0" - name: DEFAULT_ADMIN_EMAIL value: {{ .Values.admin_email }} - - name: DEFAULT_ADMIN_PASSWORD - value: {{ .Values.admin_password }} - name: DEFAULT_ADMIN_NAME value: {{ .Values.admin_name }} + {{- if .Values.existingAdminCredsSecret }} + - name: DEFAULT_ADMIN_USERNAME + valueFrom: + secretKeyRef: + name: {{ .Values.existingAdminCredsSecret }} + key: username + - name: DEFAULT_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.existingAdminCredsSecret }} + key: password + {{- else }} - name: DEFAULT_ADMIN_USERNAME value: {{ .Values.admin_username }} + - name: DEFAULT_ADMIN_PASSWORD + value: {{ .Values.admin_password }} + {{- end }} {{ range $k, $v := .Values.env }} - name: {{ $k | quote }} value: {{ $v | quote }} diff --git a/charts/planka/values.yaml b/charts/planka/values.yaml index a6bc393c..b02c8be8 100644 --- a/charts/planka/values.yaml +++ b/charts/planka/values.yaml @@ -17,6 +17,16 @@ fullnameOverride: "" # Generate a secret using openssl rand -base64 45 secretkey: "" +## @param existingSecretkeySecret Name of an existing secret containing the session key string +## NOTE: Must contain key `key` +## NOTE: When it's set, the secretkey parameter is ignored +existingSecretkeySecret: "" + +## @param existingAdminCredsSecret Name of an existing secret containing the admin username and password +## NOTE: Must contain keys `username` and `password` +## NOTE: When it's set, the `admin_username` and `admin_password` parameters are ignored +existingAdminCredsSecret: "" + # Base url for Planka. Will override `ingress.hosts[0].host` # Defaults to `http://localhost:3000` if ingress is disabled. baseUrl: ""