Skip to content
Snippets Groups Projects
Commit 9e8ec863 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'ozg-5100 dict to list' (#26) from ozg-5100-customlist into master

parents d5dcd477 7d64fb21
Branches
Tags
No related merge requests found
......@@ -4,4 +4,22 @@
{{- define "app.matchLabels" }}
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/namespace: {{ .Release.Namespace }}
{{- 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
......@@ -49,8 +49,8 @@ spec:
- name: ozgcloud-elasticsearch-operator
image: "{{ required "image.repo must be set" (.Values.image).repo }}/{{ required "image.name must be set" (.Values.image).name }}:{{ required "image.tag must be set" (.Values.image).tag }}"
env:
{{- with (.Values.env).customList }}
{{ toYaml . | indent 8 }}
{{- with include "app.getCustomList" . }}
{{ . | indent 8 }}
{{- end }}
- name: SERVICE_BINDING_ROOT
value: "/bindings"
......
......@@ -30,12 +30,34 @@ set:
namespace: elastic-system
adminSecretName: ozg-search-cluster-es-elastic-user
certificateSecretName: ozg-search-cluster-es-http-ca-internal
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
tests:
- it: check customList
- 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.template.spec.containers[0].env
content:
name: my_test_environment_name
value: "A test value"
- contains:
path: 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"
image:
name: hase
tag: latest
......@@ -46,4 +68,8 @@ tests:
content:
name: my_test_environment_name
value: "A test value"
- contains:
path: spec.template.spec.containers[0].env
content:
name: test_environment
value: "B test value"
......@@ -3,4 +3,22 @@
{{- define "app.matchLabels" }}
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/namespace: {{ .Release.Namespace }}
{{- 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
......@@ -49,8 +49,8 @@ spec:
- name: ozgcloud-keycloak-operator
image: "{{ required "image.repo must be set" (.Values.image).repo }}/{{ required "image.name must be set" (.Values.image).name }}:{{ required "image.tag must be set" (.Values.image).tag }}"
env:
{{- with (.Values.env).customList }}
{{ toYaml . | indent 8 }}
{{- with include "app.getCustomList" . }}
{{ . | indent 8 }}
{{- end }}
imagePullPolicy: Always
# readinessProbe:
......
......@@ -31,16 +31,42 @@ set:
name: hase
tag: latest
tests:
- it: check customList
template: deployment.yaml
- 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.template.spec.containers[0].env
content:
name: my_test_environment_name
value: "A test value"
- contains:
path: 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"
image:
name: hase
tag: latest
imagePullSecret: imagePullSecret
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: my_test_environment_name
value: "A test value"
- contains:
path: spec.template.spec.containers[0].env
content:
name: test_environment
value: "B test value"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment