OCPBUGS-93739: skip LB Service deletion in HCCO for AWS and actively clean up NLBs during e2e teardown#9052
OCPBUGS-93739: skip LB Service deletion in HCCO for AWS and actively clean up NLBs during e2e teardown#9052vsolanki12 wants to merge 2 commits into
Conversation
On AWS, the HCCO previously deleted all non-IngressController-owned LoadBalancer Services during cloud resource teardown, triggering the cloud controller to asynchronously delete the backing NLBs. This async path is non-deterministic and frequently exceeds the e2e teardown validation timeout for complex topologies (HA, multi-zone, 5+ node pools). Skip LoadBalancer Service deletion for AWS. The NLBs are cleaned up directly via the AWS API in the infrastructure destroy flow (DestroyV1ELBs/DestroyV2ELBs), which is faster and deterministic. Non-AWS platforms retain the existing behavior. Signed-off-by: Vimal Solanki <vsolanki@redhat.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@vsolanki12: This pull request references Jira Issue OCPBUGS-93739, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to 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 openshift-eng/jira-lifecycle-plugin repository. |
|
Skipping CI for Draft Pull Request. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAWS cloud resource destruction now skips LoadBalancer Service deletion and waiting on AWS, while preserving existing behavior for other platforms. A unit test verifies this behavior. AWS guest-resource validation now creates an ELBv2 client and actively deletes tagged ELB/NLB resources during each polling iteration, with terminal and retryable deletion errors handled separately. Sequence Diagram(s)sequenceDiagram
participant CleanupValidation
participant TaggedResources
participant deleteTaggedLoadBalancers
participant ELBv2
CleanupValidation->>TaggedResources: Read tagged resource mappings
CleanupValidation->>deleteTaggedLoadBalancers: Delete tagged load balancers
deleteTaggedLoadBalancers->>ELBv2: DeleteLoadBalancer
CleanupValidation->>TaggedResources: Check remaining guest resources
Suggested reviewers: 🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: vsolanki12 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@vsolanki12: This pull request references Jira Issue OCPBUGS-93739, which is valid. 3 validation(s) were run on this bug
DetailsIn response to 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 openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@test/e2e/util/fixture.go`:
- Around line 410-429: Add a small consumer-side interface for the
DeleteLoadBalancer operation and update deleteTaggedLoadBalancers to depend on
it. Add unit tests covering valid ELB/NLB ARN deletion, non-load-balancer ARN
filtering, malformed ARN handling, and DeleteLoadBalancer failures without
making real AWS calls.
- Around line 423-427: Update deleteTaggedLoadBalancers so DeleteLoadBalancer
errors are classified, returning terminal AWS failures immediately instead of
logging and retrying them until the poll timeout. Keep retries only for
explicitly transient errors, and preserve the existing retry logging and cleanup
behavior for those cases.
🪄 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: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 71540313-ab96-4835-9db9-617634628e52
📒 Files selected for processing (3)
control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.gotest/e2e/util/fixture.go
f520b09 to
f1e43fd
Compare
There was a problem hiding this comment.
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 `@test/e2e/util/fixture_test.go`:
- Around line 16-26: Update fakeLoadBalancerDeleter to record every attempted
ARN and return configurable errors per call instead of one shared error. Expand
the transient-error test cases to use two mappings and assert both ARNs are
attempted, while terminal-error cases assert only the first ARN is attempted,
covering the continuation and fail-fast behavior required by the fixture
deletion flow.
🪄 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: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 047787df-2787-4a76-8cef-77064cfa40a8
📒 Files selected for processing (2)
test/e2e/util/fixture.gotest/e2e/util/fixture_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- test/e2e/util/fixture.go
f1e43fd to
215ab6c
Compare
Manual Verification on Live ClusterTested the NLB teardown fix on a live AWS-based HostedCluster. Setup:
Reproducing the issue (stock CPO): Created a separate HostedCluster with stock CPO and initiated deletion. HCCO logs showed the slow async LB teardown path ~2 minutes Testing the fix (custom CPO): Initiated deletion of the HostedCluster running the custom CPO image. Result: No "Waiting on service of type LoadBalancer to be deleted" messages. Fix working as expected — HCCO skips the async CCM path, DestroyInfra handles NLB cleanup directly. |
Introduce a loadBalancerDeleter interface to enable unit testing of deleteTaggedLoadBalancers without real AWS calls. Classify OperationNotPermitted and ResourceInUse as terminal errors that abort the poll loop immediately instead of retrying until timeout. Signed-off-by: Vimal Solanki <vsolanki@redhat.com>
215ab6c to
0092592
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9052 +/- ##
==========================================
+ Coverage 44.44% 44.51% +0.06%
==========================================
Files 774 774
Lines 96977 96984 +7
==========================================
+ Hits 43105 43168 +63
+ Misses 50897 50828 -69
- Partials 2975 2988 +13
... and 1 file with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
@vsolanki12: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
What this PR does / why we need it:
Fixes the CI flake in
TestCreateClusterRequestServingIsolation/Teardownwhere AWS resource cleanup exceeds the 15-minute timeout. The test creates a complex topology (5 management node pools + HA hosted cluster with multi-zone workers), and the NLBs created by the cloud controller take too long to be asynchronously deprovisioned.Two-part fix:
HCCO: Skip
ensureServiceLoadBalancersRemovedfor AWS platform. The async cloud controller path (delete Service → CCM deletes NLB) is slow and non-deterministic. NLBs are instead cleaned up directly by the infrastructure destroy flow (DestroyV1ELBs/DestroyV2ELBs), which already deletes all LBs in the VPC.E2e test: In
validateAWSGuestResourcesDeletedFunc, actively delete tagged NLBs/ELBs via the ELBv2 API instead of passively polling for them to disappear. This makes teardown validation faster and deterministic.This is a targeted step toward the installer-like deprovisioning approach described in HOSTEDCP-1454.
Which issue(s) this PR fixes:
Fixes https://issues.redhat.com/browse/OCPBUGS-93739
Special notes for your reviewer:
DestroyInfraalready deletes all LBs in the VPC as a backstop, so no production destroy flow changes are needed.Checklist:
🤖 Generated with Claude Code via
/jira:solve OCPBUGS-93739Summary by CodeRabbit