Skip to content

Remove PatchHypervisorStatusWithRetry after all controllers migrated to SSA - #346

Open
fwiesel wants to merge 7 commits into
mainfrom
ssa-cleanup
Open

fwiesel wants to merge 7 commits into
mainfrom
ssa-cleanup

Conversation

@fwiesel

@fwiesel fwiesel commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

With all controllers migrated to Status().Apply(), the last caller of PatchHypervisorStatusWithRetry is gone. Remove the helper and the StatusPatchBackoff it used.

This PR must merge last, after all controller-migration PRs are merged:

The GitHub PR view will show this branch as containing all those commits until they merge into main, at which point only the internal/utils/status_patch.go deletion remains.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@fwiesel, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e71febe4-4950-420f-bc43-730d27402d50

📥 Commits

Reviewing files that changed from the base of the PR and between 71421ef and 2a49eb5.

📒 Files selected for processing (13)
  • internal/controller/aggregates_controller.go
  • internal/controller/eviction_controller.go
  • internal/controller/hypervisor_controller.go
  • internal/controller/hypervisor_maintenance_controller.go
  • internal/controller/hypervisor_maintenance_controller_test.go
  • internal/controller/hypervisor_taint_controller.go
  • internal/controller/offboarding_controller.go
  • internal/controller/onboarding_controller.go
  • internal/controller/ready/controller.go
  • internal/controller/traits_controller.go
  • internal/utils/conditions.go
  • internal/utils/conditions_test.go
  • internal/utils/status_patch.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ssa-cleanup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@fwiesel

fwiesel commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@fwiesel
fwiesel force-pushed the ssa-cleanup branch 2 times, most recently from 03d7f37 to 2a49eb5 Compare July 13, 2026 19:59
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 45 days with no activity.

Replace MergeFromWithOptimisticLock + retry with Status().Apply() for
all eviction status updates. The evictionStatusCfg helper seeds every
apply with the full set of owned fields so SSA never prunes values
between reconcile cycles. As the sole owner of every condition on the
Eviction CR, the reconciler seeds all three condition types on each
apply.

The apply configuration constructor for the cluster-scoped Eviction
resource takes only a name (no namespace).

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace PatchHypervisorStatusWithRetry with Status().Apply() for the
InternalIP scalar and ConditionTypeTerminating condition. Re-fetch the
hypervisor after the status apply so the subsequent spec patch sees a
fresh resourceVersion.

Seed the conditions this controller writes (Terminating and
AgentPodsEvicted) so SSA does not claim ownership over conditions
written by other controllers.

InternalIP falls back to hypervisor.Status.InternalIP when the node
reports no NodeInternalIP. Combined with ForceOwnership, seeding nothing
would prune a previously stored valid IP during transient node states
such as kubelet restarts or bootstrap.

The AgentPodsEvicted=False branch previously returned early with a
requeue before running syncLabelsAndAnnotations, so node label changes
were not propagated to the Hypervisor while terminating. Move the
requeue after the spec patch so labels stay in sync.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace PatchHypervisorStatusWithRetry with Status().Apply() for the
ConditionTypeTainted condition. Only ConditionTypeTainted is seeded
into the apply so SSA does not claim ownership over conditions written
by other controllers.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace PatchHypervisorStatusWithRetry with Status().Apply() for the
ConditionTypeOffboarded condition. Seed only that condition so SSA
does not claim ownership over conditions written by other controllers.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace PatchHypervisorStatusWithRetry with Status().Apply() for
ConditionTypeAggregatesUpdated and the Aggregates slice. The error
path includes the current Aggregates in the apply to prevent SSA from
pruning previously-set values on a transient OpenStack error.

Clearing aggregates to an empty slice uses a targeted merge patch to
work around the omitempty limitation in the generated apply
configuration type.

Seed only ConditionTypeAggregatesUpdated so SSA does not claim
ownership over conditions written by other controllers.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace PatchHypervisorStatusWithRetry with Status().Apply() for
ConditionTypeReady. Seed only that condition so SSA does not claim
ownership over conditions written by other controllers.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
With all controllers migrated to Status().Apply(), the last caller of
PatchHypervisorStatusWithRetry is gone. Remove the helper and the
StatusPatchBackoff it used.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
@github-actions

Copy link
Copy Markdown

Merging this branch changes the coverage (2 decrease, 2 increase)

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 75.16% (-0.28%) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/eviction 67.86% (-0.02%) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/ready 73.21% (+1.28%) 👍
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils 91.18% (+0.93%) 👍
Coverage details

Compared to commit cfee313 (run #43438290245)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/aggregates_controller.go 78.72% (-5.89%) 94 (+29) 74 (+19) 20 (+10) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/eviction/controller.go 67.86% (-0.02%) 196 (+3) 133 (+2) 63 (+1) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_controller.go 78.99% (-1.01%) 119 (-1) 94 (-2) 25 (+1) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_taint_controller.go 90.48% (-2.38%) 21 (+7) 19 (+6) 2 (+1) 👎
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/offboarding_controller.go 73.97% (+1.12%) 73 (+3) 54 (+3) 19 👍
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/ready/controller.go 73.21% (+1.28%) 56 (-1) 41 15 (-1) 👍
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/utils/status_patch.go 0.00% (-85.71%) 0 (-7) 0 (-6) 0 (-1) 💀 💀 💀 💀 💀

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files:

  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/aggregates_controller_test.go
  • github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_controller_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant