kubernetes-sigs / kustomize

Customization of kubernetes YAML configurations
Apache License 2.0
10.93k stars 2.24k forks source link

helmCharts: kyaml fails when encounting helm charts with emty values.yaml files #5720

Open djfinnoy opened 3 months ago

djfinnoy commented 3 months ago

What happened?

After upgrading from 5.3.0 to 5.4.2 we encountered a bug where kustomize has started failing with the following error:

Error: could not parse values file into rnode: EOF 

The bug affects helm charts with an empty values.yaml file. We have a private helm chart where the default values.yaml files that is packaged alongside the chart is empty, and we typically use valuesInline in kustomize to pass values.

# kustomization.yaml

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
  - name: my-libchart
    repo: oci://europe-west1-docker.pkg.dev/my-project/my-chart
    valuesInline:
      someKey: someValue

The issue is that the following function returns an error due to the lack of a populated values.yaml file.

I have found two ways to fix the issue:

What did you expect to happen?

The replaceValuesInline() should tolerate empty helm values files.

How can we reproduce it (as minimally and precisely as possible)?

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

helmCharts:
  - name: my-libchart
    repo: file://path/to/helmchart/with/empty/valuesfile
    valuesInline:
      someKey: someValue

Expected output

No error

Actual output

Error

Kustomize version

5.4.2

Operating system

Linux

k8s-ci-robot commented 3 months ago

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
k8s-triage-robot commented 1 week ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale