Skip to content
Snippets Groups Projects
Commit 95946fd1 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-5958 add customVars for xta-adapter

parent 2908a8b5
Branches
Tags
No related merge requests found
...@@ -59,3 +59,20 @@ helm.sh/chart: {{ include "app.chart" . }} ...@@ -59,3 +59,20 @@ helm.sh/chart: {{ include "app.chart" . }}
{{- define "app.serviceAccountName" -}} {{- define "app.serviceAccountName" -}}
{{ printf "%s" ( (.Values.serviceAccount).name | default "xta-adapter-service-account" ) }} {{ printf "%s" ( (.Values.serviceAccount).name | default "xta-adapter-service-account" ) }}
{{- end -}} {{- 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" -}}
{{- range $key, $value := . -}}
- name: {{ $key }}
value: {{ $value }}
{{- end -}}
{{- end -}}
\ No newline at end of file
...@@ -34,6 +34,13 @@ spec: ...@@ -34,6 +34,13 @@ spec:
ozg-component: xta-adapter ozg-component: xta-adapter
policyTypes: policyTypes:
- Egress - Egress
ingress:
{{- with (.Values.networkPolicy).additionalIngressConfigLocal }}
{{ toYaml . | indent 2 }}
{{- end }}
{{- with (.Values.networkPolicy).additionalIngressConfigGlobal }}
{{ toYaml . | indent 2 }}
{{- end }}
egress: egress:
- to: - to:
- podSelector: - podSelector:
......
...@@ -85,6 +85,9 @@ spec: ...@@ -85,6 +85,9 @@ spec:
- name: grpc_client_vorgang-manager-{{ (.Values.routing).targetVorgangManagerName }}_negotiationType - name: grpc_client_vorgang-manager-{{ (.Values.routing).targetVorgangManagerName }}_negotiationType
value: {{ (.Values.routing).negotiationType | default "PLAINTEXT" }} value: {{ (.Values.routing).negotiationType | default "PLAINTEXT" }}
{{- end }} {{- end }}
{{- with include "app.getCustomList" . }}
{{ . | indent 16 }}
{{- end }}
volumeMounts: volumeMounts:
- name: bindings - name: bindings
mountPath: "/bindings/ca-certificates/type" mountPath: "/bindings/ca-certificates/type"
......
...@@ -56,6 +56,7 @@ tests: ...@@ -56,6 +56,7 @@ tests:
ozg-component: xta-adapter ozg-component: xta-adapter
policyTypes: policyTypes:
- Egress - Egress
ingress:
egress: egress:
- to: - to:
- podSelector: - podSelector:
...@@ -122,6 +123,40 @@ tests: ...@@ -122,6 +123,40 @@ tests:
- ipBlock: - ipBlock:
cidr: 1.2.3.4/32 cidr: 1.2.3.4/32
- it: add ingress rule by values local
set:
networkPolicy:
dnsServerNamespace: test-namespace-dns
additionalIngressConfigLocal:
- from:
- podSelector:
matchLabels:
component: client2
asserts:
- contains:
path: spec.ingress
content:
from:
- podSelector:
matchLabels:
component: client2
- it: add ingress rule by values global
set:
networkPolicy:
dnsServerNamespace: test-namespace-dns
additionalIngressConfigGlobal:
- from:
- podSelector:
matchLabels:
component: client2
asserts:
- contains:
path: spec.ingress
content:
from:
- podSelector:
matchLabels:
component: client2
- it: test network policy disabled - it: test network policy disabled
set: set:
......
...@@ -155,3 +155,32 @@ tests: ...@@ -155,3 +155,32 @@ tests:
content: content:
name: grpc_client_vorgang-manager-vorgang-manager_negotiationType name: grpc_client_vorgang-manager-vorgang-manager_negotiationType
value: "TLS" value: "TLS"
- it: check customList as list
set:
env.customList:
- name: my_test_environment_name
value: "A test value"
asserts:
- contains:
path: spec.jobTemplate.spec.template.spec.containers[0].env
content:
name: my_test_environment_name
value: "A test value"
- it: check customList as dict
set:
env.customList:
my_test_environment_name: "A test value"
asserts:
- contains:
path: spec.jobTemplate.spec.template.spec.containers[0].env
content:
name: my_test_environment_name
value: "A 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment