Skip to content

Commit b88abaa

Browse files
fix(deployment): avoid duplicated nodeSelector #980
1 parent b096138 commit b88abaa

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

templates/gitea/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ spec:
370370
hostAliases:
371371
{{- toYaml . | nindent 8 }}
372372
{{- end }}
373-
{{- range $key, $value := .Values.nodeSelector }}
373+
{{- with .Values.nodeSelector }}
374374
nodeSelector:
375-
{{ $key }}: {{ $value | quote }}
375+
{{- toYaml . | nindent 8 }}
376376
{{- end }}
377377
{{- with .Values.affinity }}
378378
affinity:

unittests/helm/deployment/basic.yaml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ tests:
2929
path: spec.template.metadata.labels
3030
content:
3131
hello: world
32+
- it: nodeSelector is undefined
33+
asserts:
34+
- notExists:
35+
path: spec.template.spec.nodeSelector
36+
template: templates/gitea/deployment.yaml
37+
- it: nodeSelector is defined
38+
set:
39+
nodeSelector:
40+
foo: bar
41+
bar: foo
42+
asserts:
43+
- isSubset:
44+
path: spec.template.spec.nodeSelector
45+
content:
46+
foo: bar
47+
bar: foo
48+
template: templates/gitea/deployment.yaml
49+
3250
- it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container"
3351
template: templates/gitea/deployment.yaml
3452
asserts:
@@ -92,4 +110,4 @@ tests:
92110
value: "/usr/sbinx"
93111
- equal:
94112
path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath
95-
value: "/usr/sbinx"
113+
value: "/usr/sbinx"

0 commit comments

Comments
 (0)