diff --git a/run_helm_test.sh b/run_helm_test.sh index 28f3552a66de7d34554495a7a2bc1a1e7a852a2f..4395f394251c1a3a67b84c3fee710763146e55b3 100755 --- a/run_helm_test.sh +++ b/run_helm_test.sh @@ -1,7 +1,8 @@ #!/bin/sh set -e +set -x -helm template ./src/main/helm/ -f src/test/linter-values.yaml -helm lint -f src/test/linter-values.yaml ./src/main/helm/ -cd src/main/helm && helm unittest --helm3 -f '../../test/helm/*.yaml' -v '../../test/unit-values.yaml' . \ No newline at end of file +helm template ./src/main/helm/ -f src/test/helm-linter-values.yaml +helm lint -f src/test/helm-linter-values.yaml ./src/main/helm/ +cd src/main/helm && helm unittest -f '../../test/helm/*.yaml' . \ No newline at end of file diff --git a/src/main/helm/templates/_helpers.tpl b/src/main/helm/templates/_helpers.tpl index de78b3fcf20a2677189f21672768deaf4ca88bc5..5a010852ea720245f2d4d9e2cdfbf1efac34ab1b 100644 --- a/src/main/helm/templates/_helpers.tpl +++ b/src/main/helm/templates/_helpers.tpl @@ -58,11 +58,15 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{ printf "%s.%s:9000" ( coalesce .Values.usermanagerName "user-manager" ) .Release.Namespace }} {{- end -}} +{{- define "app.baseUrlDirect" -}} +{{- required "baseUrl muss angegeben sein" .Values.baseUrl }} +{{- end -}} + {{- define "app.ozgcloud_user-manager_url" -}} {{- if (.Values).usermanagerUrl -}} {{ printf "%s" (.Values).usermanagerUrl }} {{- else -}} -{{ printf "https://%s-%s.%s" (include "app.ozgcloudBezeichner" .) .Values.usermanagerName .Values.baseUrl }} +{{ printf "https://%s-%s.%s" (include "app.ozgcloudBezeichner" .) .Values.usermanagerName (include "app.baseUrlDirect" .) }} {{- end -}} {{- end -}} @@ -77,11 +81,15 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- define "app.ozgcloudBezeichner" -}} +{{- if (.Values.ozgcloud).bezeichner -}} {{ $length := len (.Values.ozgcloud).bezeichner }} -{{- if ge 27 $length -}} +{{- if lt 27 $length -}} +{{ required (printf "Bezeichner %s ist zu lang (max. 27 Zeichen)" (.Values.ozgcloud).bezeichner) nil }} +{{- else -}} {{- required "Bezeichner muss angegeben sein" (.Values.ozgcloud).bezeichner -}} +{{- end -}} {{- else -}} -{{ required (printf "Bezeichner %s ist zu lang (max. 27 Zeichen)" (.Values.ozgcloud).bezeichner) nil }} +{{- required "Bezeichner muss angegeben sein" (.Values.ozgcloud).bezeichner -}} {{- end -}} {{- end -}} @@ -112,7 +120,7 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }} {{- end -}} {{- define "app.ssoServerUrl" -}} -{{- printf "%s" .Values.sso.serverUrl -}} +{{- required "sso.serverUrl muss angegeben sein" (.Values.sso).serverUrl -}} {{- end -}} {{- define "app.baseUrl" -}} diff --git a/src/main/helm/templates/keycloak-client-crd.yaml b/src/main/helm/templates/keycloak-client-crd.yaml index fbcd6e5e36878f5f7e2f50685c9e3e939e6dc021..2a2b9b48e7ed0cc747f9acfcd18c76d555681ca4 100644 --- a/src/main/helm/templates/keycloak-client-crd.yaml +++ b/src/main/helm/templates/keycloak-client-crd.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator -}} -{{ range $client := .Values.sso.keycloak_clients }} +{{ range $client := (.Values.sso).keycloak_clients }} --- {{- if $client.kopOperator }} apiVersion: api.kop-stack.de/v1 diff --git a/src/main/helm/templates/keycloak-crd.yaml b/src/main/helm/templates/keycloak-crd.yaml index 71f21d0ee0d9fb65655dfe9cf8ac7365aa299d3e..d1e686a4a94e15b953f5349bce3301d3adc4a58b 100644 --- a/src/main/helm/templates/keycloak-crd.yaml +++ b/src/main/helm/templates/keycloak-crd.yaml @@ -5,6 +5,6 @@ metadata: name: {{ include "app.namespace" . }}-keycloak namespace: {{ include "app.namespace" . }} spec: - keep_after_delete: {{ .Values.sso.keep_after_delete | default false }} + keep_after_delete: {{ (.Values.sso).keep_after_delete | default false }} displayName: {{ include "app.ssoRealmDisplayName" . }} {{- end -}} \ No newline at end of file diff --git a/src/main/helm/templates/keycloak-group-crd.yaml b/src/main/helm/templates/keycloak-group-crd.yaml index ce871eebb7825f563a6fedc58bbe8a5d345e988f..63900fb3824aea1d83b4728255c2bc99ab3ee919 100644 --- a/src/main/helm/templates/keycloak-group-crd.yaml +++ b/src/main/helm/templates/keycloak-group-crd.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator -}} -{{ range $group := .Values.sso.keycloak_groups }} +{{ range $group := (.Values.sso).keycloak_groups }} --- apiVersion: operator.ozgcloud.de/v1 kind: OzgCloudKeycloakGroup diff --git a/src/main/helm/templates/keycloak-user-crd.yaml b/src/main/helm/templates/keycloak-user-crd.yaml index fd766a7174272a8448e6732ff716305d71ff925e..3bc5c7ab019828a048b44aeaa1fcc3a210d5668b 100644 --- a/src/main/helm/templates/keycloak-user-crd.yaml +++ b/src/main/helm/templates/keycloak-user-crd.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator -}} -{{ range $user := concat (.Values.sso.api_users | default list) (.Values.sso.keycloak_users | default list) }} +{{ range $user := concat ((.Values.sso).api_users | default list) ((.Values.sso).keycloak_users | default list) }} --- {{- if $user.kopOperator }} apiVersion: api.kop-stack.de/v1 diff --git a/src/main/helm/templates/network_policy.yaml b/src/main/helm/templates/network_policy.yaml index 899c5330fa082d97cdfca4e18b615e94cb123723..e5dc19013b7951904275b9b9f46f66df151cfbcf 100644 --- a/src/main/helm/templates/network_policy.yaml +++ b/src/main/helm/templates/network_policy.yaml @@ -29,7 +29,7 @@ spec: # public keycloak ip - to: - ipBlock: - cidr: {{ required "Keycloak public IP must be set" (.Values.networkPolicy).ssoPublicIp }} + cidr: {{ required "networkPolicy.ssoPublicIp must be set" (.Values.networkPolicy).ssoPublicIp }} - to: - namespaceSelector: matchLabels: diff --git a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role.yaml b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role.yaml index f03b806e1fb9cbbfb1c52d859dfdb636f5f485e6..7ab36585e089891c543ae2eac19637888a241b1c 100644 --- a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role.yaml +++ b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator }} -{{- if or (.Values.sso.keycloak_users) (.Values.sso.api_users) }} +{{- if or ((.Values.sso).keycloak_users) ((.Values.sso).api_users) }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: diff --git a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role_binding.yaml b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role_binding.yaml index 832fd464fd53fa709c1e76c46558b6f8bc4a62b8..4a500addcbebd7563623e6df810f02618d9fbb21 100644 --- a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role_binding.yaml +++ b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_read_role_binding.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator }} -{{- if or (.Values.sso.keycloak_users) (.Values.sso.api_users) }} +{{- if or ((.Values.sso).keycloak_users) ((.Values.sso).api_users) }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: diff --git a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role.yaml b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role.yaml index 58a135db883529b13407c31b28b2008309df5670..db46b42cc3e7aafbc7058e6313a822cdf9b42eb3 100644 --- a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role.yaml +++ b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator }} -{{- if or (.Values.sso.keycloak_users) (.Values.sso.api_users) }} +{{- if or ((.Values.sso).keycloak_users) ((.Values.sso).api_users) }} apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: diff --git a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role_binding.yaml b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role_binding.yaml index 8f8fecc682dbb1fd7357b04ede7c526291a7d2c1..a2fbdd01f076a1ceaa5f3ea08e93029002063f1c 100644 --- a/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role_binding.yaml +++ b/src/main/helm/templates/ozgcloud_keycloak_operator_secrets_write_role_binding.yaml @@ -1,5 +1,5 @@ {{- if not (.Values.sso).disableOzgOperator }} -{{- if or (.Values.sso.keycloak_users) (.Values.sso.api_users) }} +{{- if or ((.Values.sso).keycloak_users) ((.Values.sso).api_users) }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: diff --git a/src/main/helm/values.yaml b/src/main/helm/values.yaml index df1548effd48f4cfdbeeb632a84a328e748306d4..186bcf8b334da9a72ac926c534bb2b8cf7a8e6e5 100644 --- a/src/main/helm/values.yaml +++ b/src/main/helm/values.yaml @@ -24,11 +24,6 @@ cluster_env: "" -baseUrl: dev.by.ozg-cloud.de - -sso: - serverUrl: https://sso.dev.by.ozg-cloud.de - image: repo: docker.ozg-sh.de diff --git a/src/test/linter-values.yaml b/src/test/helm-linter-values.yaml similarity index 90% rename from src/test/linter-values.yaml rename to src/test/helm-linter-values.yaml index 0c6bd2d5b0877620e291dee2a479919ef5c7d83f..cba36bc4805b2c75660c816b185c9a198e603aff 100644 --- a/src/test/linter-values.yaml +++ b/src/test/helm-linter-values.yaml @@ -22,6 +22,8 @@ # unter der Lizenz sind dem Lizenztext zu entnehmen. # +baseUrl: test.company.local + ozgcloud: bundesland: sh bezeichner: helm @@ -29,4 +31,7 @@ ozgcloud: networkPolicy: ssoPublicIp: 51.89.117.53/32 - dnsServerNamespace: dummy-dns \ No newline at end of file + dnsServerNamespace: dummy-dns + +sso: + serverUrl: https://sso.company.local \ No newline at end of file diff --git a/src/test/helm/deployment_bindings_test.yaml b/src/test/helm/deployment_bindings_test.yaml index e1f8d9ecccead616a88dab079307e715dca2f672..b92eab55ef82796665c237d387affe0acb0f82a0 100644 --- a/src/test/helm/deployment_bindings_test.yaml +++ b/src/test/helm/deployment_bindings_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local + baseUrl: test.company.local tests: - it: should have volumes set: @@ -87,7 +95,9 @@ tests: - it: should have sso tls cert mount set: usermanagerName: user-manager - sso.tlsCertName: sso-tls-cert + sso: + tlsCertName: sso-tls-cert + serverUrl: https://sso.company.local asserts: - contains: path: spec.template.spec.volumes diff --git a/src/test/helm/deployment_defaults_affinity_test.yaml b/src/test/helm/deployment_defaults_affinity_test.yaml index 54c1a8f89d582f1e69c033de1c4188cfa9ad58df..66ff5b228bb2f35b96e77f04c076fb4212fe3181 100644 --- a/src/test/helm/deployment_defaults_affinity_test.yaml +++ b/src/test/helm/deployment_defaults_affinity_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local + baseUrl: test.company.local tests: - it: should work asserts: diff --git a/src/test/helm/deployment_defaults_annotaion_test.yaml b/src/test/helm/deployment_defaults_annotaion_test.yaml index 311f2d9b66dd9dd35454e6069218540eb39242b5..3ccc5a5f7dbfba8f6eea2beeccdee5a650d661cb 100644 --- a/src/test/helm/deployment_defaults_annotaion_test.yaml +++ b/src/test/helm/deployment_defaults_annotaion_test.yaml @@ -28,13 +28,19 @@ release: namespace: sh-helm-test templates: - templates/ingress.yaml +set: + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + tests: - it: check ingress annotaions for nginx asserts: - isKind: of: Ingress - equal: - path: metadata.annotations.[cert-manager.io/cluster-issuer] + path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-prod - isNull: path: spec.ingressClassName diff --git a/src/test/helm/deployment_defaults_env_test.yaml b/src/test/helm/deployment_defaults_env_test.yaml index 382b573901011ded11ae57b204bd63722ff74b5b..5e9eb166a330ec176a932220643b742584799c02 100644 --- a/src/test/helm/deployment_defaults_env_test.yaml +++ b/src/test/helm/deployment_defaults_env_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check default values set: @@ -65,7 +73,13 @@ tests: templates: - templates/deployment.yaml set: - ozgcloud.user_assistance.documentation.url: http:// + ozgcloud: + user_assistance: + documentation: + url: http:// + environment: test + bundesland: sh + bezeichner: helm asserts: - contains: path: spec.template.spec.containers[0].env @@ -78,6 +92,9 @@ tests: - templates/deployment.yaml set: ozgcloud: + environment: test + bundesland: sh + bezeichner: helm vorgang: bescheid: - formEngineName: AFM diff --git a/src/test/helm/deployment_defaults_labels_test.yaml b/src/test/helm/deployment_defaults_labels_test.yaml index 4cef56cb17882d9c1fc65dab21ffeafa2ba60eec..635f86e602a7c26d6f3acf5d9070c09d67d7cd83 100644 --- a/src/test/helm/deployment_defaults_labels_test.yaml +++ b/src/test/helm/deployment_defaults_labels_test.yaml @@ -30,18 +30,26 @@ templates: - templates/deployment.yaml - templates/service_monitor.yaml - templates/service.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check default labels asserts: - equal: - path: metadata.labels.[app.kubernetes.io/instance] + path: metadata.labels["app.kubernetes.io/instance"] value: alfa - equal: - path: metadata.labels.[app.kubernetes.io/name] + path: metadata.labels["app.kubernetes.io/name"] value: alfa - equal: - path: metadata.labels.[app.kubernetes.io/part-of] + path: metadata.labels["app.kubernetes.io/part-of"] value: ozgcloud - equal: - path: metadata.labels.[app.kubernetes.io/namespace] + path: metadata.labels["app.kubernetes.io/namespace"] value: sh-helm-test diff --git a/src/test/helm/deployment_defaults_spec_containers_health_test.yaml b/src/test/helm/deployment_defaults_spec_containers_health_test.yaml index 94ba8b1e756aff1ba138b819c0ed1485bb74722b..b159900bff56d1bbb987e65f4a889e8a3174043e 100644 --- a/src/test/helm/deployment_defaults_spec_containers_health_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_health_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should work asserts: diff --git a/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml b/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml index 16f0109ff540cebb7b24da478c6443ade68e6483..ace851c7150d835a5af31613d5c1d85a633c67c9 100644 --- a/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_securityContext_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check default values asserts: diff --git a/src/test/helm/deployment_defaults_spec_containers_test.yaml b/src/test/helm/deployment_defaults_spec_containers_test.yaml index 2fc83108825e116fb6c845c3c4b7863ff10f93d4..9c62d0707f9b29650efc0f7ee64fa643eccc52b5 100644 --- a/src/test/helm/deployment_defaults_spec_containers_test.yaml +++ b/src/test/helm/deployment_defaults_spec_containers_test.yaml @@ -28,6 +28,17 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local + image: + path: docker.ozg-sh.de/alfa + tag: snapshot-latest tests: - it: check for some standard values asserts: diff --git a/src/test/helm/deployment_defaults_spec_test.yaml b/src/test/helm/deployment_defaults_spec_test.yaml index bda0c0df14063137c9e06ccf8d4423e63103dcb1..96b6b4d8d4c490847740db1b2ac0ce1a5b9f81a8 100644 --- a/src/test/helm/deployment_defaults_spec_test.yaml +++ b/src/test/helm/deployment_defaults_spec_test.yaml @@ -28,6 +28,15 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + replicaCount: 5 + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should work asserts: @@ -43,10 +52,10 @@ tests: path: spec.revisionHistoryLimit value: 10 - equal: - path: spec.selector.matchLabels.[app.kubernetes.io/name] + path: spec.selector.matchLabels["app.kubernetes.io/name"] value: alfa - equal: - path: spec.selector.matchLabels.[app.kubernetes.io/namespace] + path: spec.selector.matchLabels["app.kubernetes.io/namespace"] value: sh-helm-test - equal: path: spec.strategy.rollingUpdate.maxSurge diff --git a/src/test/helm/deployment_defaults_sso_test.yaml b/src/test/helm/deployment_defaults_sso_test.yaml index 9c4c14df0eeb7a01c11b572a386ae7634cbeed17..9577a9a015b53b10ccef145cf98e030ddc9271e0 100644 --- a/src/test/helm/deployment_defaults_sso_test.yaml +++ b/src/test/helm/deployment_defaults_sso_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check default values asserts: @@ -47,11 +55,14 @@ tests: path: spec.template.spec.containers[0].env content: name: keycloak_auth-server-url - value: https://sso.sh.ozg-cloud.de + value: https://sso.company.local - it: check realm with long namespace set: - ozgcloud.bezeichner: eins-zwei-drei + ozgcloud: + bezeichner: eins-zwei-drei + environment: dev + bundesland: sh asserts: - isKind: of: Deployment @@ -59,12 +70,13 @@ tests: path: spec.template.spec.containers[0].env content: name: keycloak_realm - value: sh-eins-zwei-drei-test + value: sh-eins-zwei-drei-dev - it: check different client name set: sso: client_name: different-client + serverUrl: https://sso.company.local asserts: - isKind: of: Deployment diff --git a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml index bd7726196ac9edb79156c4f212dd05896a5fc4f3..3dadf673fef8847b578fe2ca025299f644e73ef6 100644 --- a/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml +++ b/src/test/helm/deployment_defaults_topologySpreadConstraints_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check default values asserts: @@ -43,5 +51,5 @@ tests: path: spec.template.spec.topologySpreadConstraints[0].whenUnsatisfiable value: ScheduleAnyway - equal: - path: spec.template.spec.topologySpreadConstraints[0].labelSelector.matchLabels.[app.kubernetes.io/name] + path: spec.template.spec.topologySpreadConstraints[0].labelSelector.matchLabels["app.kubernetes.io/name"] value: alfa \ No newline at end of file diff --git a/src/test/helm/deployment_env_test.yaml b/src/test/helm/deployment_env_test.yaml index 082d6b64ca87090744f75c7e39af85fb50c2af20..4846e3c79c13c350e2ab024cd299a9485a5cafe2 100644 --- a/src/test/helm/deployment_env_test.yaml +++ b/src/test/helm/deployment_env_test.yaml @@ -25,6 +25,14 @@ suite: test environments templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: check customList template: deployment.yaml diff --git a/src/test/helm/deployment_host_aliases_test.yaml b/src/test/helm/deployment_host_aliases_test.yaml index 517408b4e2d4253f52badff8cc619d1689dba8f6..68dd2175549a759a51746e62a0ecedd4e22993b5 100644 --- a/src/test/helm/deployment_host_aliases_test.yaml +++ b/src/test/helm/deployment_host_aliases_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should not set hostAliases asserts: diff --git a/src/test/helm/deployment_imageTag_test.yaml b/src/test/helm/deployment_imageTag_test.yaml index 50a7ad7f6a511cb87e9024ddae0264c980d3c66d..24eb6cd05e11e779ed033459c444e35b9a8d84a7 100644 --- a/src/test/helm/deployment_imageTag_test.yaml +++ b/src/test/helm/deployment_imageTag_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should set the latest imageTag set: diff --git a/src/test/helm/deployment_imagepull_secret_test.yaml b/src/test/helm/deployment_imagepull_secret_test.yaml index 6e9426395432e6a30dcb4753bd38937edcfcb066..376a207a28cdae5b39cf7bafac1e37cc2ff3e7dd 100644 --- a/src/test/helm/deployment_imagepull_secret_test.yaml +++ b/src/test/helm/deployment_imagepull_secret_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should use default imagePull secret asserts: diff --git a/src/test/helm/deployment_pluto_address_test.yaml b/src/test/helm/deployment_pluto_address_test.yaml index 38eb0f989f532be1f782571c1d22f3b42f5735ac..f29d2a1019908ba8ee3605e3c801b7aa56a8b6ad 100644 --- a/src/test/helm/deployment_pluto_address_test.yaml +++ b/src/test/helm/deployment_pluto_address_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should set the vorgang-manager name set: diff --git a/src/test/helm/deployment_replicas_test.yaml b/src/test/helm/deployment_replicas_test.yaml index 84c496ab9940be7242dba7d9a9fb38e86eef3780..a02796b0fec4d2890f7ab161c239be1d4483e31a 100644 --- a/src/test/helm/deployment_replicas_test.yaml +++ b/src/test/helm/deployment_replicas_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should set the replica count set: diff --git a/src/test/helm/deployment_resources_test.yaml b/src/test/helm/deployment_resources_test.yaml index f47aed0e61dfb1a345c0a9c4f0eb62f8a25451f7..9ef0c9aa2b91aac31a158da2d1adad978c554ded 100644 --- a/src/test/helm/deployment_resources_test.yaml +++ b/src/test/helm/deployment_resources_test.yaml @@ -27,6 +27,14 @@ release: name: alfa templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: test resources set: diff --git a/src/test/helm/deployment_service_account_test.yaml b/src/test/helm/deployment_service_account_test.yaml index 2a6a0afc9b9042800078d1aacbc3b6943b0055dc..934ef504d28ef8d225749daab8152461a836cda9 100644 --- a/src/test/helm/deployment_service_account_test.yaml +++ b/src/test/helm/deployment_service_account_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should use service account with default name set: diff --git a/src/test/helm/deployment_springProfile_test.yaml b/src/test/helm/deployment_springProfile_test.yaml index 4e0548977fa5431d027e99de8d1cfb29e35dd835..511917490f577d98164bd4dde37f9b5274d6f81f 100644 --- a/src/test/helm/deployment_springProfile_test.yaml +++ b/src/test/helm/deployment_springProfile_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should override the spring profiles set: diff --git a/src/test/helm/deployment_usermanager_address_test.yaml b/src/test/helm/deployment_usermanager_address_test.yaml index a1b0246dec4d70e766fe6d507fdf736eb7bfcf18..59bc6ef7dec3595db6149b22a27d3f7f3ba7a842 100644 --- a/src/test/helm/deployment_usermanager_address_test.yaml +++ b/src/test/helm/deployment_usermanager_address_test.yaml @@ -28,6 +28,14 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml +set: + baseUrl: test.company.local + ozgcloud: + environment: test + bundesland: sh + bezeichner: helm + sso: + serverUrl: https://sso.company.local tests: - it: should build the usermanager url for test environment set: @@ -37,7 +45,7 @@ tests: path: spec.template.spec.containers[0].env content: name: ozgcloud_user-manager_url - value: https://helm-my-test-usermanager-name.test.sh.ozg-cloud.de + value: https://helm-my-test-usermanager-name.test.company.local - it: should use usermanager url from values set: usermanagerUrl: http://test.domain.local diff --git a/src/test/helm/image_pull_secret_test.yaml b/src/test/helm/image_pull_secret_test.yaml index 6ea26d0703f105c33527df9b24ea6351d29394d8..170ae93b987aa52913b25373e70613618ebe8845 100644 --- a/src/test/helm/image_pull_secret_test.yaml +++ b/src/test/helm/image_pull_secret_test.yaml @@ -48,8 +48,8 @@ tests: - equal: path: metadata.namespace value: helm-test - - isNotEmpty: - path: data.[.dockerconfigjson] + - isNotNullOrEmpty: + path: data[".dockerconfigjson"] - it: should not create image pull secret set: diff --git a/src/test/helm/ingress-nginx-tests.yaml b/src/test/helm/ingress-nginx-tests.yaml index 6d092d18ef73a3714bf3fa6b2c5a6f8a29f1c615..6b0d88bfaae0f2a17d8fcb853f98fa305deffab7 100644 --- a/src/test/helm/ingress-nginx-tests.yaml +++ b/src/test/helm/ingress-nginx-tests.yaml @@ -28,6 +28,11 @@ release: namespace: sh-helm-test templates: - templates/ingress.yaml +set: + ozgcloud: + bundesland: by + bezeichner: helm + environment: test tests: - it: should create ingress tls asserts: @@ -47,7 +52,7 @@ tests: - it: should use default letsencrypt-prod cluster-issuer asserts: - equal: - path: metadata.annotations.[cert-manager.io/cluster-issuer] + path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-prod - it: should use letsencrypt-staging cluster-issuer @@ -55,7 +60,7 @@ tests: ingress.use_staging_cert: true asserts: - equal: - path: metadata.annotations.[cert-manager.io/cluster-issuer] + path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-staging - it: should use letsencrypt-prod cluster-issuer @@ -63,12 +68,12 @@ tests: ingress.use_staging_cert: false asserts: - equal: - path: metadata.annotations.[cert-manager.io/cluster-issuer] + path: metadata.annotations["cert-manager.io/cluster-issuer"] value: letsencrypt-prod - it: should set proxy body size to 42m asserts: - equal: - path: metadata.annotations.[nginx.ingress.kubernetes.io/proxy-body-size] + path: metadata.annotations["nginx.ingress.kubernetes.io/proxy-body-size"] value: 42m - it: should not set ingressClassName asserts: diff --git a/src/test/helm/keycloak-client-crd-test.yaml b/src/test/helm/keycloak-client-crd-test.yaml index 4902829d978673407ad2bed0659acc537dc8b949..5b9300d1b6f2b7556411c203804194b4d5a78a52 100644 --- a/src/test/helm/keycloak-client-crd-test.yaml +++ b/src/test/helm/keycloak-client-crd-test.yaml @@ -28,6 +28,11 @@ release: namespace: by-helm-test templates: - templates/keycloak-client-crd.yaml +set: + ozgcloud: + bundesland: by + bezeichner: helm + environment: test tests: - it: should contain header data set: @@ -70,15 +75,11 @@ tests: kopOperator: true asserts: - equal: - path: metadata.annotations.[helm.sh/resource-policy] + path: metadata.annotations["helm.sh/resource-policy"] value: keep - it: should have default Values set: baseUrl: test.by.ozg-cloud.de - ozgcloud: - bundesland: by - bezeichner: helm - environment: test sso: keycloak_clients: - client_name: alfa @@ -105,10 +106,6 @@ tests: - it: should override default redirect uris set: baseUrl: test.by.ozg-cloud.de - ozgcloud: - bundesland: by - bezeichner: helm - environment: test sso: keycloak_clients: - client_name: alfa @@ -137,10 +134,6 @@ tests: - it: should contain additional redirect uris set: baseUrl: test.by.ozg-cloud.de - ozgcloud: - bundesland: by - bezeichner: helm - environment: test sso: keycloak_clients: - client_name: alfa @@ -169,10 +162,6 @@ tests: - it: should contain client roles set: baseUrl: test.by.ozg-cloud.de - ozgcloud: - bundesland: by - bezeichner: helm - environment: test sso: keycloak_clients: - client_name: alfa @@ -202,10 +191,6 @@ tests: - it: should map client protocol mapper set: baseUrl: test.by.ozg-cloud.de - ozgcloud: - bundesland: by - bezeichner: helm - environment: test sso: keycloak_clients: - client_name: alfa diff --git a/src/test/helm/keycloak-crd-test.yaml b/src/test/helm/keycloak-crd-test.yaml index 0c0e17061de164e73aceb8d304723420e4fee42c..8010a45e07aaae60a865e243de25852f3ab3fd98 100644 --- a/src/test/helm/keycloak-crd-test.yaml +++ b/src/test/helm/keycloak-crd-test.yaml @@ -28,6 +28,10 @@ release: namespace: by-helm-test templates: - templates/keycloak-crd.yaml +set: + ozgcloud: + environment: test + bezeichner: helm tests: - it: should contain header data asserts: diff --git a/src/test/helm/keycloak-user-crd-test.yaml b/src/test/helm/keycloak-user-crd-test.yaml index 6749e412eccff60baea5c5a4bf697bc468a9e4fb..0685f872b3999b9e79ef7a532b9f558a7893d30a 100644 --- a/src/test/helm/keycloak-user-crd-test.yaml +++ b/src/test/helm/keycloak-user-crd-test.yaml @@ -552,7 +552,7 @@ tests: path: spec.keycloak_user.username value: kop - equal: - path: metadata.annotations.[helm.sh/resource-policy] + path: metadata.annotations["helm.sh/resource-policy"] value: keep - it: should not create user cr if ozg operator is disabled diff --git a/src/test/helm/network_policy_test.yaml b/src/test/helm/network_policy_test.yaml index 9bf96f78957cada205c10a9de225634aaa59c2c7..48ff2afe0c20aafdfba64aa464173ee75711db37 100644 --- a/src/test/helm/network_policy_test.yaml +++ b/src/test/helm/network_policy_test.yaml @@ -28,6 +28,10 @@ release: namespace: by-helm-test templates: - templates/network_policy.yaml +set: + networkPolicy: + dnsServerNamespace: kube-system + ssoPublicIp: 1.1.1.1/32 tests: - it: should match apiVersion asserts: @@ -48,6 +52,7 @@ tests: set: networkPolicy: dnsServerNamespace: kube-system + ssoPublicIp: 1.1.1.1/32 asserts: - equal: path: spec @@ -72,7 +77,7 @@ tests: # public keycloak ip - to: - ipBlock: - cidr: 51.89.117.53/32 + cidr: 1.1.1.1/32 - to: - namespaceSelector: matchLabels: @@ -89,6 +94,8 @@ tests: - it: add ingress rule by values set: networkPolicy: + ssoPublicIp: 1.1.1.1 + dnsServerNamespace: kube-system additionalIngressConfig: - podSelector: matchLabels: @@ -115,7 +122,9 @@ tests: - it: test network policy unset should be disabled set: networkPolicy: + ssoPublicIp: 1.1.1.1 disabled: false + dnsServerNamespace: test-dns-server-namespace asserts: - hasDocuments: count: 1 diff --git a/src/test/helm/service_monitor_test.yaml b/src/test/helm/service_monitor_test.yaml index fcfb12b4b4ed934b6938f113a6af62ca7098bfc4..d5dd89a4755bc09d9744f62e6554fb8910a7cfec 100644 --- a/src/test/helm/service_monitor_test.yaml +++ b/src/test/helm/service_monitor_test.yaml @@ -34,7 +34,7 @@ tests: - isKind: of: ServiceMonitor - equal: - path: metadata.labels.[component] + path: metadata.labels["component"] value: alfa-service-monitor - it: should have the metrics endpoint configured by default set: @@ -64,13 +64,13 @@ tests: - it: selector should contain the component label with the value alfa-service asserts: - equal: - path: spec.selector.matchLabels.[component] + path: spec.selector.matchLabels["component"] value: alfa-service - it: selector should contain helm recommended labels name and namespace asserts: - equal: - path: spec.selector.matchLabels.[app.kubernetes.io/name] + path: spec.selector.matchLabels["app.kubernetes.io/name"] value: alfa - equal: - path: spec.selector.matchLabels.[app.kubernetes.io/namespace] + path: spec.selector.matchLabels["app.kubernetes.io/namespace"] value: sh-helm-test diff --git a/src/test/helm/service_test.yaml b/src/test/helm/service_test.yaml index 5c32bce0f5c1cc7cb2d411238916c5a4fbaaaa9e..8baec4baff89fec42e21903884a74c9070b548fb 100644 --- a/src/test/helm/service_test.yaml +++ b/src/test/helm/service_test.yaml @@ -34,7 +34,7 @@ tests: - isKind: of: Service - equal: - path: metadata.labels.[component] + path: metadata.labels["component"] value: alfa-service - it: should be of type ClusterIP asserts: @@ -50,8 +50,8 @@ tests: port: 8080 protocol: TCP targetPort: 8080 - count: 1 - any: true + count: 1 + any: true - it: ports should contain the metrics port asserts: - contains: @@ -60,19 +60,19 @@ tests: name: metrics port: 8081 protocol: TCP - count: 1 - any: true + count: 1 + any: true - it: selector should contain the component label with the value alfa asserts: - equal: - path: spec.selector.[component] + path: spec.selector["component"] value: alfa - it: selector should contain helm recommended labels name and namespace asserts: - equal: - path: spec.selector.[app.kubernetes.io/name] + path: spec.selector["app.kubernetes.io/name"] value: alfa - equal: - path: spec.selector.[app.kubernetes.io/namespace] + path: spec.selector["app.kubernetes.io/namespace"] value: helm-test \ No newline at end of file diff --git a/src/test/unit-values.yaml b/src/test/unit-values.yaml deleted file mode 100644 index 1e11128f1c1032b51e2234e9b0f347f91ba6d24a..0000000000000000000000000000000000000000 --- a/src/test/unit-values.yaml +++ /dev/null @@ -1,48 +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. -# - -cluster_env: "" - -replicaCount: 5 -vorgangManagerName: vorgang-manager -usermanagerName: my-test-usermanager-name - -ozgcloud: - bundesland: sh - bezeichner: helm - environment: test - -sso: - apiPassword: test1234 - serverUrl: https://sso.sh.ozg-cloud.de - -baseUrl: test.sh.ozg-cloud.de - -image: - path: docker.ozg-sh.de/alfa - tag: snapshot-latest - -networkPolicy: - ssoPublicIp: 51.89.117.53/32 - dnsServerNamespace: dummy-dns \ No newline at end of file