chart-testing icon indicating copy to clipboard operation
chart-testing copied to clipboard

"nil pointer evaluating interface" when using "import-values" in Chart.yaml's dependencies

Open FraBle opened this issue 4 years ago • 0 comments

Is this a request for help?: No


Is this a BUG REPORT or FEATURE REQUEST? (choose one): BUG REPORT

Version of Helm and Kubernetes:

$ helm version
version.BuildInfo{Version:"v3.6.1", GitCommit:"61d8e8c4a6f95540c15c6a65f36a6dd0a45e7a2f", GitTreeState:"dirty", GoVersion:"go1.16.5"}
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:53:14Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}
$ ct version
Version:	 3.4.0
Git commit:	 68a43ac09699ef9473266457e893a7ddd7ef6b5b
Date:		 2021-05-22
License:	 Apache 2.0

What happened:

I'm declaring import-values in the Chart.yaml of my chart to allow my chart's templates "access values that are not contained in the exports key of the child chart’s values" (docs).

Chart.yaml:

...
dependencies:
  - name: spark
    version: 5.5.3
    repository: https://charts.bitnami.com/bitnami
    import-values:
      - child: master
        parent: bullet.sparkBackend.cluster
...

templates/deployment.yaml

...
{{ printf "spark://%s-spark-master-svc:%g" .Chart.Name .Values.bullet.sparkBackend.cluster.clusterPort }}
...

The execution of ct does not import the values correctly and errors with

[ERROR] templates/: template: my-chart/templates/deployment.yaml:43:76: executing "my-chart/templates/deployment.yaml" at <.Values.bullet.sparkBackend.cluster.clusterPort>: nil pointer evaluating interface {}.clusterPort

The value does exist though: https://github.com/bitnami/charts/blob/master/bitnami/spark/values.yaml#L59

What you expected to happen: No errors as the my chart is valid and can be installed with helm.

How to reproduce it (as minimally and precisely as possible): See code snippets above

Anything else we need to know:

ct.yaml:

remote: origin
target-branch: main
chart-dirs:
  - charts
chart-repos:
  - bitnami=https://charts.bitnami.com/bitnami
helm-extra-args: --timeout 600s

FraBle avatar Jun 30 '21 05:06 FraBle