Skip to content

Surface helm template errors #282

@stefanprodan

Description

@stefanprodan

I noticed that when Helm encounters a templating error, the controller will not surface this in the Ready status nor in logs.

Given these values:

ingress:
  enabled: true
  hosts:
    - podinfo.production

The Helm CLI errors out with:

$ helm install -f badvalues.yaml mypodinfo ./charts/podinfo/
Error: template: podinfo/templates/ingress.yaml:28:15: executing "podinfo/templates/ingress.yaml" at <.host>: can't evaluate field host in type interface {}

Using the same values in a HelmRelease the controller logs:

{"level":"error","ts":"2021-06-23T14:25:23.845Z","logger":"controller.helmrelease","msg":"Reconciler error","reconciler group":"helm.toolkit.fluxcd.io","reconciler kind":"HelmRelease","name":"podinfo","namespace":"podinfo","error":"Helm uninstall failed: uninstall: Release not loaded: podinfo: release: not found"}
{"level":"error","ts":"2021-06-23T14:28:08.066Z","logger":"controller.helmrelease","msg":"Reconciler error","reconciler group":"helm.toolkit.fluxcd.io","reconciler kind":"HelmRelease","name":"podinfo","namespace":"podinfo","error":"previous release attempt remediation failed"}

The ready status shows no template error:

podinfo  	helmrelease/podinfo	False	Helm uninstall failed: uninstall: Release not loaded: podinfo: release: not found

HelmRelease definition:

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: podinfo
  namespace: podinfo
spec:
  releaseName: podinfo
  chart:
    spec:
      chart: podinfo
      sourceRef:
        kind: HelmRepository
        name: podinfo
        namespace: flux-system
  interval: 5m
  install:
    remediation:
      retries: 3
  values:
    ingress:
      enabled: true
      annotations:
        kubernetes.io/ingress.class: nginx
      hosts:
      - podinfo.production

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/helmHelm related issues and pull requestsbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions