mapping values are not allowed in this context
aakash-rajur opened this issue · comments
Aakash Rajur commented
Hi, awesome project.
please find the following information for my environment context:
Aakashs-MacBook-Pro:infra aakash$ kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.2", GitCommit:"8b5a19147530eaac9476b0ab82980b4088bbc1b2", GitTreeState:"clean", BuildDate:"2021-09-15T21:31:32Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.4-gke.301", GitCommit:"66446d1224e45ac4e17387701d2e2364e3ed4b8c", GitTreeState:"clean", BuildDate:"2021-08-24T05:19:21Z", GoVersion:"go1.16.6b7", Compiler:"gc", Platform:"linux/amd64"}
Aakashs-MacBook-Pro:infra aakash$ helm version
version.BuildInfo{Version:"v3.7.0", GitCommit:"eeac83883cb4014fe60267ec6373570374ce770b", GitTreeState:"clean", GoVersion:"go1.17"}
Aakashs-MacBook-Pro:infra aakash$ helm search repo preemptible
NAME CHART VERSION APP VERSION DESCRIPTION
estafette/estafette-gke-preemptible-killer 1.3.0 1.3.0 Kubernetes controller to spread preemption for ...
estafette/estafette-gke-node-pool-shifter 1.2.4 1.2.4 Kubernetes controller that can shift nodes from...
# values.yaml while installation
secret:
workloadIdentityServiceAccount: tf-mark1-workload-identity@pro-intent.iam.gserviceaccount.com
logFormat: json
extraEnv:
WHITELIST_HOURS: "00:00 - 06:00"
FILTERS: "topology.kubernetes.io/zone: asia-south1-b; node_pool: production"
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node_pool
operator: In
values:
- production
- matchExpressions:
- key: "topology.kubernetes.io/zone"
operator: In
values:
- asia-south1-a
rendering template leads to following error
Aakashs-MacBook-Pro:infra aakash$ helm template preemptive-killer estafette/estafette-gke-preemptible-killer -f playground/values.yaml
Error: YAML parse error on estafette-gke-preemptible-killer/templates/deployment.yaml: error converting YAML to JSON: yaml: line 48: mapping values are not allowed in this context
Use --debug flag to render out invalid YAML
problem seem to be here,
https://github.com/estafette/estafette-gke-preemptible-killer/blob/main/helm/estafette-gke-preemptible-killer/templates/deployment.yaml#L62
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
value: {{ $value }}
{{- end }}
as per discussion here helm/helm#6251 (comment), it should be
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
I tried the above fix and helm seem to be rendering it correctly!
Thank you