Skip to content

[Bug]: Template Rendering Conflict in Helm Charts #341

@millaguie

Description

@millaguie

Contact Details

the same user as in github [at] icij [dot] org

What happened?

Description

In the way Helm manages the templating system, it might fail if two charts are being rendered simultaneously and those charts have a template with the same name but return different outputs. This issue is encountered when attempting to deploy a neo4j chart and its backup chart in the same deployment. This is a typical scenario when deploying using ArgoCD.

Reproduction Steps

Create a Chart.yaml file with the following content:

---
apiVersion: v2
name: my-app
version: 1.0.0
dependencies:
  - name: neo4j
    repository: https://helm.neo4j.com/neo4j
    version: 5.21.2
  - name: neo4j-admin
    repository: https://helm.neo4j.com/neo4j
    version: 5.21.2

Create a values.yaml file with the following content:

neo4j-admin:
  disableLookups: true
  nodeSelector:
    beta.kubernetes.io/arch: amd64
neo4j:
  disableLookups: true
  neo4j:
    name: "neo4j"
  volumes:
    data:
      mode: "dynamic"
      dynamic:
        storageClassName: default
        requests:
          storage: 10Gi
  nodeSelector:
    beta.kubernetes.io/arch: amd64

Run the following commands:

helm dependency build
helm template . --name-template my-app --namespace my-app --kube-version 1.29 --values values.yaml

Expected Behavior

Both charts should render correctly without conflicts.

Actual Behavior

The following error is encountered:

Error: template: my-app/charts/neo4j/templates/neo4j-statefulset.yaml:84:10: executing "my-app/charts/neo4j/templates/neo4j-statefulset.yaml" at <include "neo4j.nodeSelector" .Values.nodeSelector>: error calling include: template: my-app/charts/neo4j-admin/templates/_labels.tpl:18:41: executing "neo4j.nodeSelector" at <.Values.nodeSelector>: nil pointer evaluating interface {}.nodeSelector

Use --debug flag to render out invalid YAML

Environment

  • Helm Version: v3.12.0 (also tested with v3.15.3, same result)
  • Kubernetes Version: v1.29
  • Helm Charts:
    • neo4j v5.21.2
    • neo4j-admin v5.21.2
  • Deployment Tool: ArgoCD

Possible Solution

A potential solution is to change the name for the neo4j.nodeSelector in the admin chart to neo4j-admin.nodeSelector to avoid conflicts.

Note: The version of the chart I'm using is 5.21.2 but it is not in the list
Note2: the code of conduct link points to https://example.com/ ....

Chart Name

Neo4j

Chart Version

5.12.0

Environment

Amazon Web Services

Relevant log output

Error: template: my-app/charts/neo4j/templates/neo4j-statefulset.yaml:84:10: executing "my-app/charts/neo4j/templates/neo4j-statefulset.yaml" at <include "neo4j.nodeSelector" .Values.nodeSelector>: error calling include: template: my-app/charts/neo4j-admin/templates/_labels.tpl:18:41: executing "neo4j.nodeSelector" at <.Values.nodeSelector>: nil pointer evaluating interface {}.nodeSelector

Use --debug flag to render out invalid YAML

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions