From a98397456818d20ea8b611cb505d3b3a090bb8d3 Mon Sep 17 00:00:00 2001 From: tobiasbp Date: Wed, 19 Feb 2025 13:20:18 +0000 Subject: [PATCH] fix: quote node selector values (#796) ### Description of the change This pr add quotes to values for _nodeSelector_ entries. This is needed if the value is a _boolean_. An example is using [Spot VMs](https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms) on _GCP_: ```` apiVersion: v1 kind: Pod spec: nodeSelector: cloud.google.com/gke-spot: "true" ```` Currently, the Chart uses the _toYaml_ function when adding the _nodeSelector_ values, however, _toYaml_ does not quote the values as discussed [here](https://github.com/helm/helm/issues/4262). The same issue, for ingress configurations, was discussed in [this issue](https://gitea.com/gitea/helm-chart/issues/483), and fixed in [this PR](https://gitea.com/gitea/helm-chart/pulls/497). ### Benefits Allows the usage of _boolean_ values for _nodeSelectors_. ### Possible drawbacks None known. Co-authored-by: tobias.petersen Co-authored-by: pat-s Reviewed-on: https://gitea.com/gitea/helm-chart/pulls/796 Reviewed-by: pat-s Co-authored-by: tobiasbp Co-committed-by: tobiasbp --- templates/gitea/act_runner/job.yaml | 4 ++-- templates/gitea/act_runner/statefulset.yaml | 4 ++-- templates/gitea/deployment.yaml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/gitea/act_runner/job.yaml b/templates/gitea/act_runner/job.yaml index e8189d9..777eb77 100644 --- a/templates/gitea/act_runner/job.yaml +++ b/templates/gitea/act_runner/job.yaml @@ -86,9 +86,9 @@ spec: {{- if .Values.persistence.subPath }} subPath: {{ .Values.persistence.subPath }} {{- end }} - {{- with .Values.actions.provisioning.nodeSelector }} + {{- range $key, $value := .Values.actions.provisioning.nodeSelector }} nodeSelector: - {{- toYaml . | nindent 8 }} + {{ $key }}: {{ $value | quote }} {{- end }} {{- with .Values.actions.provisioning.affinity }} affinity: diff --git a/templates/gitea/act_runner/statefulset.yaml b/templates/gitea/act_runner/statefulset.yaml index 996778c..72b4e19 100644 --- a/templates/gitea/act_runner/statefulset.yaml +++ b/templates/gitea/act_runner/statefulset.yaml @@ -96,9 +96,9 @@ spec: {{- with .Values.actions.statefulset.dind.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} - {{- with .Values.actions.statefulset.nodeSelector }} + {{- range $key, $value := .Values.actions.statefulset.nodeSelector }} nodeSelector: - {{- toYaml . | nindent 8 }} + {{ $key }}: {{ $value | quote }} {{- end }} {{- with .Values.actions.statefulset.affinity }} affinity: diff --git a/templates/gitea/deployment.yaml b/templates/gitea/deployment.yaml index fa242cc..3d0c2ca 100644 --- a/templates/gitea/deployment.yaml +++ b/templates/gitea/deployment.yaml @@ -360,9 +360,9 @@ spec: hostAliases: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.nodeSelector }} + {{- range $key, $value := .Values.nodeSelector }} nodeSelector: - {{- toYaml . | nindent 8 }} + {{ $key }}: {{ $value | quote }} {{- end }} {{- with .Values.affinity }} affinity: