From 6390c84c77974177e08a27861c18e054ac93615b Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Mon, 15 Jul 2024 10:49:10 +0200 Subject: [PATCH] ozg-5641 add user authentication --- elster-transfer/templates/deployment.yaml | 18 ++++++++- .../unit-tests/deployment_env_test.yaml | 21 ++++++++++ .../deployment_volume_mount_test.yaml | 40 ++++++++++++++++++- 3 files changed, 77 insertions(+), 2 deletions(-) diff --git a/elster-transfer/templates/deployment.yaml b/elster-transfer/templates/deployment.yaml index 5bb0406..9ebaaa9 100644 --- a/elster-transfer/templates/deployment.yaml +++ b/elster-transfer/templates/deployment.yaml @@ -33,6 +33,14 @@ spec: containers: - image: "{{ .Values.image.repo }}/{{ .Values.image.name }}:{{ .Values.image.tag }}" env: + {{- if (.Values.userAuthentication).enabled }} + - name: ETR_SICHERHEIT_AUTHENTIFIZIERUNG + value: "yaml" + - name: ETR_SICHERHEIT_YAML_CREDENTIALS-FILE-PATH + value: /home/etr/etr-user/users.yaml + - name: ETR_GRUPPENMODUS + value: "gruppen_token" + {{- end }} {{- with include "app.getCustomList" . }} {{ . | indent 8 }} {{- end }} @@ -68,11 +76,19 @@ spec: volumeMounts: - name: etr-home mountPath: "/home/etr" + {{- if (.Values.userAuthentication).enabled }} + - name: etr-user + mountPath: "/home/etr/etr-user" + {{- end }} volumes: - name: etr-home persistentVolumeClaim: claimName: {{ .Release.Name }}-home-pvc - + {{- if (.Values.userAuthentication).enabled }} + - name: etr-user + configMap: + name: etr-user-config + {{- end }} imagePullSecrets: - name: {{ required "imagePullSecret must be set" .Values.imagePullSecret }} restartPolicy: Always diff --git a/elster-transfer/unit-tests/deployment_env_test.yaml b/elster-transfer/unit-tests/deployment_env_test.yaml index 37a67d1..7b0a5e6 100644 --- a/elster-transfer/unit-tests/deployment_env_test.yaml +++ b/elster-transfer/unit-tests/deployment_env_test.yaml @@ -46,3 +46,24 @@ tests: asserts: - isNullOrEmpty: path: spec.template.spec.containers[0].env + + - it: should add etr sicherheit Envs + set: + userAuthentication: + enabled: true + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: ETR_SICHERHEIT_AUTHENTIFIZIERUNG + value: "yaml" + - contains: + path: spec.template.spec.containers[0].env + content: + name: ETR_SICHERHEIT_YAML_CREDENTIALS-FILE-PATH + value: /home/etr/etr-user/users.yaml + - contains: + path: spec.template.spec.containers[0].env + content: + name: ETR_GRUPPENMODUS + value: "gruppen_token" \ No newline at end of file diff --git a/elster-transfer/unit-tests/deployment_volume_mount_test.yaml b/elster-transfer/unit-tests/deployment_volume_mount_test.yaml index 8280582..093e4f6 100644 --- a/elster-transfer/unit-tests/deployment_volume_mount_test.yaml +++ b/elster-transfer/unit-tests/deployment_volume_mount_test.yaml @@ -21,4 +21,42 @@ tests: content: name: etr-home persistentVolumeClaim: - claimName: etr-home-pvc \ No newline at end of file + claimName: etr-home-pvc + + - it: should add etr-user volume mount + set: + userAuthentication: + enabled: true + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: etr-user + mountPath: "/home/etr/etr-user" + - it: should add etr-user volume + set: + userAuthentication: + enabled: true + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: etr-user + configMap: + name: etr-user-config + + - it: should not add etr-user volume mount + asserts: + - notContains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: etr-user + mountPath: "/home/etr/etr-user" + - it: should not add etr-user volume + asserts: + - notContains: + path: spec.template.spec.volumes + content: + name: etr-user + configMap: + name: etr-user-config \ No newline at end of file -- GitLab