diff --git a/ozgcloud-elasticsearch-operator/src/main/helm/templates/configmap_bindings_type.yaml b/ozgcloud-elasticsearch-operator/src/main/helm/templates/configmap_bindings_type.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d2ec843e542a4c8f2f215d9bd9d222522122bc44 --- /dev/null +++ b/ozgcloud-elasticsearch-operator/src/main/helm/templates/configmap_bindings_type.yaml @@ -0,0 +1,32 @@ +# +# Copyright (C) 2023 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +apiVersion: v1 +kind: ConfigMap +metadata: + name: bindings-type + namespace: {{ .Release.Namespace }} +data: + type: | + ca-certificates \ No newline at end of file diff --git a/ozgcloud-elasticsearch-operator/src/main/helm/templates/deployment.yaml b/ozgcloud-elasticsearch-operator/src/main/helm/templates/deployment.yaml index 339d684580655a6c15fbc96be080e1821d6daab8..b2c1e684a330866b9a1825f0718871525c9417d9 100644 --- a/ozgcloud-elasticsearch-operator/src/main/helm/templates/deployment.yaml +++ b/ozgcloud-elasticsearch-operator/src/main/helm/templates/deployment.yaml @@ -52,6 +52,8 @@ spec: {{- with (.Values.env).customList }} {{ toYaml . | indent 8 }} {{- end }} + - name: SERVICE_BINDING_ROOT + value: "/bindings" imagePullPolicy: Always readinessProbe: failureThreshold: 3 @@ -86,11 +88,18 @@ spec: terminationMessagePolicy: File tty: true volumeMounts: + - name: bindings + mountPath: "/bindings/ca-certificates/type" + subPath: type + readOnly: true - name: elasticsearch-certificate mountPath: "/bindings/ca-certificates/elasticsearch-certificate.pem" subPath: ca.crt readOnly: true volumes: + - name: bindings + configMap: + name: bindings-type - name: elasticsearch-certificate secret: secretName: elasticsearch-certificate diff --git a/ozgcloud-elasticsearch-operator/src/test/helm/configmap_bindings_type_test.yaml b/ozgcloud-elasticsearch-operator/src/test/helm/configmap_bindings_type_test.yaml new file mode 100644 index 0000000000000000000000000000000000000000..83ece1c08bd44bc06afaa631215dcf699fd33239 --- /dev/null +++ b/ozgcloud-elasticsearch-operator/src/test/helm/configmap_bindings_type_test.yaml @@ -0,0 +1,45 @@ +# +# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den +# Ministerpräsidenten des Landes Schleswig-Holstein +# Staatskanzlei +# Abteilung Digitalisierung und zentrales IT-Management der Landesregierung +# +# Lizenziert unter der EUPL, Version 1.2 oder - sobald +# diese von der Europäischen Kommission genehmigt wurden - +# Folgeversionen der EUPL ("Lizenz"); +# Sie dürfen dieses Werk ausschließlich gemäß +# dieser Lizenz nutzen. +# Eine Kopie der Lizenz finden Sie hier: +# +# https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12 +# +# Sofern nicht durch anwendbare Rechtsvorschriften +# gefordert oder in schriftlicher Form vereinbart, wird +# die unter der Lizenz verbreitete Software "so wie sie +# ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN - +# ausdrücklich oder stillschweigend - verbreitet. +# Die sprachspezifischen Genehmigungen und Beschränkungen +# unter der Lizenz sind dem Lizenztext zu entnehmen. +# + +suite: Certificate ConfigMap Binding +release: + namespace: sh-helm-test +templates: + - templates/configmap_bindings_type.yaml +tests: + - it: validate configMap values + asserts: + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: bindings-type + - equal: + path: metadata.namespace + value: sh-helm-test + - equal: + path: data + value: + type: | + ca-certificates \ No newline at end of file diff --git a/ozgcloud-elasticsearch-operator/src/test/helm/deployment_volumes.yaml b/ozgcloud-elasticsearch-operator/src/test/helm/deployment_volumes.yaml index 4598337f332c7e75954fcdaa4b225b39fa527b3d..b5051b24cb4510dab7488a6e2a8b570827b34cc7 100644 --- a/ozgcloud-elasticsearch-operator/src/test/helm/deployment_volumes.yaml +++ b/ozgcloud-elasticsearch-operator/src/test/helm/deployment_volumes.yaml @@ -29,25 +29,58 @@ release: templates: - deployment.yaml tests: - - it: validate template type and api Version + - it: should create SERVICE_BINDING_ROOT set: image: name: hase tag: latest imagePullSecret: imagePullSecret asserts: - - equal: + - contains: + path: spec.template.spec.containers[0].env + content: + name: SERVICE_BINDING_ROOT + value: "/bindings" + + - it: should create volumes + set: + image: + name: hase + tag: latest + imagePullSecret: imagePullSecret + asserts: + - contains: + path: spec.template.spec.volumes + content: + name: bindings + configMap: + name: bindings-type + - contains: path: spec.template.spec.volumes - value: - - name: elasticsearch-certificate + content: + name: elasticsearch-certificate secret: secretName: elasticsearch-certificate optional: false - - equal: + - it: should create volumeMounts + set: + image: + name: hase + tag: latest + imagePullSecret: imagePullSecret + asserts: + - contains: + path: spec.template.spec.containers[0].volumeMounts + content: + name: bindings + mountPath: "/bindings/ca-certificates/type" + subPath: type + readOnly: true + - contains: path: spec.template.spec.containers[0].volumeMounts - value: - - name: elasticsearch-certificate + content: + name: elasticsearch-certificate mountPath: "/bindings/ca-certificates/elasticsearch-certificate.pem" subPath: ca.crt readOnly: true \ No newline at end of file diff --git a/ozgcloud-elasticsearch-operator/src/test/helm/linter_values.yaml b/ozgcloud-elasticsearch-operator/src/test/helm/linter_values.yaml index 26396d4dabc581060d0e9396ef07233f7576f6cb..aab55aca7ad1c21dbc0730aa82a28e0b3d8d872b 100644 --- a/ozgcloud-elasticsearch-operator/src/test/helm/linter_values.yaml +++ b/ozgcloud-elasticsearch-operator/src/test/helm/linter_values.yaml @@ -3,4 +3,9 @@ image: name: test tag: latest -imagePullSecret: "docker-secret" \ No newline at end of file +imagePullSecret: "docker-secret" + +env: + customList: + - name: my_test_environment_name + value: "A test value" \ No newline at end of file