Fix indentation of environmentVariables#60
Conversation
When using environmentVariables, the template was being rendered like
this:
```yaml
- name: CLIENT_SECRET
valueFrom:
secretKeyRef:
name: retool
key: google-client-secret
- name: asd
value: asd
- name: zxc
valueFrom:
fieldRef:
fieldKey: asd
```
Notice how the indentation for 'asd' is wrong.
| {{- end }} | ||
| {{- with .Values.environmentVariables }} | ||
| {{ toYaml . | indent 10 }} | ||
| {{ toYaml . | indent 10 }} |
There was a problem hiding this comment.
After helm template retool . -f test-values.yaml
- name: CLIENT_SECRET
valueFrom:
secretKeyRef:
name: retool
key: google-client-secret
- name: asd
value: asd
- name: zxc
valueFrom:
fieldRef:
fieldKey: asdThere was a problem hiding this comment.
oh great catch! I have one request: instead of moving the block leftwards, can you try just gettin grid of the | indent 10 ? It's nice to keep the indentation for the curly brackets so it's easier to reason about
There was a problem hiding this comment.
Unfortunately the indentation is needed because toYAML isn't smart enough to detect and prefix current indentation. So once you hit a newline, the subsequent lines lose the indentation, which generates invalid YAML or invalid k8s manifests:
- name: CLIENT_SECRET
valueFrom:
secretKeyRef:
name: retool
key: google-client-secret
- name: asd
value: asd
- name: zxc
valueFrom:
fieldRef:
fieldKey: asdFor reference, this is already an established pattern elsewhere in this file: https://github.com/tryretool/retool-helm/blob/main/templates/deployment_backend.yaml#L187
| {{- end }} | ||
| {{- with .Values.environmentVariables }} | ||
| {{ toYaml . | indent 10 }} | ||
| {{ toYaml . | indent 10 }} |
There was a problem hiding this comment.
oh great catch! I have one request: instead of moving the block leftwards, can you try just gettin grid of the | indent 10 ? It's nice to keep the indentation for the curly brackets so it's easier to reason about
| {{- end }} | ||
| {{- with .Values.environmentVariables }} | ||
| {{ toYaml . | indent 10 }} | ||
| {{ toYaml . | indent 10 }} |
When using environmentVariables, the template was being rendered like
this:
Notice how the indentation for 'asd' is wrong.