Skip to content

Migrate HypervisorMaintenanceController to SSA (status + eviction creation) - #339

Open
fwiesel wants to merge 2 commits into
mainfrom
ssa-hypervisor-maintenance
Open

fwiesel wants to merge 2 commits into
mainfrom
ssa-hypervisor-maintenance

Conversation

@fwiesel

@fwiesel fwiesel commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Two commits, both for HypervisorMaintenanceController:

1. Migrate status updates to Server-Side Apply

Server-Side Apply lets the controller own only HypervisorDisabled, Evicting, and Evicted, without overwriting status managed by other controllers.

Nova compute-service failures are reflected as HypervisorDisabled=Unknown before the error is returned for retry. This keeps status useful when a requested transition cannot be completed and prevents eviction from starting when disabling the service fails.

Enabling a compute service also clears forced_down, so a previous HA event cannot leave an enabled service treated as down.

2. Migrate Eviction creation to Server-Side Apply

SSA makes Eviction creation idempotent while preserving labels and owner references. The controller still reads the Eviction after applying it to observe its current status.

Depends on #335.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c32349b0-cd38-4759-954e-e0a94bcd265a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ssa-hypervisor-maintenance

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-hypervisor-maintenance branch from b0ce964 to 1468c0b Compare July 13, 2026 14:52
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 1468c0b to 1adbd01 Compare July 13, 2026 19:59
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 1adbd01 to 103edf5 Compare July 16, 2026 10:11
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 103edf5 to 93b87be Compare July 16, 2026 10:23

@joker-at-work joker-at-work left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As written in DMs, please check if we need to transport the ObservedGeneration into the calls to SetApplyConfigurationStatusCondition to not wipe the previous values or the whole field or its ownership.

@joker-at-work joker-at-work left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ObservedGeneration is unused so my previous comment doesn't matter.

@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch 3 times, most recently from 93d738b to 4cfbe3a Compare September 17, 2026 12:54
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 4cfbe3a to 39dfbca Compare September 17, 2026 13:19
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 39dfbca to 75d66e6 Compare September 17, 2026 13:26
Base automatically changed from ssa-conditions-helpers to main September 21, 2026 07:28
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 75d66e6 to f2acde6 Compare September 21, 2026 08:56
@fwiesel
fwiesel added this pull request to stack #359 September 21, 2026 09:00
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch 4 times, most recently from b4268ca to 4c2679e Compare September 23, 2026 11:23
Server-side apply lets controllers own individual status fields without
overwriting conditions managed elsewhere.

Status must also remain useful when Nova operations fail. Persist the
resulting failure condition before returning the operational error so
users can distinguish a failed transition from the last successful
state.

Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Replace Create + SetControllerReference with Apply for the Eviction CR.
The owner reference and labels are set in the apply configuration
metadata, and SSA handles the upsert. A Get is still performed after
the apply to read the current eviction status conditions.

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>
@fwiesel
fwiesel force-pushed the ssa-hypervisor-maintenance branch from 4c2679e to be49afa Compare September 23, 2026 11:28
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 71.14% (+0.42%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_maintenance_controller.go 85.00% (+4.20%) 120 (-5) 102 (+1) 18 (-6) 👍

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/hypervisor_maintenance_controller_test.go

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.

2 participants