I'm trying to add the following line from values.yaml to the deployment with spaces. But I couldn't.
in values.yaml
affinityNode: |
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodepool
operator: In
values:
- loadbalancer-pool
in deployment.yaml
{{- toYaml .Values.affinityNode }}
You could just use normal yaml key pairs instead of a multiline string in your values file:
values.yaml
affinityNode:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: nodepool
operator: In
values:
- loadbalancer-pool
deployment.yaml
{{- with .Values.affinityNode }}
{{ toYaml . | nindent 8 }} # <- use nindent to fix indentation
{{- end }}
But if you want to keep things as is just add a fromYaml
statement:
{{- fromYaml .Values.affinityNode | toYaml }}