helm.kubebuilder.io/v2-alpha produces invalid YAML
kind/bug
### What broke? What's expected?
Is #5718 back in 4.15.0 ? It seems so....
### Reproducing this issue
From my config/manager/manager.yaml kustomize:
```yaml
....
volumeMounts:
- name: manager-config
mountPath: "/etc/config"
readOnly: true
envFrom:
- secretRef:
name: manager-secrets
volumes:
- name: manager-config
configMap:
name: manager-config
```
I build and lint the chart with:
```bash
kubebuilder edit --plugins=helm.kubebuilder.io/v2-alpha --force --output-dir=helm
helm lint helm/chart --values etc/app-values.yml
```
The `helm lint` fails with:
```
helm lint helm/chart --values etc/app-values.yml --debug
level=DEBUG msg="number of dependencies in the chart" chart=ci-accounts-operator dependencies=0
==> Linting helm/chart
[INFO] Chart.yaml: icon is recommended
[ERROR] templates/manager/manager.yaml: unable to parse YAML: error converting YAML to JSON: yaml: line 83: did not find expected key
```
The chart YAML produced is:
```yaml
volumeMounts:
{{- if .Values.manager.extraVolumeMounts }}
{{- toYaml .Values.manager.extraVolumeMounts | nindent 10 }}
{{- end }}
- mountPath: /etc/config
name: manager-config
readOnly: true
...
volumes:
{{- if .Values.manager.extraVolumes }}
{{- toYaml .Values.manager.extraVolumes | nindent 8 }}
{{- end }}
- configMap:
name: {{ include "ci-accounts-operator.resourceName" (dict "suffix" "manager-config" "context" $) }}
name: manager-config
```
If I remove the non-template values from that chart (i.e., -mountPath and -configMap) `helm lint` passes.
Further, `helm template` produces;
```yaml
volumeMounts:
- mountPath: /etc/config
name: manager-config
readOnly: true
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 10
volumes:
- configMap:
name: ciao-manager-config
name: manager-config
```
### KubeBuilder (CLI) Version
4.15.0
### PROJECT version
"3"
### Plugin versions
```yaml
- go.kubebuilder.io/v4
plugins:
autoupdate.kubebuilder.io/v1-alpha: {}
helm.kubebuilder.io/v2-alpha:
manifests: dist/install.yaml
output: helm
```
### Other versions
go version go1.26.4 linux/amd64
sigs.k8s.io/controller-runtime v0.24.1
kubectl version
Client Version: v1.29.10
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
### Extra Labels
_No response_
1 条评论