Skip to content

helm diff fails on NOTES.txt due to unguarded lookup function #346

@hanxer

Description

@hanxer

The devtron-operator chart's NOTES.txt template uses Helm's lookup function without nil checking, causing helm diff to fail with a type error.

Error:
Error: Failed to render chart: exit status 1: Error: template: devtron-operator/templates/NOTES.txt:3:58: executing "devtron-operator/templates/NOTES.txt" at <$liveCm.data>: wrong type for
value; expected map[string]interface {}; got interface {}

Environment:

  • Chart version: 0.23.0
  • Helm version: 3.x
  • helm-diff plugin version: latest
  • Kubernetes: 1.32

Steps to Reproduce:

  1. Install devtron-operator chart
  2. Run helm diff upgrade devtron devtron/devtron-operator -n devtroncd

Root Cause:

Helm's lookup function returns nil during helm diff / helm template operations because these commands don't query the Kubernetes API server by design. When NOTES.txt accesses $liveCm.data
without checking if $liveCm is nil, the template fails.

Reference: databus23/helm-diff#263

Suggested Fix:

Add nil guards in templates/NOTES.txt:

{{- $liveCm := lookup "v1" "ConfigMap" .Release.Namespace "configmap-name" }}
{{- if $liveCm }}
{{- if $liveCm.data }}
{{/* safe to access $liveCm.data here */}}
{{- end }}
{{- end }}

Impact:

Users cannot use helm diff or helmfile apply (which uses helm-diff) with this chart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions