kube-linter icon indicating copy to clipboard operation
kube-linter copied to clipboard

[BUG] fail to build template of subchart with alias

Open AvihaiSam opened this issue 4 months ago • 1 comments

System info:

  • OS: MaxOS

Describe the bug I have set a subchart wich contains '-' on it's name, so aliased it to another name In the parent chart I use an include block which takes an helper from the subchart, The desired helper sets and uses local $name variable.

When running lint cmd -

Warning: failed to load object from my-chartcharts/etl-spark: failed to render: template: etl-spark/templates/network-policy.yaml:5:11: executing "etl-spark/templates/network-policy.yaml" at <include "spark-operator.controller.name" .Subcharts.sparkOperator>: error calling include: template: etl-spark/charts/spark-operator/templates/controller/_helpers.tpl:21:4: executing "spark-operator.controller.name" at <include "spark-operator.fullname" .>: error calling include: template: etl-spark/charts/spark-operator/templates/_helpers.tpl:35:16: executing "spark-operator.fullname" at <$name>: invalid value; expected string Warning: no valid objects found.

To Reproduce Steps to reproduce the behavior:

  1. in Chart.yaml:
dependencies:
  - name: spark-operator
    alias: sparkOperator
    version: 2.3.0
    repository: "https://kubeflow.github.io/spark-operator"
  1. in any template use {{ include "spark-operator.controller.name" .Subcharts.sparkOperator }}
  2. run kube-linter lint

Expected behavior kube-linter should not fail

Workaround

remove the alias and use {{ include "spark-operator.controller.name" (index .Subcharts "spark-operator") }} but you must then also use (index .Values "spark-operator") whenever you want to reference any value from spark-operator

AvihaiSam avatar Sep 25 '25 15:09 AvihaiSam

Could you post the whole chart to make it easier to reproduce this issue?

janisz avatar Oct 09 '25 09:10 janisz