From 643f6cfe92230252fdc7b6bc0bc51e58e5217c3f Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Wed, 27 Nov 2024 10:14:34 +0100 Subject: [PATCH] OZG-7037 refactor deployment chart to avoid repetition --- src/main/helm/templates/_helpers.tpl | 10 +++++++++- src/main/helm/templates/deployment.yaml | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 435ffac96..f26ef7d19 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -125,7 +125,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- define "app.bayernidAbsenderName" -}} -{{- quote (required "ozgcloud.bayernid.absender.name must be set if ozgcloud.bayernid is enabled" (((.Values.ozgcloud).bayernid).absender).name) -}} +{{- quote (required "ozgcloud.bayernid.absender.name must be set if ozgcloud.bayernid is enabled" (((.Values.ozgcloud).bayernid).absender).name) -}} {{- end -}} {{- define "app.bayernidAbsenderMandant" -}} @@ -166,4 +166,12 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- define "app.getZufiManagerAddress" -}} {{- required "zufiManager.address must be set" (.Values.zufiManager).address -}} +{{- end -}} + +{{- define "app.getKeyStorePath" -}} +{{- printf "/workspace/keystore/xta-keystore.p12" -}} +{{- end -}} + +{{- define "app.getTrustStorePath" -}} +{{- printf "/workspace/truststore/xta-truststore.jks" -}} {{- end -}} \ No newline at end of file diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index fb28dae66..840fdb9d0 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -284,7 +284,7 @@ spec: - name: ozgcloud_xta_clientIdentifiers value: '{{ ((.Values.ozgcloud).xta).clientIdentifiers | toJson }}' - name: ozgcloud_xta_keystore_file - value: "file:/workspace/keystore/xta-keystore.p12" + value: {{ printf "file:%s" (include "app.getKeyStorePath" .) }} - name: ozgcloud_xta_keystore_type valueFrom: secretKeyRef: @@ -299,7 +299,7 @@ spec: optional: false {{- if ((.Values.ozgcloud).xta).truststore }} - name: ozgcloud_xta_truststore_file - value: "file:/workspace/truststore/xta-truststore.jks" + value: {{ printf "file:%s" (include "app.getTrustStorePath" .) }} - name: ozgcloud_xta_truststore_type valueFrom: secretKeyRef: @@ -419,13 +419,13 @@ spec: readOnly: true {{- if ((.Values.ozgcloud).xta).keystore }} - name: xta-keystore - mountPath: "/workspace/keystore/xta-keystore.p12" + mountPath: {{ include "app.getKeyStorePath" . }} subPath: file readOnly: true {{- end }} {{- if ((.Values.ozgcloud).xta).truststore }} - name: xta-truststore - mountPath: "/workspace/truststore/xta-truststore.jks" + mountPath: {{ include "app.getTrustStorePath" . }} subPath: file readOnly: true {{- end }} -- GitLab