Skip to content

Unexpected behaviour while using preserveValues #1371

@bhargavi-raghupathy

Description

@bhargavi-raghupathy

Background
When we upgrade Helm release with HelmRelease CR preserveValues: true option, helm-controller is not able to handle it properly, causing repetitive helm upgrade operations

HelmRelease CR
Version: 1

apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: gitrepo-nginx
  namespace: helm-system
spec:
  interval: 5m
  upgrade:
    preserveValues: true
  chart:
    spec:
      chart: ./helm-charts/test-nginx
      sourceRef:
        kind: GitRepository
        name: nginx-gitrepo
        namespace: helm-system
  values:
    replicaCount: 7
    containerPort: 80

Version: 2

apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: gitrepo-nginx
  namespace: helm-system
spec:
  interval: 5m
  upgrade:
    preserveValues: true
  chart:
    spec:
      chart: ./helm-charts/test-nginx
      sourceRef:
        kind: GitRepository
        name: nginx-gitrepo
        namespace: helm-system
  values:
    replicaCount: 2

HelmRelease spec is applied one after the other.

Expected Behavior
When the second chart is applied with preserveValues enabled, reconciliation should not trigger a Helm upgrade because there is no change in the effective values. The replicaCount remains the same (2), and the containerPort will be reused from version 1 (80).

Actual Behavior
The Helm controller detects a change in the spec and repeatedly triggers upgrade operations because the latest HelmRelease history configDigest differs from the values in the spec. The configDigest includes both replicaCount and containerPort—since Helm reuses these values—while the spec contains only replicaCount. This mismatch leads the Helm controller to believe there is a discrepancy.

Details
Logs

{"level":"info","ts":"2025-12-10T17:53:54.331Z","msg":"release out-of-sync with desired state: release config values changed","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"xxx"}
{"level":"info","ts":"2025-12-10T17:53:54.335Z","msg":"running 'upgrade' action with timeout of 5m0s","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"xxx"}
{"level":"info","ts":"2025-12-10T17:53:54.537Z","msg":"release in-sync with desired state","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"xxx"}
...
{"level":"info","ts":"2025-12-10T18:03:49.889Z","msg":"release out-of-sync with desired state: release config values changed","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"yyy"}
{"level":"info","ts":"2025-12-10T18:03:49.893Z","msg":"running 'upgrade' action with timeout of 5m0s","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"yyy"}
{"level":"info","ts":"2025-12-10T18:03:50.094Z","msg":"release in-sync with desired state","controller":"helmrelease","controllerGroup":"helm.toolkit.fluxcd.io","controllerKind":"HelmRelease","HelmRelease":{"name":"gitrepo-nginx","namespace":"helm-system"},"namespace":"helm-system","name":"gitrepo-nginx","reconcileID":"yyy"}

HelmRelease CR

Namespace:    helm-system
Labels:       <none>
Annotations:  <none>
API Version:  helm.toolkit.fluxcd.io/v2
Kind:         HelmRelease
Metadata:
  Creation Timestamp:  2025-12-10T17:53:06Z
  Finalizers:
    finalizers.fluxcd.io
  Generation:        2
  ...
Spec:
  Chart:
    Spec:
      Chart:               ./helm-charts/test-nginx
      Reconcile Strategy:  ChartVersion
      Source Ref:
        Kind:       GitRepository
        Name:       nginx-gitrepo
        Namespace:  helm-system
  Interval:  5m
  Upgrade:
    Preserve Values:  true
    Remediation:
      Retries:  1
  Values:
    Replica Count:  2
Status:
  Conditions:
    Last Transition Time:  2025-12-10T18:08:58Z
    Message:               Helm upgrade succeeded for release helm-system/gitrepo-nginx.v4 with chart [email protected]+1
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Ready
    Last Transition Time:  2025-12-10T18:08:58Z
    Message:               Helm upgrade succeeded for release helm-system/gitrepo-nginx.v4 with chart [email protected]+1
    Observed Generation:   2
    Reason:                UpgradeSucceeded
    Status:                True
    Type:                  Released
  Helm Chart:              helm-system/helm-system-gitrepo-nginx
  History:
    Chart Name:                   nginx-chart-mgmt-1
    Chart Version:                0.5.2+1
    Config Digest:                sha256:496bf56e4240686807d4c20b4c74e2c4b1bb5a95acaf3f803b073a9dc5be067a
    Digest:                       sha256:cb7f81050e65a6d0ddb64d5055468a655841c0821a7a079a43004089130c3f27
    First Deployed:               2025-12-10T17:53:09Z
    Last Deployed:                2025-12-10T18:08:58Z
    Name:                         gitrepo-nginx
    Namespace:                    helm-system
    Status:                       deployed
    Version:                      4
    ...
  Last Attempted Config Digest:   sha256:e15c415d62760896bd8bec192a44c5716dc224db9e0fc609b9ac14718f8f9e56
  Last Attempted Generation:      2
  Last Attempted Release Action:  upgrade
  Last Attempted Revision:        0.5.2+1
  Observed Generation:            2
  Storage Namespace:              helm-system

Helm

REVISION	UPDATED                 	STATUS    	CHART                     	APP VERSION	DESCRIPTION
1       	Wed Dec 10 17:53:09 2025	superseded	nginx-chart-mgmt-1-0.5.2+1	1.25.3     	Install complete
2       	Wed Dec 10 17:53:54 2025	superseded	nginx-chart-mgmt-1-0.5.2+1	1.25.3     	Upgrade complete
3       	Wed Dec 10 18:03:49 2025	deployed  	nginx-chart-mgmt-1-0.5.2+1	1.25.3     	Upgrade complete

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions