From 5001cb5745b41f51036204f1ad75d35acb2ed46a Mon Sep 17 00:00:00 2001 From: Thuan Vo Date: Wed, 31 May 2023 11:26:59 -0700 Subject: [PATCH] fix(secret): use release name in database secret (#65) Signed-off-by: Thuan Vo (cherry picked from commit e06dfb2b7bc680ccac80066710bcfa3d0e9d6bf1) --- cryostat/templates/_helpers.tpl | 2 +- cryostat/templates/deployment.yaml | 2 +- cryostat/templates/secret.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cryostat/templates/_helpers.tpl b/cryostat/templates/_helpers.tpl index b2847fa7..33c7369a 100644 --- a/cryostat/templates/_helpers.tpl +++ b/cryostat/templates/_helpers.tpl @@ -65,7 +65,7 @@ Create the name of the service account to use Get or generate a default password for credentials database */}} {{- define "cryostat.databasePassword" -}} -{{- $secret := (lookup "v1" "Secret" .Release.Namespace "cryostat-jmx-credentials-db") -}} +{{- $secret := (lookup "v1" "Secret" .Release.Namespace (printf "%s-jmx-credentials-db" .Release.Name)) -}} {{- if $secret -}} {{/* Use current password. Do not regenerate diff --git a/cryostat/templates/deployment.yaml b/cryostat/templates/deployment.yaml index 04c02d31..b9a0e538 100644 --- a/cryostat/templates/deployment.yaml +++ b/cryostat/templates/deployment.yaml @@ -72,7 +72,7 @@ spec: - name: CRYOSTAT_JMX_CREDENTIALS_DB_PASSWORD valueFrom: secretKeyRef: - name: {{ default "cryostat-jmx-credentials-db" .Values.core.databaseSecretName }} + name: {{ default (printf "%s-jmx-credentials-db" .Release.Name) .Values.core.databaseSecretName }} key: CRYOSTAT_JMX_CREDENTIALS_DB_PASSWORD optional: false ports: diff --git a/cryostat/templates/secret.yaml b/cryostat/templates/secret.yaml index 375913a3..5fc98aa9 100644 --- a/cryostat/templates/secret.yaml +++ b/cryostat/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: cryostat-jmx-credentials-db + name: {{ .Release.Name }}-jmx-credentials-db type: Opaque data: CRYOSTAT_JMX_CREDENTIALS_DB_PASSWORD: {{ include "cryostat.databasePassword" . }}