diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c9705af0842c39955504f14169b4d2fcc7732f76..8bdd507e37336746711642093a10ec1990324750 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,9 +48,7 @@ test-helm: - !reference [ .helm, before_script ] - helm plugin install https://github.com/helm-unittest/helm-unittest.git script: - - helm template -f src/test/helm-linter-values.yaml src/main/helm - - helm lint -f src/test/helm-linter-values.yaml src/main/helm - - helm unittest -f '../../test/helm/**/*test.yaml' src/main/helm + - sh run_helm_test.sh verify: stage: test diff --git a/run_helm_test.sh b/run_helm_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..0cd9af6d4cbc3f99d077174612bf3445fa827fbf --- /dev/null +++ b/run_helm_test.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +helm template -f src/test/helm-linter-values.yaml src/main/helm +helm lint -f src/test/helm-linter-values.yaml src/main/helm +helm unittest -f '../../test/helm/**/*test.yaml' src/main/helm \ No newline at end of file diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index f0f5101193ab7ad14d6162ffd6dd026fb61d338c..a1d4ea7f9a2d507be0da40c7af77965e5819b959 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -61,7 +61,10 @@ spec: - env: - name: spring_profiles_active value: {{ include "app.envSpringProfiles" . }} - + - name: server_ssl_key-store + value: /store/keystore.jks + - name: server_ssl_trust-store + value: /store/truststore.jks {{- with include "app.getCustomList" . }} {{ . | indent 10 }} {{- end }} @@ -119,25 +122,16 @@ spec: volumeMounts: - name: temp-dir mountPath: "/tmp" - - name: bindings - mountPath: "/bindings/ca-certificates/type" - subPath: type - readOnly: true - - name: mongodb-root-ca - mountPath: "/bindings/ca-certificates/mongodb-root-ca.pem" - subPath: ca.crt + - name: xta-test-server-tls-store + mountPath: "/store/" readOnly: true volumes: - name: temp-dir emptyDir: {} - - name: bindings - configMap: - name: xta-test-server-bindings-type - - name: mongodb-root-ca + - name: xta-test-server-tls-store secret: - secretName: {{ ((.Values.database).tls).secretName | default "ozg-mongodb-tls-cert" }} - optional: true + secretName: {{ .Release.Name }}-tls-secret dnsConfig: {} dnsPolicy: ClusterFirst {{- with .Values.hostAliases }} diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index b3f06bcd3ee12520788e7d2ec98df2814f9bb9ce..52c9484a7154051acfe08ac3002344b8ed8d6586 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -29,6 +29,39 @@ release: namespace: sh-helm-test tests: + - it: should set spring profiles + set: + ozgcloud: + environment: dev + imagePullSecret: image-pull-secret + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: spring_profiles_active + value: oc, dev + - it: should set keystore + set: + ozgcloud: + environment: dev + imagePullSecret: image-pull-secret + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: server_ssl_key-store + value: /store/keystore.jks + - it: should set truststore + set: + ozgcloud: + environment: dev + imagePullSecret: image-pull-secret + asserts: + - contains: + path: spec.template.spec.containers[0].env + content: + name: server_ssl_trust-store + value: /store/truststore.jks - it: check customList as list set: env.customList: diff --git a/src/test/helm/deployment_volumes_test.yaml b/src/test/helm/deployment_volumes_test.yaml index 9183af63c7e4d3f05b6d399a5ac98f2cc69b0c3c..9f998f3e3bf45ec655f34b421e946525061fce08 100644 --- a/src/test/helm/deployment_volumes_test.yaml +++ b/src/test/helm/deployment_volumes_test.yaml @@ -23,4 +23,22 @@ tests: path: spec.template.spec.volumes content: name: temp-dir - emptyDir: {} \ No newline at end of file + emptyDir: {} + + - it: should have tls store volume + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: xta-test-server-tls-store + secret: + secretName: helm-test-tls-secret + + - it: should have truststore volume mount + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: xta-test-server-tls-store + mountPath: "/store/" + readOnly: true \ No newline at end of file