fix(cluster): ARO-20041 handle empty SubnetID in WorkerProfiles during update operations - #4978
Open
nikhil-thomas wants to merge 1 commit into
Open
Conversation
…g update operations - Split ensureServiceEndpoints into create/update variants; skip empty SubnetIDs on update, error on create - Guard _attachNSGs and createOrUpdateRouterIPEarly to find first non-empty worker SubnetID instead of blindly using [0] - Skip empty SubnetIDs in dynamic validation (openshiftcluster_validatedynamic.go) to unblock customer updates - Skip empty SubnetIDs in monitor (clusterwideproxystatus.go) to prevent parse failures - Skip empty SubnetIDs in NetworkSecurityGroupID lookup to avoid false matches - Add unit tests for all empty-SubnetID code paths Signed-off-by: Nikhil Thomas <nikthoma@redhat.com>
nikhil-thomas
requested review from
alcasim,
bennerv,
cadenmarchese,
hawkowl,
hlipsig,
kevinobriendotca,
kimorris27,
mociarain,
mrWinston,
rogbas,
sankur-codes,
tiguelu,
tsatam,
tuxerrante,
ventifus,
wanghaoran1988 and
yjst2012
as code owners
July 17, 2026 19:42
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens cluster update/admin-update paths against enriched WorkerProfilesStatus entries that have an empty SubnetID, avoiding failures when MachineSets are unhealthy while keeping stricter behavior during create/bootstrapping where appropriate.
Changes:
- Skip empty
SubnetIDentries when iterating enriched worker profiles in dynamic validation and monitoring. - Split
ensureServiceEndpointsinto create vs update wrappers, skipping empty worker subnets during update but preserving create-time error behavior. - Update cluster networking helpers (
createOrUpdateRouterIPEarly,_attachNSGs,NetworkSecurityGroupID) and add unit tests covering empty-first / all-empty subnet scenarios.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/validate/openshiftcluster_validatedynamic.go | Skips empty worker SubnetID entries when building the subnet list for dynamic validation. |
| pkg/monitor/cluster/clusterwideproxystatus.go | Avoids parsing/processing empty worker subnet IDs in CWP status emission. |
| pkg/cluster/ipaddresses.go | Selects the first non-empty worker subnet ID for early router IP logic; errors if none found. |
| pkg/cluster/ipaddresses_test.go | Adds coverage for empty-first and all-empty worker subnet ID cases. |
| pkg/cluster/install.go | Routes create to ensureServiceEndpointsForCreate and admin-update to ensureServiceEndpointsForUpdate. |
| pkg/cluster/ensureendpoints.go | Introduces create/update wrappers and update-time skipping of empty worker subnet IDs. |
| pkg/cluster/ensureendpoints_test.go | Adds update-mode test ensuring empty worker subnet IDs are skipped. |
| pkg/cluster/deploybaseresources.go | Uses first non-empty worker subnet ID in _attachNSGs; errors if none found. |
| pkg/cluster/deploybaseresources_test.go | Adds coverage for empty-first and all-empty worker subnet ID cases in _attachNSGs. |
| pkg/cluster/adminupdate_test.go | Updates expected admin-update step name after renaming. |
| pkg/api/util/subnet/subnet.go | Ignores empty worker subnet IDs when determining worker-vs-master for NSG ID selection. |
| pkg/api/util/subnet/subnet_test.go | Adds tests for empty-first and all-empty worker subnet IDs in NetworkSecurityGroupID. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+135
to
+137
| if workerSubnetID == "" { | ||
| return fmt.Errorf("no valid worker subnet found: all worker profiles have empty subnetId; set properties.workerProfiles[].subnetId") | ||
| } |
Comment on lines
+368
to
+370
| if workerSubnetID == "" { | ||
| return fmt.Errorf("no valid worker subnet found: all worker profiles have empty subnetId") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue this PR addresses:
Fixes ARO-20041
What this PR does / why we need it:
The worker profile enricher creates WorkerProfilesStatus entries with empty SubnetID when a MachineSet is unhealthy (zero ready replicas, nil/un-parseable ProviderSpec).
Multiple code paths assume SubnetID is always populated and crash during admin-update and customer update operations, leaving clusters stuck in a Failed provisioning state.
This PR guards all SubnetID consumers to skip empty values during update operations while preserving the existing error behavior during cluster creation.
Test plan for issue:
Is there any documentation that needs to be updated for this PR?
No. Bug fix with no API or user-facing behavior change.
How do you know this will function as expected in production?