helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

needs evaluated even if 'installed: false'

Open jim-barber-he opened this issue 10 months ago • 4 comments

Operating system

Debian stable (12 bookworm)

Helmfile Version

0.163.1

Helm Version

v3.14.4

Bug description

If a release in helmfile.gotmpl.yaml has a needs statement but also its installed directive evaluates to false then the release referenced by the needs still gets installed.

Example helmfile.yaml

For example we had the following where the installed is evaluated on each cluster where only our monitoring cluster sets DEPLOY_ELASTALERT to true. On the other clusters it'll still install the content from the elastalert-additions release even though elastalert is not being installed.

  - name: elastalert-additions
    namespace: elastalert
    chart: ./helm/charts/elastalert-additions
    values:
      - helm/vars/elastalert.yaml.gotmpl
  
  - name: elastalert
    namespace: elastalert
    chart: elastalert2/elastalert2
    installed: {{ (env "DEPLOY_ELASTALERT") | default "false" }}
    labels:
      app: elastalert
    needs:
      - elastalert/elastalert-additions
    values:
      - helm/vars/elastalert.yaml.gotmpl

I can fix this by adding the following to the elastalert-additions release as well:

    installed: {{ (env "DEPLOY_ELASTALERT") | default "false" }}

However then on the clusters where installed evaluates to false the following warning is produced:

WARNING: release elastalert needs elastalert-additions, but elastalert-additions is not installed due to installed: false. Either mark elastalert-additions as installed or remove elastalert-additions from elastalert's needs

Error message you've seen (if any)

No error messages. Just that it is installing "needed" releases for releases where installed: false is in place. Sometimes that in itself can lead to other unrelated errors (say the cluster involved doesn't has the necessary namespace for that release for example). All the detail is above.

Steps to reproduce

See above.

Working Helmfile Version

This probably never worked.

Relevant discussion

No response

jim-barber-he avatar Apr 18 '24 01:04 jim-barber-he