From 0340551937aae836716fb9e15fa14edb0a769d05 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Tue, 24 Jan 2023 13:51:39 +0100 Subject: [PATCH] OZG-3276 OZG-3318 rename application-dev -> application-develop; set develop profile on dev environment; set prod profile on non dev environment --- src/main/helm/templates/_helpers.tpl | 8 +++++++ src/main/helm/templates/deployment.yaml | 2 +- src/test/helm/deployment_env_test.yaml | 21 +++++++++++++++---- ...tion-dev.yaml => application-develop.yaml} | 0 4 files changed, 26 insertions(+), 5 deletions(-) rename user-manager-server/src/main/resources/{application-dev.yaml => application-develop.yaml} (100%) diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 3728db3c..49f09f55 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -115,3 +115,11 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- define "app.goofyAddress" -}} {{ printf "https://%s.%s" (include "app.kopBezeichner" .) .Values.baseUrl }} {{- end -}} + +{{- define "app.envProfiles" -}} +{{- if eq (include "app.kopEnvironment" . ) "dev" -}} +{{ printf "develop" }} +{{- else -}} +{{ printf "prod" }} +{{- end -}} +{{- end -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 2e44098c..c44e6e64 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -86,7 +86,7 @@ spec: - name: KOP_KEYCLOAK_SYNC_CRON value: {{ .Values.kop.keycloak.sync.cron }} - name: QUARKUS_PROFILE - value: {{ include "app.kopEnvironment" . }} + value: {{ include "app.envProfiles" . }} {{- with (.Values.env).customList }} {{ toYaml . | indent 8 }} {{- end }} diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index 1a11bc42..7b5f3e21 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -46,13 +46,26 @@ tests: content: name: my_test_environment_name value: "A test value" - - it: should set quarkus profile + + - it: should set profile to "develop" if environment is dev template: deployment.yaml - release: - namespace: sh-helm-dev + set: + kop: + environment: dev + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_PROFILE + value: develop + - it: should set profile to "prod" as default + template: deployment.yaml + set: + kop: + environment: prod asserts: - contains: path: spec.template.spec.containers[0].env content: name: QUARKUS_PROFILE - value: dev \ No newline at end of file + value: prod \ No newline at end of file diff --git a/user-manager-server/src/main/resources/application-dev.yaml b/user-manager-server/src/main/resources/application-develop.yaml similarity index 100% rename from user-manager-server/src/main/resources/application-dev.yaml rename to user-manager-server/src/main/resources/application-develop.yaml -- GitLab