Skip to content

subhelmfiles should only be evaluated if their selectors match #2544

Description

@max06

Operating system

any

Helmfile Version

1.4.3

Helm Version

v4.1.3

Bug description

A helmfile containing a helmfiles directive with selectors for each entry gets always fully evaluated during build/template even if matching selectors are provided, potentially requiring a lot more time depending on the contents of each subhelmfile.

Running helmfile template -l name=b with the following example takes (almost) the same time as running helmfile template. The subhelmfile is fully evaluated, only the releases contained are spared.

My subhelmfiles contain large templates rendering releases-blocks with fully evaluated values, since the logic provided by helmfile is not sufficient for my needs - giving up my templates is not an option. Because the selectors are not exposed in the context, I can't skip rendering based on their values. This might be fine for <10 subhelmfiles, but it gets worse with each new subhelmfile added. A workflow rendering diffs for each subhelmfile in the project separately gets really expensive. My current workaround is providing selectors using state-values, requiring me to skip helm schema validation.

Example helmfile.yaml

helmfiles:
- path: path/to/subhelmfile-a.yaml
  selectors:
  - name=a
- path: path/to/subhelmfile-b.yaml
  selectors:
  - name=b
- path: path/to/subhelmfile-c.yaml
  selectors:
  - name=c

Error message you've seen (if any)

No error

Steps to reproduce

none

Working Helmfile Version

none

Relevant discussion

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions