Skip to content

helm-operator: record observedGeneration in the custom resource status - #7153

Open
TarasLykhenko wants to merge 1 commit into
operator-framework:masterfrom
TarasLykhenko:helm-observed-generation
Open

TarasLykhenko wants to merge 1 commit into
operator-framework:masterfrom
TarasLykhenko:helm-observed-generation

Conversation

@TarasLykhenko

@TarasLykhenko TarasLykhenko commented Nov 12, 2026 •

Copy link
Copy Markdown

Description of the change:

The Helm operator now sets status.observedGeneration to the custom resource's metadata.generation on every status write, following the Kubernetes API conventions.

The generation is set right after the status is read and before any condition changes. So:

  • every status write (install, upgrade, reconcile, and the ReleaseFailed and Irreconcilable failure paths) records the generation it describes;
  • a spec change that needs no release upgrade still produces a status write, because the stored status now differs from the new one in observedGeneration. Before this change, reflect.DeepEqual(status, originalStatus) skipped that write.

The field is additive and omitempty.

Motivation for the change:

Today the status holds only conditions and deployedRelease, so a client can't tell whether Deployed=True describes the current spec or an earlier one. After a spec update, the previous Deployed=True stays until the operator reconciles the change. If the operator is down or stuck, it stays indefinitely. A client that waits on Deployed=True before acting, for example a controller that installs a chart through a Helm-based operator, reports ready for a spec that was never applied.

With observedGeneration, a client treats the status as current only when status.observedGeneration == metadata.generation.

The same request is open against helm-operator-plugins: operator-framework/helm-operator-plugins#577.

Testing:

TestReconcileSetsObservedGeneration in internal/helm/controller/reconcile_test.go runs Reconcile with a fake client and a fake release manager for install, upgrade, a spec change with no release change, and a Sync failure. Each case checks that the stored status has observedGeneration equal to the resource's generation. All four fail without the change.

Checklist

  • Add a changelog fragment
  • Add tests

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 12, 2026
@TarasLykhenko
TarasLykhenko force-pushed the helm-observed-generation branch 3 times, most recently from 7001cd2 to f2e3e32 Compare November 12, 2026 14:55
@TarasLykhenko
TarasLykhenko marked this pull request as ready for review November 12, 2026 14:55
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 12, 2026
The Helm operator now sets status.observedGeneration to the custom
resource's metadata.generation on every status write, so clients can
tell whether the conditions and deployedRelease describe the current
spec or an earlier one.

The generation is set before any condition changes, so failure paths
record it too, and a spec change that needs no release upgrade still
produces a status write.

Signed-off-by: TarasLykhenko <18290033+TarasLykhenko@users.noreply.github.com>
@TarasLykhenko
TarasLykhenko force-pushed the helm-observed-generation branch from f2e3e32 to 58fc4df Compare November 12, 2026 14:57
@TarasLykhenko TarasLykhenko changed the title helm: record observedGeneration in the custom resource status helm-operator: record observedGeneration in the custom resource status Nov 12, 2026

This branch has not been deployed

No deployments
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.

1 participant