Skip to content

OCPBUGS-113991: Scope forced NodePool cleanup to the target cluster - #9398

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix/force-destroy-nodepool-scope
Aug 26, 2026
Merged

OCPBUGS-113991: Scope forced NodePool cleanup to the target cluster#9398
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
bryan-cox:fix/force-destroy-nodepool-scope

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Aug 25, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Limits hypershift destroy cluster --force finalizer removal to NodePools whose spec.clusterName matches the HostedCluster being destroyed.

Previously, force cleanup listed every NodePool in the shared HostedCluster namespace and stripped finalizers from all of them. This was observed in the Azure deprovisioner rehearsal, which processed 186 NodePools and modified NodePools belonging to unrelated HostedClusters.

Which issue(s) this PR fixes:

Fixes OCPBUGS-113991.

Special notes for your reviewer:

The regression test includes a NodePool owned by another HostedCluster and verifies that its finalizer remains intact.

Validation:

  • GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./cmd/cluster/core/... ./cmd/cluster/azure/...
  • make run-gitlint

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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 Aug 25, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 25, 2026

Copy link
Copy Markdown

@bryan-cox: This pull request references CNTRLPLANE-3943 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target either version "5.1.0." or "openshift-5.1.0.", but it targets "openshift-5.0" instead.

Details

In response to this:

What this PR does / why we need it:

Limits hypershift destroy cluster --force finalizer removal to NodePools whose spec.clusterName matches the HostedCluster being destroyed.

Previously, force cleanup listed every NodePool in the shared HostedCluster namespace and stripped finalizers from all of them. This was observed in the Azure deprovisioner rehearsal, which processed 186 NodePools and modified NodePools belonging to unrelated HostedClusters.

Which issue(s) this PR fixes:

Follow-up to CNTRLPLANE-3943.

Special notes for your reviewer:

The regression test includes a NodePool owned by another HostedCluster and verifies that its finalizer remains intact.

Validation:

  • GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./cmd/cluster/core/... ./cmd/cluster/azure/...

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added do-not-merge/needs-area area/cli Indicates the PR includes changes for CLI approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/needs-area labels Aug 25, 2026
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 32b31db3-39a2-45fe-be3e-fc83c3165f93

📥 Commits

Reviewing files that changed from the base of the PR and between f0ad3e0 and 31bbae2.

📒 Files selected for processing (1)
  • cmd/cluster/core/destroy_test.go

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

Force cleanup now lists NodePools and removes finalizers only when Spec.ClusterName matches the target HostedCluster. It ignores unavailable NodePool CRDs and aggregates cleanup errors. The force cleanup path uses this filtered helper. Tests add an unrelated NodePool and verify that it retains its original finalizer.

🚥 Pre-merge checks | ✅ 10 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The added Gomega regression test uses assertions without meaningful failure messages. In cmd/cluster/core/destroy_test.go, lines 385, 389-390, and 394-395 call g.Expect(...).To... without messages… Add meaningful diagnostic messages to every new or modified assertion, including the list error, each c.Get error, and the expected finalizer state for both the matching and unrelated NodePools.
✅ Passed checks (10 passed)
Check name Status Explanation
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.
Stable And Deterministic Test Names ✅ Passed The pull request adds one subtest title: "When NodePools belong to different HostedClusters, it should only strip finalizers from matching NodePools". The title is a static descriptive string. It cont…
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The pull request changes cmd/cluster/core/destroy.go and its tests only. The code filters NodePools by Spec.ClusterName before removing finalizers. It does not add or modify deployment manif…
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The pull request adds standard Go unit tests with testing.T and t.Run, not Ginkgo e2e tests. The tests use a controller-runtime fake client and in-memory NodePool objects. The diff adds no I…
No-Weak-Crypto ✅ Passed PASS: The PR changes only NodePool finalizer filtering and related tests. The complete diff adds no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparison code. The change…
Container-Privileges ✅ Passed PASS. The pull request changes only cmd/cluster/core/destroy.go and destroy_test.go, both Go files. The code scopes NodePool finalizer removal by Spec.ClusterName; it does not add or modify a co…
No-Sensitive-Data-In-Logs ✅ Passed PASS: The implementation changes only NodePool filtering. The new log records the resource type, namespace, and matching-resource count. It does not record passwords, tokens, API keys, PII, session ID…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: limiting forced NodePool cleanup to the target cluster.
Full details: Stable And Deterministic Test Names

Explanation

The pull request adds one subtest title: "When NodePools belong to different HostedClusters, it should only strip finalizers from matching NodePools". The title is a static descriptive string. It contains no generated names, timestamps, UUIDs, node names, namespaces with random suffixes, IP addresses, or dynamic string construction. The changed test data places identifiers only in the test body.

Full details: Test Structure And Quality

Explanation

The added Gomega regression test uses assertions without meaningful failure messages. In cmd/cluster/core/destroy_test.go, lines 385, 389-390, and 394-395 call g.Expect(...).To... without messages. The modified test also adds the same pattern at lines 198-199. This matches the check's explicit failure example. The test has one focused behavior, uses an isolated fake client, creates no cluster-scoped resources, and has no wait operation that requires a timeout.

Full details: Topology-Aware Scheduling Compatibility

Explanation

PASS: The pull request changes cmd/cluster/core/destroy.go and its tests only. The code filters NodePools by Spec.ClusterName before removing finalizers. It does not add or modify deployment manifests, operators, controllers, replicas, affinity, topology spread, node selectors, tolerations, or PDBs. The topology-aware scheduling check is therefore not applicable.

Full details: Ipv6 And Disconnected Network Test Compatibility

Explanation

PASS: The pull request adds standard Go unit tests with testing.T and t.Run, not Ginkgo e2e tests. The tests use a controller-runtime fake client and in-memory NodePool objects. The diff adds no IPv4 addresses, IP parsing, URL construction, DNS resolution, external hosts, image pulls, or external network calls.

Full details: No-Weak-Crypto

Explanation

PASS: The PR changes only NodePool finalizer filtering and related tests. The complete diff adds no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom crypto, or secret/token comparison code. The changed source imports no crypto packages.

Full details: Container-Privileges

Explanation

PASS. The pull request changes only cmd/cluster/core/destroy.go and destroy_test.go, both Go files. The code scopes NodePool finalizer removal by Spec.ClusterName; it does not add or modify a container or Kubernetes manifest. No changed lines contain privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, or allowPrivilegeEscalation. The check's failure conditions are not introduced.

Full details: No-Sensitive-Data-In-Logs

Explanation

PASS: The implementation changes only NodePool filtering. The new log records the resource type, namespace, and matching-resource count. It does not record passwords, tokens, API keys, PII, session IDs, hostnames, or customer data. stripFinalizers still logs only resource kind, namespace, and name, and the change reduces this logging for unrelated NodePools. The diff contains no sensitive logging additions.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Only strip finalizers from NodePools belonging to the HostedCluster being destroyed.
Preserve unrelated NodePools in the shared HostedCluster namespace.

Commit-Message-Assisted-by: Claude (via Claude Code)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Bryan Cox <brcox@redhat.com>
@bryan-cox
bryan-cox force-pushed the fix/force-destroy-nodepool-scope branch from f0ad3e0 to 31bbae2 Compare August 25, 2026 19:43
@bryan-cox
bryan-cox marked this pull request as ready for review August 25, 2026 19:45
@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 Aug 25, 2026
@openshift-ci
openshift-ci Bot requested review from vismishr and vsolanki12 August 25, 2026 19:45
@bryan-cox bryan-cox changed the title CNTRLPLANE-3943: Scope forced NodePool cleanup to the target cluster OCPBUGS-113991: Scope forced NodePool cleanup to the target cluster Aug 25, 2026
@openshift-ci-robot openshift-ci-robot added the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label Aug 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request references Jira Issue OCPBUGS-113991, which is invalid:

  • expected the bug to target either version "5.1.0." or "openshift-5.1.0.", but it targets "5.0.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

What this PR does / why we need it:

Limits hypershift destroy cluster --force finalizer removal to NodePools whose spec.clusterName matches the HostedCluster being destroyed.

Previously, force cleanup listed every NodePool in the shared HostedCluster namespace and stripped finalizers from all of them. This was observed in the Azure deprovisioner rehearsal, which processed 186 NodePools and modified NodePools belonging to unrelated HostedClusters.

Which issue(s) this PR fixes:

Fixes OCPBUGS-113991.

Special notes for your reviewer:

The regression test includes a NodePool owned by another HostedCluster and verifies that its finalizer remains intact.

