bigbang icon indicating copy to clipboard operation
bigbang copied to clipboard

Per app flux settings don't work when overriding with falsey values

Open p1-repo-sync-bot[bot] opened this issue 1 year ago • 0 comments

When attempting to override anything using a falsey value in a BB template that handles overrides using a sprig merge or mergeOverwrite, the value will remain unchanged.

For example, attempting to override the flux values for gitlab will only work when overridding using truthy values.

Given the following values

flux:
  upgrade:
    remediation:
      retries: 3
      remediateLastFailure: true
    rollback:
      timeout: 10m

addons:
  gitlab:
    flux:
      upgrade:
        remediation:
          retries: 0
          remediateLastFailure: false
    rollback:
      timeout: 5m

And this line in the current gitlab HelmRelease template

{{- $fluxSettingsGitlab := merge .Values.addons.gitlab.flux .Values.flux -}}

Will result in the following value for $fluxSettingsGitlab:

flux:
  upgrade:
    remediation:
      retries: 3
      remediateLastFailure: true
rollback:
  timeout: 5m

since 0 and false are both falsey and 5m is a string which is truthy.

The expected result would be

flux:
  upgrade:
    remediation:
      retries: 0
      remediateLastFailure: false
rollback:
  timeout: 5m

This behavior is not expected to change and is considered a feature in helm

This currently prevents turning off flux features that are defined as true or a positive integer at the top level that need to be disabled on a per app basis.

p1-repo-sync-bot[bot] avatar Dec 12 '23 14:12 p1-repo-sync-bot[bot]