diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 0915f0f2372d26b4dab57e0c2aa3a25dae0b6b08..e0ff7ea44b451f802f623ad7b1f1e3cd47f829ce 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -42,11 +42,6 @@ app.kubernetes.io/name: {{ .Release.Name }} app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} -{{- define "app.imagePullSecret" }} -{{- with .Values.imageCredentials }} -{{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }} -{{- end }} -{{- end }} {{- define "app.envSpringProfiles" }} {{- if (.Values.env).overrideSpringProfiles -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index 700bdd9fb705ff655998f12c23c3af4dfb1cde54..89c0a9277df86d7042b64ea75e4c2213e8a21331 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -156,11 +156,7 @@ spec: dnsConfig: {} dnsPolicy: ClusterFirst imagePullSecrets: - {{- if .Values.imagePullSecret }} - - name: {{ .Values.imagePullSecret }} - {{ else }} - - name: {{ .Release.Name }}-image-pull-secret - {{- end }} + - name: {{ required "imagePullSecret must be set" .Values.imagePullSecret }} restartPolicy: Always {{- with .Values.hostAliases }} hostAliases: diff --git a/src/main/helm/templates/image_pull_secret.yaml b/src/main/helm/templates/image_pull_secret.yaml deleted file mode 100644 index 327b37f8b27d39d926ae1a67d6ef35701b9852e8..0000000000000000000000000000000000000000 --- a/src/main/helm/templates/image_pull_secret.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# -# 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. -# - -{{- if not (.Values.imagePullSecret) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ .Release.Name }}-image-pull-secret - namespace: {{ include "app.namespace" . }} -type: kubernetes.io/dockerconfigjson -data: - .dockerconfigjson: {{ include "app.imagePullSecret" . }} -{{- end }} \ No newline at end of file diff --git a/src/test/helm-linter-values.yaml b/src/test/helm-linter-values.yaml index dc7bf7d67561d23925b5ebd3cbac9a491af1ffc8..42eb0483702aedeef01c2dd6a7430108adfa3560 100644 --- a/src/test/helm-linter-values.yaml +++ b/src/test/helm-linter-values.yaml @@ -28,4 +28,6 @@ ozgcloud: bundesland: sh networkPolicy: - dnsServerNamespace: test-dns-server-namespace \ No newline at end of file + dnsServerNamespace: test-dns-server-namespace + +imagePullSecret: image-pull-secret \ No newline at end of file diff --git a/src/test/helm/deployment_63_chars_test.yaml b/src/test/helm/deployment_63_chars_test.yaml index 1e63b47eed93c5e640879e17856231ee1606eaee..62c2f8e3ca43e56adea5171322c914b79f892698 100644 --- a/src/test/helm/deployment_63_chars_test.yaml +++ b/src/test/helm/deployment_63_chars_test.yaml @@ -31,6 +31,7 @@ chart: name: eingang-manager set: ozgcloud.environment: test + imagePullSecret: image-pull-secret templates: - templates/deployment.yaml diff --git a/src/test/helm/deployment_bindings_test.yaml b/src/test/helm/deployment_bindings_test.yaml index 9b3f68067786e6cdcb5a77c4dd07fced16581305..6e48055b01e611b36369c432835f085bebc69b3c 100644 --- a/src/test/helm/deployment_bindings_test.yaml +++ b/src/test/helm/deployment_bindings_test.yaml @@ -27,6 +27,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: should have temp-dir volume asserts: diff --git a/src/test/helm/deployment_container_security_context_test.yaml b/src/test/helm/deployment_container_security_context_test.yaml index 3250ce7f12ec9288e00a4507d262e5dec281b2c6..0613312047954222164d9e3290025f0873d95086 100644 --- a/src/test/helm/deployment_container_security_context_test.yaml +++ b/src/test/helm/deployment_container_security_context_test.yaml @@ -30,6 +30,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: check default values asserts: diff --git a/src/test/helm/deployment_defaults_containers_health_test.yaml b/src/test/helm/deployment_defaults_containers_health_test.yaml index e57dbb709e5f53a16e359ad087ad54b3b76c7ee0..c6e30a3a92cda6fdb3ad6c7ec29c41dea5e19139 100644 --- a/src/test/helm/deployment_defaults_containers_health_test.yaml +++ b/src/test/helm/deployment_defaults_containers_health_test.yaml @@ -30,8 +30,9 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - - it: should work + - it: should have correct health check values asserts: - equal: path: spec.template.spec.containers[0].readinessProbe.failureThreshold diff --git a/src/test/helm/deployment_defaults_labels_test.yaml b/src/test/helm/deployment_defaults_labels_test.yaml index 40b95f730d7374bfb883627158d46539a7b8f331..4e2d5f7fd51431f4d91582e5cc50dd5d8ba1d837 100644 --- a/src/test/helm/deployment_defaults_labels_test.yaml +++ b/src/test/helm/deployment_defaults_labels_test.yaml @@ -31,6 +31,7 @@ templates: set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: check default labels asserts: diff --git a/src/test/helm/deployment_defaults_spec_containers_test.yaml b/src/test/helm/deployment_defaults_spec_containers_test.yaml index b1c50d97bc2f4a610a019b4aba78583c4f539e3a..947c086f31e1b3a064cbe3577123c4e087577669 100644 --- a/src/test/helm/deployment_defaults_spec_containers_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_test.yaml @@ -30,6 +30,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: check for some standard values asserts: diff --git a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml index e3dc009148768a93033c54bdef67aaba9cce6a25..9364e4502d8d63cc0968b5590212fec3591c7f84 100644 --- a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml +++ b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml @@ -30,6 +30,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: check default values asserts: diff --git a/src/test/helm/deployment_env_customList_test.yaml b/src/test/helm/deployment_env_customList_test.yaml index 9cd1d4c7a3e88b1adff6fdef133401ff574d402b..16022898f61af3474411ceff275c470d1feed81a 100644 --- a/src/test/helm/deployment_env_customList_test.yaml +++ b/src/test/helm/deployment_env_customList_test.yaml @@ -27,6 +27,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: check customList set: diff --git a/src/test/helm/deployment_host_aliases_test.yaml b/src/test/helm/deployment_host_aliases_test.yaml index 5bd226ad13c2cade607f3981f15b3f7ab3bee237..4ba73fa7df272156fb3597522bcdf478abd88d1f 100644 --- a/src/test/helm/deployment_host_aliases_test.yaml +++ b/src/test/helm/deployment_host_aliases_test.yaml @@ -31,6 +31,7 @@ templates: set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: should not set hostAliases asserts: diff --git a/src/test/helm/deployment_imagepull_secret_test.yaml b/src/test/helm/deployment_imagepull_secret_test.yaml index a3d33d7b83fe18722eec192d2b05f38e0beb4746..eb15225e4c522e445b55a64820eafa03b98022aa 100644 --- a/src/test/helm/deployment_imagepull_secret_test.yaml +++ b/src/test/helm/deployment_imagepull_secret_test.yaml @@ -31,15 +31,14 @@ templates: set: ozgcloud.environment: test tests: - - it: should use default imagePull secret - asserts: - - equal: - path: spec.template.spec.imagePullSecrets[0].name - value: afm-adapter-image-pull-secret - it: should set the imagePull secret set: imagePullSecret: image-pull-secret asserts: - equal: path: spec.template.spec.imagePullSecrets[0].name - value: image-pull-secret \ No newline at end of file + value: image-pull-secret + - it: should fail tempalte when not set + asserts: + - failedTemplate: + errorMessage: imagePullSecret must be set \ No newline at end of file diff --git a/src/test/helm/deployment_liveness_probe_test.yaml b/src/test/helm/deployment_liveness_probe_test.yaml index 7771c84c7ee31a7b939efc94c70f7ad33feacdea..944984fb52cf4b6fbefa346eb1fcfcf065c1a581 100644 --- a/src/test/helm/deployment_liveness_probe_test.yaml +++ b/src/test/helm/deployment_liveness_probe_test.yaml @@ -27,6 +27,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: livenessProbe should be disabled by default asserts: diff --git a/src/test/helm/deployment_pod_default_spec_values_test.yaml b/src/test/helm/deployment_pod_default_spec_values_test.yaml index 4a7c853c20d61fd9ac05d76603341e6d217abf2f..ed1df2ad69fe488678b6778fc7143b9879db902a 100644 --- a/src/test/helm/deployment_pod_default_spec_values_test.yaml +++ b/src/test/helm/deployment_pod_default_spec_values_test.yaml @@ -30,6 +30,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: should have correct pod template values asserts: diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index e31b3ebd682db18fad2b9d9a35bb32d5f058f87a..6404c0c9b9549733ce89f1b3a73e5384b692c702 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -29,6 +29,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: test resources set: diff --git a/src/test/helm/deployment_routing_strategy_env.yaml b/src/test/helm/deployment_routing_strategy_env.yaml index 39e5dac3a74068a253ca702ea8947ed04e875ae8..dc9ae515b3ad4c3c4ae977d4700736ff1f6633dc 100644 --- a/src/test/helm/deployment_routing_strategy_env.yaml +++ b/src/test/helm/deployment_routing_strategy_env.yaml @@ -31,6 +31,7 @@ templates: set: image.tag: latest ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: validate default routing values without questions.yaml asserts: diff --git a/src/test/helm/deployment_service_account_test.yaml b/src/test/helm/deployment_service_account_test.yaml index 1c3b8a40130177ef415443d82574265202f89243..0a5df07ed2cc679e0271998764a6a00ea893dff1 100644 --- a/src/test/helm/deployment_service_account_test.yaml +++ b/src/test/helm/deployment_service_account_test.yaml @@ -31,6 +31,7 @@ templates: set: ozgcloud.environment: test + imagePullSecret: image-pull-secret tests: - it: should use afm-adapter service account name set: diff --git a/src/test/helm/deployment_springProfile_env_test.yaml b/src/test/helm/deployment_springProfile_env_test.yaml index 0b89d1a719fa2618e43b3501ac1340fe1ea13424..001fbf3d2e27589848ca87efb16347a183a2cd34 100644 --- a/src/test/helm/deployment_springProfile_env_test.yaml +++ b/src/test/helm/deployment_springProfile_env_test.yaml @@ -27,7 +27,8 @@ release: name: if-adapter templates: - templates/deployment.yaml - +set: + imagePullSecret: image-pull-secret tests: - it: should override spring profiles set: diff --git a/src/test/helm/deyploment_general_value_and_default_spec_test.yaml b/src/test/helm/deyploment_general_value_and_default_spec_test.yaml index 4f226cdec9df53af0155e38281a670789e31b4e8..0ab50fa23c12c02f58e50dd546c9a8417b40c975 100644 --- a/src/test/helm/deyploment_general_value_and_default_spec_test.yaml +++ b/src/test/helm/deyploment_general_value_and_default_spec_test.yaml @@ -30,7 +30,7 @@ templates: - templates/deployment.yaml set: ozgcloud.environment: test - + imagePullSecret: image-pull-secret tests: - it: should have correct apiVersion asserts: diff --git a/src/test/helm/image_pull_secret_test.yaml b/src/test/helm/image_pull_secret_test.yaml deleted file mode 100644 index 25b62847933e597916fb09120bc51dc0dca1a20b..0000000000000000000000000000000000000000 --- a/src/test/helm/image_pull_secret_test.yaml +++ /dev/null @@ -1,57 +0,0 @@ -# -# 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: test image pull secret -templates: - - templates/image_pull_secret.yaml -release: - name: intelliform-adaptero - namespace: helm-test -tests: - - it: should match basic data - set: - imageCredentials: - registry: docker.ozg-sh.de - username: test - password: test1234 - email: webmaster@ozg-sh.de - asserts: - - containsDocument: - kind: Secret - apiVersion: v1 - - equal: - path: metadata.name - value: intelliform-adaptero-image-pull-secret - - equal: - path: metadata.namespace - value: helm-test - - isNotEmpty: - path: data[".dockerconfigjson"] - - - it: should not create image pull secret - set: - imagePullSecret: "image-pull-secret" - asserts: - - hasDocuments: - count: 0 \ No newline at end of file diff --git a/src/test/helm/deployment_realm_name_length_test.yaml b/src/test/helm/realm_name_length_test.yaml similarity index 100% rename from src/test/helm/deployment_realm_name_length_test.yaml rename to src/test/helm/realm_name_length_test.yaml