Skip to content

HypervisorController: also detect termination via Node deletion timestamp#334

Open
fwiesel wants to merge 1 commit into
mainfrom
hypervisor-terminating-via-deletion-timestamp
Open

HypervisorController: also detect termination via Node deletion timestamp#334
fwiesel wants to merge 1 commit into
mainfrom
hypervisor-terminating-via-deletion-timestamp

Conversation

@fwiesel

@fwiesel fwiesel commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Gardener is moving away from setting a Terminating node condition and will instead simply delete the Node.

Add node.deletionTimestamp as a second trigger for ConditionTypeTerminating on the Hypervisor, alongside the existing node condition check. Both paths write the same ConditionReasonTerminating reason.

The same dual-check is applied to Spec.Maintenance = MaintenanceTermination seeding at Hypervisor creation time.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 43 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: 8ae58239-60d5-4187-8dcb-955154b3a35d

📥 Commits

Reviewing files that changed from the base of the PR and between 625a902 and 12e7b6b.

📒 Files selected for processing (3)
  • api/v1/hypervisor_types.go
  • internal/controller/hypervisor_controller.go
  • internal/controller/hypervisor_controller_test.go
📝 Walkthrough

Walkthrough

The controller now treats a Node deletion timestamp as an additional termination trigger, propagating it to Hypervisor status and maintenance state. Documentation and controller tests were updated to reflect the standardized terminating reason and new trigger.

Changes

Node termination propagation

Layer / File(s) Summary
Termination detection and propagation
api/v1/hypervisor_types.go, internal/controller/hypervisor_controller.go
Documentation and controller logic recognize both the legacy terminating condition and a non-zero Node deletion timestamp, setting Hypervisor termination state accordingly.
Termination behavior tests
internal/controller/hypervisor_controller_test.go
Tests use kvmv1.ConditionReasonTerminating and cover termination detected solely from a Node deletion timestamp.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Node
  participant HypervisorController
  participant Hypervisor
  Node->>HypervisorController: terminating condition or deletionTimestamp
  HypervisorController->>Hypervisor: set Terminating=True
  HypervisorController->>Hypervisor: set maintenance=Termination on creation
Loading

Possibly related PRs

Suggested reviewers: notandy, mchristianl, joker-at-work

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: HypervisorController now treats Node deletion timestamps as a termination signal.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch hypervisor-terminating-via-deletion-timestamp

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/controller/hypervisor_controller_test.go`:
- Around line 321-333: Fix gofmt formatting in
internal/controller/hypervisor_controller_test.go: align the “and the Hypervisor
resource does exists” Context with its sibling Context nested under the parent
Context, and indent the blocks around lines 368-403 and 633-640 to the correct
nesting level inside their respective test blocks. Run gofmt on the file and
verify the formatting check passes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a92c27a9-0019-4460-975b-bbd909e746c2

📥 Commits

Reviewing files that changed from the base of the PR and between 14a4933 and 625a902.

📒 Files selected for processing (3)
  • api/v1/hypervisor_types.go
  • internal/controller/hypervisor_controller.go
  • internal/controller/hypervisor_controller_test.go

Comment thread internal/controller/hypervisor_controller_test.go Outdated
@fwiesel fwiesel force-pushed the hypervisor-terminating-via-deletion-timestamp branch from 625a902 to 2c802f9 Compare July 10, 2026 11:52
…tamp

Gardener is moving away from setting a Terminating node condition and will
instead simply delete the Node. Add node.deletionTimestamp as a second trigger
for the Terminating condition on the Hypervisor, alongside the existing legacy
node condition check. Both inputs produce the same result: ConditionTypeTerminating=True
with ConditionReasonTerminating.

The same dual-check is applied to the Spec.Maintenance seeding on first
Hypervisor creation, so a node that is already being deleted when its Hypervisor
CR is first created correctly enters MaintenanceTermination.
@fwiesel fwiesel force-pushed the hypervisor-terminating-via-deletion-timestamp branch from 2c802f9 to 12e7b6b Compare July 10, 2026 11:54
@github-actions

Copy link
Copy Markdown

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1 0.00% (ø)
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller 68.91% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1/hypervisor_types.go 0.00% (ø) 0 0 0
github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/controller/hypervisor_controller.go 80.00% (ø) 120 96 24

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_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.

1 participant