diff --git a/src/main/helm/README.md b/src/main/helm/README.md index 4004a3949c29e96b5c8e096e6802a2cc831a42d8..f65cae14aa1fcb10699224b6e67dbd17051bfa5f 100644 --- a/src/main/helm/README.md +++ b/src/main/helm/README.md @@ -8,7 +8,7 @@ Das Helm Chart für das Deployment des UserManager. ## Unit-Tests Für Unit-Tests wird das helm [helm-unittest](https://github.com/quintush/helm-unittest) plugin benötigt. Die Unit-Tests liegen im Verzeichnis src/test/helm -`helm unittest -f '../../test/helm/*.yaml' .` +`helm unittest -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' .` ## SyntaxCheck `helm template --debug -f test-values.yaml .` diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index adc42ad0e4fdb7be88e92414ed61566935d8c37e..e9901580905872c55506338c901d74d97bdf580d 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -105,8 +105,12 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- define "app.ssoServerUrl" -}} +{{- if contains "https://" .Values.sso.serverUrl -}} +{{- .Values.sso.serverUrl -}} +{{- else -}} {{- printf "https://%s" .Values.sso.serverUrl -}} {{- end -}} +{{- end -}} {{- define "app.kopBundesland" -}} {{- required "kop.bundesland must be set " (.Values.kop).bundesland }} diff --git a/src/test/helm/deployment-keycloak-values-test.yaml b/src/test/helm/deployment-keycloak-values-test.yaml index 26516aba97a9df7e4c17de30b2bc6afd2d6fa3df..d08dd042003220ffe520262c15049ba6a4cc2bc4 100644 --- a/src/test/helm/deployment-keycloak-values-test.yaml +++ b/src/test/helm/deployment-keycloak-values-test.yaml @@ -67,4 +67,38 @@ tests: path: spec.template.spec.containers[0].env content: name: KOP_KEYCLOAK_API_CLIENT - value: sh-helm-test-goofy \ No newline at end of file + value: sh-helm-test-goofy + - it: sso.serverurl with https + template: deployment.yaml + release: + namespace: sh-helm-test + set: + sso.serverUrl: https://sso.test.by.kop-cloud.de + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_OIDC_AUTH_SERVER_URL + value: https://sso.test.by.kop-cloud.de/realms/sh-helm-test + - contains: + path: spec.template.spec.containers[0].env + content: + name: KEYCLOAK_URL + value: https://sso.test.by.kop-cloud.de + - it: sso.serverurl without https + template: deployment.yaml + release: + namespace: sh-helm-test + set: + sso.serverUrl: sso.test.by.kop-cloud.de + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: QUARKUS_OIDC_AUTH_SERVER_URL + value: https://sso.test.by.kop-cloud.de/realms/sh-helm-test + - contains: + path: spec.template.spec.containers[0].env + content: + name: KEYCLOAK_URL + value: https://sso.test.by.kop-cloud.de