diff --git a/xta-adapter/src/main/helm/templates/_helpers.tpl b/xta-adapter/src/main/helm/templates/_helpers.tpl index 5d09c85640bf9ac9943624f3f038687a2bdeec88..5f233e14c2eca1effd045608f7549e390bef9c99 100644 --- a/xta-adapter/src/main/helm/templates/_helpers.tpl +++ b/xta-adapter/src/main/helm/templates/_helpers.tpl @@ -58,4 +58,22 @@ helm.sh/chart: {{ include "app.chart" . }} {{- define "app.serviceAccountName" -}} {{ printf "%s" ( (.Values.serviceAccount).name | default "xta-adapter-service-account" ) }} +{{- end -}} + +{{- define "app.getCustomList" -}} +{{- with (.Values.env).customList -}} +{{- if kindIs "map" . -}} +{{ include "app.dictToList" . }} +{{- else if kindIs "slice" . -}} +{{ . | toYaml }} +{{- end -}} +{{- end -}} +{{- end -}} + +{{- define "app.dictToList" -}} +{{- $customList := list -}} +{{- range $key, $value := . -}} +{{- $customList = append $customList (dict "name" $key "value" $value) }} +{{- end -}} +{{- $customList | toYaml -}} {{- end -}} \ No newline at end of file diff --git a/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml b/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml index 1159ff69ea4971ed41c08d8ba5d36090550ffa5e..b8d0d2b9870587f17f992129bf23928c2bcb48a0 100644 --- a/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml +++ b/xta-adapter/src/main/helm/templates/xta_adapter_cronjob.yaml @@ -85,6 +85,9 @@ spec: - name: grpc_client_vorgang-manager-{{ (.Values.routing).targetVorgangManagerName }}_negotiationType value: {{ (.Values.routing).negotiationType | default "PLAINTEXT" }} {{- end }} + {{- with include "app.getCustomList" . }} +{{ . | indent 16 }} + {{- end }} volumeMounts: - name: bindings mountPath: "/bindings/ca-certificates/type" diff --git a/xta-adapter/src/test/helm/network_policy_test.yaml b/xta-adapter/src/test/helm/network_policy_test.yaml index 7e725ee8a94e63b8a7156aa15cfad027b7d45575..0c21953e21950822c2f58361fd9081a7f0405316 100644 --- a/xta-adapter/src/test/helm/network_policy_test.yaml +++ b/xta-adapter/src/test/helm/network_policy_test.yaml @@ -122,7 +122,6 @@ tests: - ipBlock: cidr: 1.2.3.4/32 - - it: test network policy disabled set: networkPolicy: diff --git a/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml b/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml index 4e84137ff94e27f91f7786522f65e9ff5b52d380..30ad85fc12a3b14b56cecbbc4bc08b18f4d0d20a 100644 --- a/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml +++ b/xta-adapter/src/test/helm/xta_adapter_cronjob_env_test.yaml @@ -154,4 +154,46 @@ tests: path: spec.jobTemplate.spec.template.spec.containers[0].env content: name: grpc_client_vorgang-manager-vorgang-manager_negotiationType - value: "TLS" \ No newline at end of file + value: "TLS" + - it: check customList as list + set: + env.customList: + - name: my_test_environment_name + value: "A test value" + - name: test_environment + value: "B test value" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: my_test_environment_name + value: "A test value" + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: test_environment + value: "B test value" + - it: check customList as dict + set: + env.customList: + my_test_environment_name: "A test value" + test_environment: "B test value" + asserts: + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: my_test_environment_name + value: "A test value" + - contains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: test_environment + value: "B test value" + + - it: check customList test value is not set by default + asserts: + - notContains: + path: spec.jobTemplate.spec.template.spec.containers[0].env + content: + name: my_test_environment_name + value: "A test value" \ No newline at end of file