Validation:

  • GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./cmd/cluster/core/... ./cmd/cluster/azure/...
  • make run-gitlint

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.18%. Comparing base (94167e7) to head (31bbae2).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
cmd/cluster/core/destroy.go 60.00% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9398   +/-   ##
=======================================
  Coverage   46.18%   46.18%           
=======================================
  Files         783      783           
  Lines       98429    98448   +19     
=======================================
+ Hits        45455    45466   +11     
- Misses      49896    49902    +6     
- Partials     3078     3080    +2     
Files with missing lines Coverage Δ
cmd/cluster/core/destroy.go 35.43% <60.00%> (+1.50%) ⬆️
Flag Coverage Δ
cmd-support 39.78% <60.00%> (+0.01%) ⬆️
cpo-hostedcontrolplane 48.31% <ø> (ø)
cpo-other 46.11% <ø> (ø)
hypershift-operator 57.13% <ø> (ø)
other 34.71% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bryan-cox

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Aug 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This pull request references Jira Issue OCPBUGS-113991, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.1.0) matches configured target version for branch (5.1.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Aug 25, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws
/test e2e-v2-azure-self-managed
/test e2e-v2-gke

@openshift-ci

openshift-ci Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, csrwng

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@bryan-cox

Copy link
Copy Markdown
Member Author

/verified by UT

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Aug 25, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This PR has been marked as verified by UT.

Details

In response to this:

/verified by UT

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox

Copy link
Copy Markdown
Member Author

/test e2e-aks

@cwbotbot

cwbotbot commented Aug 25, 2026

Copy link
Copy Markdown

Test Results

e2e-aks

e2e-aws

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 7a31335 and 2 for PR HEAD 31bbae2 in total

@bryan-cox

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-v2-azure-self-managed

The Azure deprovisioner is causing issues without this.

@bryan-cox

Copy link
Copy Markdown
Member Author

/verified by e2es passing

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-v2-azure-self-managed

Details

In response to this:

/override ci/prow/e2e-v2-azure-self-managed

The Azure deprovisioner is causing issues without this.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: This PR has been marked as verified by e2es passing.

Details

In response to this:

/verified by e2es passing

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

/retest-required

Remaining retests: 0 against base HEAD 8e91adf and 1 for PR HEAD 31bbae2 in total

@bryan-cox

Copy link
Copy Markdown
Member Author

/override ci/prow/e2e-v2-azure-self-managed

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-v2-azure-self-managed

Details

In response to this:

/override ci/prow/e2e-v2-azure-self-managed

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci

openshift-ci Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot
openshift-merge-bot Bot merged commit 0b61ee9 into openshift:main Aug 26, 2026
43 checks passed
@openshift-ci-robot

Copy link
Copy Markdown

@bryan-cox: Jira Issue Verification Checks: Jira Issue OCPBUGS-113991
✔️ This pull request was pre-merge verified.
✔️ All associated pull requests have merged.
✔️ All associated, merged pull requests were pre-merge verified.

Jira Issue OCPBUGS-113991 has been moved to the MODIFIED state and will move to the VERIFIED state when the change is available in an accepted nightly payload. 🕓

Details

In response to this:

What this PR does / why we need it:

Limits hypershift destroy cluster --force finalizer removal to NodePools whose spec.clusterName matches the HostedCluster being destroyed.

Previously, force cleanup listed every NodePool in the shared HostedCluster namespace and stripped finalizers from all of them. This was observed in the Azure deprovisioner rehearsal, which processed 186 NodePools and modified NodePools belonging to unrelated HostedClusters.

Which issue(s) this PR fixes:

Fixes OCPBUGS-113991.

Special notes for your reviewer:

The regression test includes a NodePool owned by another HostedCluster and verifies that its finalizer remains intact.

Validation:

  • GO111MODULE=on GOWORK=off GOFLAGS=-mod=vendor go test -race ./cmd/cluster/core/... ./cmd/cluster/azure/...
  • make run-gitlint

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Always review AI generated responses prior to use.
Generated with Claude Code via openshift-developer plugin

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox
bryan-cox deleted the fix/force-destroy-nodepool-scope branch August 26, 2026 11:56
@openshift-merge-robot

Copy link
Copy Markdown
Contributor

Fix included in release 5.1.0-0.nightly-2026-08-27-012048

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/cli Indicates the PR includes changes for CLI jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants