Skip to content

[BUG] fail to build template of subchart with alias #1029

Description

@AvihaiSam

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions