diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index 95cbd1ab2dc40644d5831806da452e5992c99085..91bca425a065c5c3520d636515a2e2babd07892c 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -22,12 +22,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.nameToIdentifier" -}} {{- trimAll "-" ( regexReplaceAll "[^a-zA-Z0-9-]" (lower .) "" ) | trunc 20 }} {{- end -}} diff --git a/src/main/helm/templates/deployment.yaml b/src/main/helm/templates/deployment.yaml index dfbadbc7c4591bb2d064d5b580be401e598c524e..7d1d4762d2b94225e5bc46503dce5dd6c85449bd 100644 --- a/src/main/helm/templates/deployment.yaml +++ b/src/main/helm/templates/deployment.yaml @@ -145,7 +145,7 @@ spec: dnsConfig: {} dnsPolicy: ClusterFirst imagePullSecrets: - - name: {{ .Values.imagePullSecret | default "administration-image-pull-secret" }} + - name: {{ required "image-pull-secret must be set" .Values.imagePullSecret }} restartPolicy: Always schedulerName: default-scheduler securityContext: {} diff --git a/src/test/helm-linter-values.yaml b/src/test/helm-linter-values.yaml index b58fe6625dc73d30769fb4ad0f4b397850ad07ab..35b73c5d7532c489c04350074a6b6476b4f5fb20 100644 --- a/src/test/helm-linter-values.yaml +++ b/src/test/helm-linter-values.yaml @@ -45,3 +45,4 @@ sso: client_roles: - ROLE_DUMMY +imagePullSecret: image-pull-secret \ No newline at end of file diff --git a/src/test/helm/deployment_database_test.yaml b/src/test/helm/deployment_database_test.yaml index 8c747b650b4925c6026325d50f46de3ee42e6c73..b007ea3eeb6b8706cfd491d9fc1911ec73172085 100644 --- a/src/test/helm/deployment_database_test.yaml +++ b/src/test/helm/deployment_database_test.yaml @@ -34,6 +34,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: should have a volume for the mongodb certificate asserts: diff --git a/src/test/helm/deployment_defaults_labels_test.yaml b/src/test/helm/deployment_defaults_labels_test.yaml index b01cb297e470542fe1c8603c5eb4826776c78cd7..c3902cfc31ebc5a5b6d6defb1b0d00fb81109e92 100644 --- a/src/test/helm/deployment_defaults_labels_test.yaml +++ b/src/test/helm/deployment_defaults_labels_test.yaml @@ -34,7 +34,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local - + imagePullSecret: image-pull-secret tests: - it: check metadata.labels asserts: diff --git a/src/test/helm/deployment_defaults_sso_test.yaml b/src/test/helm/deployment_defaults_sso_test.yaml index 907a5923d7abfc578daa3fe7f424cb8ca402e6b9..78662094e4975ac35654b72fc08eb58910e50352 100644 --- a/src/test/helm/deployment_defaults_sso_test.yaml +++ b/src/test/helm/deployment_defaults_sso_test.yaml @@ -36,6 +36,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: check default values asserts: diff --git a/src/test/helm/deployment_image_pull_secret_test.yaml b/src/test/helm/deployment_image_pull_secret_test.yaml index 44f285aa845dddef22c11220bef7714efdc1f9ae..db2d17c30347bce02436ed2bde8bb1ae05fc3c5c 100644 --- a/src/test/helm/deployment_image_pull_secret_test.yaml +++ b/src/test/helm/deployment_image_pull_secret_test.yaml @@ -34,17 +34,15 @@ set: sso: serverUrl: https://sso.company.local tests: - - it: should use default image pull secret - asserts: - - contains: - path: spec.template.spec.imagePullSecrets - content: - name: administration-image-pull-secret - - it: should use customizable image pull secret + - it: should set image pull secret set: - imagePullSecret: custom-image-pull-secret + imagePullSecret: image-pull-secret asserts: - contains: path: spec.template.spec.imagePullSecrets content: - name: custom-image-pull-secret + name: image-pull-secret + - it: should fail template when image pull secret not set + asserts: + - failedTemplate: + errormessage: image-pull-secret must be set diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index 888f63ff2751f0b9b4e0fa731cd840ebd200f234..f6cb1d4b19c1220b97855a982e490dbe2a25b4fa 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -33,6 +33,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: should have customizable resources set: diff --git a/src/test/helm/deployment_spring_profile_test.yaml b/src/test/helm/deployment_spring_profile_test.yaml index 1a9326cb74e56a9bb55aa6049f40f02f3aeddb75..f22f7ac58b3bd91b8a84f9f7e907c8f1158b32d7 100644 --- a/src/test/helm/deployment_spring_profile_test.yaml +++ b/src/test/helm/deployment_spring_profile_test.yaml @@ -34,6 +34,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: should override the spring profiles set: diff --git a/src/test/helm/deployment_test.yaml b/src/test/helm/deployment_test.yaml index 5d6ec1cf5e89b6cdad40cfdaed15fc1b1186834a..38931a0d5485af39aced9954e331e65dc17db869 100644 --- a/src/test/helm/deployment_test.yaml +++ b/src/test/helm/deployment_test.yaml @@ -34,6 +34,7 @@ set: bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: should have metadata values asserts: @@ -96,9 +97,6 @@ tests: - equal: path: spec.template.spec.dnsPolicy value: "ClusterFirst" - - equal: - path: spec.template.spec.imagePullSecrets[0].name - value: "administration-image-pull-secret" - equal: path: spec.template.spec.restartPolicy value: "Always" diff --git a/src/test/helm/deployment_volume_test.yaml b/src/test/helm/deployment_volume_test.yaml index 6546763a8b9a03d0ce9fc964a503fe6fbb847092..0cdf8aeaaf60901ac3e85b04d334b5bf04ef1d57 100644 --- a/src/test/helm/deployment_volume_test.yaml +++ b/src/test/helm/deployment_volume_test.yaml @@ -28,13 +28,13 @@ release: templates: - templates/deployment.yaml set: - Release.Name: "administration" ozgcloud: environment: "default" bundesland: sh bezeichner: helm sso: serverUrl: https://sso.company.local + imagePullSecret: image-pull-secret tests: - it: should have volumeMounts on it's container asserts: