Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
millaguie opened this issue Jul 16, 2024 · 2 comments
Open
1 task done

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

millaguie opened this issue Jul 16, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@millaguie
Copy link

millaguie commented Jul 16, 2024

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
@millaguie millaguie added the bug Something isn't working label Jul 16, 2024
@ikwattro
Copy link

👀

@justinr1234
Copy link

I'm having this exact issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants