Skip to content

Conversation

@gianlucam76
Copy link
Member

@gianlucam76 gianlucam76 commented Jan 23, 2026

Ensures valuesFrom resources are fully instantiated/templated before calculating the hash used for change detection.

When a Helm chart utilizes valuesFrom (referencing a ConfigMap or Secret) and those resources contain Sveltos templates, Sveltos was previously calculating the hash based on the raw resource content rather than the instantiated content.

Example Scenario: A ConfigMap is used in valuesFrom with template annotations:

apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-values
  annotations:
    projectsveltos.io/template: ok
data:
  values.yaml: |-
    role: "{{ index .Cluster.metadata.annotations.role }}"

If the Cluster annotation role changed, the ConfigMap content itself remained the same (the template string didn't change), causing Sveltos to erroneously conclude that the Helm values were unchanged. Consequently, the Helm release was not updated to reflect the new metadata.

This was visible in the ClusterSummary Status.HelmReleaseSummaries valuesHash not changing:

status:
    dependencies: no dependencies
    featureSummaries:
    - featureID: Helm
      hash: kXmMfsd2tNKNIFA6xxnL+aq7XvIgSa4p36IuMpIRGcs=
      lastAppliedTime: "2026-01-21T07:33:42Z"
      status: Provisioned
    helmReleaseSummaries:
    - releaseName: vso
      releaseNamespace: hashicorp
      status: Managing
      valuesHash: jyi3q9pXIPMP4u7VlrPlq2ByKttMEPsuVW8tZQbl0KI=

This PR modifies the evaluation logic to:

  1. Identify all resources referenced in the valuesFrom section.
  2. Instantiate the content of those resources (resolving any templates) if necessary.
  3. Evaluate the hash based on the final, instantiated values.

This ensures that any change in the underlying data (like Cluster metadata or referenced Secrets) changing the helm values, correctly triggers a Helm reconciliation.

Fixes #1591

@gianlucam76 gianlucam76 force-pushed the valuesfrom-hash branch 4 times, most recently from 8c72dc4 to f6db238 Compare January 25, 2026 10:21
Ensures valuesFrom resources are fully instantiated/templated before
calculating the hash used for change detection.

When a Helm chart utilizes valuesFrom (referencing a ConfigMap or Secret)
and those resources contain Sveltos templates, Sveltos was previously
calculating the hash based on the raw resource content rather than the
instantiated content.

**Example Scenario**: A ConfigMap is used in valuesFrom with template
annotations:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-values
  annotations:
    projectsveltos.io/template: ok
data:
  values.yaml: |-
    role: "{{ index .Cluster.metadata.annotations.role }}"
```

If the Cluster annotation `role` changed, the ConfigMap content itself remained
the same (the template string didn't change), causing Sveltos to erroneously
conclude that the Helm values were unchanged. Consequently, the Helm release
was not updated to reflect the new metadata.

This was visible in the ClusterSummary Status.HelmReleaseSummaries valuesHash
not changing:

```yaml
status:
    dependencies: no dependencies
    featureSummaries:
    - featureID: Helm
      hash: kXmMfsd2tNKNIFA6xxnL+aq7XvIgSa4p36IuMpIRGcs=
      lastAppliedTime: "2026-01-21T07:33:42Z"
      status: Provisioned
    helmReleaseSummaries:
    - releaseName: vso
      releaseNamespace: hashicorp
      status: Managing
      valuesHash: jyi3q9pXIPMP4u7VlrPlq2ByKttMEPsuVW8tZQbl0KI=
```

This PR modifies the evaluation logic to:

1. Identify all resources referenced in the valuesFrom section.
2. Instantiate the content of those resources (resolving any templates) if necessary.
3. Evaluate the hash based on the final, instantiated values.

This ensures that any change in the underlying data
(like Cluster metadata or referenced Secrets) changing the helm values, correctly triggers
a Helm reconciliation.
@gianlucam76 gianlucam76 merged commit f8e594c into projectsveltos:main Jan 25, 2026
23 of 24 checks passed
@gianlucam76 gianlucam76 deleted the valuesfrom-hash branch January 25, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: ValuesFrom expressed as template: helm is not redeployed when instantiated values change but the raw resource content does not change

2 participants