diff --git a/templates/deployment.yaml b/templates/deployment.yaml index f8e4e6f..427ef5b 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -364,9 +364,9 @@ spec: hostAliases: {{- toYaml . | nindent 8 }} {{- end }} - {{- range $key, $value := .Values.nodeSelector }} + {{- with .Values.nodeSelector }} nodeSelector: - {{ $key }}: {{ $value | quote }} + {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: diff --git a/unittests/helm/deployment/basic.yaml b/unittests/helm/deployment/basic.yaml index 9a60007..91f7573 100644 --- a/unittests/helm/deployment/basic.yaml +++ b/unittests/helm/deployment/basic.yaml @@ -29,6 +29,24 @@ tests: path: spec.template.metadata.labels content: hello: world + - it: nodeSelector is undefined + asserts: + - notExists: + path: spec.template.spec.nodeSelector + template: templates/gitea/deployment.yaml + - it: nodeSelector is defined + set: + nodeSelector: + foo: bar + bar: foo + asserts: + - isSubset: + path: spec.template.spec.nodeSelector + content: + foo: bar + bar: foo + template: templates/gitea/deployment.yaml + - it: "injects TMP_EXISTING_ENVS_FILE as environment variable to 'init-app-ini' init container" template: templates/deployment.yaml asserts: