diff --git a/templates/gitea/deployment.yaml b/templates/gitea/deployment.yaml index 40ad134..7da7d29 100644 --- a/templates/gitea/deployment.yaml +++ b/templates/gitea/deployment.yaml @@ -370,9 +370,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 bc77ed7..909bb64 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/gitea/deployment.yaml asserts: @@ -92,4 +110,4 @@ tests: value: "/usr/sbinx" - equal: path: spec.template.spec.initContainers[*].volumeMounts[?(@.name=="config")].mountPath - value: "/usr/sbinx" + value: "/usr/sbinx" \ No newline at end of file