Skip to content

Helm chart: controller.leaderElect=false (and other default-true/zero flags) is silently ignored #941

@akvnn

Description

@akvnn

What happened?

The Helm chart's controller-args template (helm/templates/_controller-args.tpl) emits each controller flag only when its value is truthy:

{{- if .Values.controller.leaderElect }}
- --leader-elect={{ .Values.controller.leaderElect }}
{{- end }}

This conflates "unset" with "explicitly false/0". For flags whose controller default is true (or where 0 is a meaningful value), setting the value to false/0 drops the flag entirely, so the controller silently falls back to its own default.

Concretely, --leader-elect defaults to true in the binary (cmd/agent-sandbox-controller/main.go), so --set controller.leaderElect=false does not disable leader election — the flag is omitted and the controller keeps it enabled. The same footgun affects meaningful zero values, e.g. controller.pprofMutexProfileFraction=0.

How can we reproduce it (as minimally and precisely as possible)?

helm template t ./helm --set image.tag=v0.3.10 --set controller.leaderElect=false \
  --show-only templates/deployment.yaml | grep -A3 'args:'

Observed — the --leader-elect flag is absent from the rendered args:

args:
ports:

Expected — - --leader-elect=false should be rendered so leader election is actually disabled.

Version

main (chart helm/, Chart.yaml version: 0.1.0)

Anything else we need to know?

Flags whose controller default is false are unaffected (omitting them when false is correct). The fix is to render value-bearing flags based on whether the key is set rather than on truthiness. Happy to send a PR — it can also expose two controller flags the chart does not currently surface (--enable-warm-pool-eviction, default true; --sandbox-warm-pool-max-batch-size, default 300), the first of which needs this fix to be disable-able.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Linked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions