Skip to content

Global post renderer argumetes are not templated with release data after fixing helm defaults #2580

Description

@allanger

Operating system

Fedora 44

Helmfile Version

v1.5.0

Helm Version

v4.1.4

Bug description

In this PR I've made it possible to template the postRendererArgs that are set via helmDefaults: #1839

I needed it because I had to enforce the use of my helm plugin that was developed for tracking who has applied the latest release state: https://github.com/allanger/helm-apply-log

Because helm won't let the post renderer let the release name via the env vars, I had to pass the release name as an argument, so the helmfile setup looked like that:

helmDefaults:
  postRenderer: apply-log
  postRendererArgs:
    - "{{ `{{ .Release.Name }}` }}"

With this I was sure that we will add the apply log to each release that is installed with out helmfile.

In the PR description I've also stated that it might break other ways of setting up the postRendererArgs and wanted to fix them after the feature itself is at least once reviewed. But then pr got reviewed and merged.

It has broken a couple of things: #2508

Actually, the helmDefaults were indeed working, but importing helmDefaults with bases was broken, and also the cli argument was also ignored. And the issues was fixed in this pr: #2510

That has basically reverted my change and made it impossible to template the arguments passed via helmDefaults, so I need to add the apply-log to each release explicitly, that itself is not a very big issue, but it's again impossible to enforce it on the helmfile level.

As I see, a possible solution would be collecting the args with the current logic, but always render them as a template at the final stage.

Or maybe add something like apply-log to the helmfile itself, but I'm not sure if it's a good idea though

Thanks

### Example helmfile.yaml

helmDefaults:
  timeout: 1800
  diffArgs:
    - --dry-run=server
  postRenderer: apply-log
  postRendererArgs:
    - "{{ `{{ .Release.Name }}` }}"

repositories:
  - name: grafana
    url: https://grafana.github.io/helm-charts

releases:
  - name: grafana
    chart: grafana/grafana
    namespace: monitoring
    installed: true
    version: 10.5.15

Error message you've seen (if any)

Steps to reproduce

add helm-apply-log plugin and run helmfile sync

Working Helmfile Version

v1.4.4

Relevant discussion

No response

Metadata

Metadata

Assignees

No one assigned

    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