fix: check if any node exists and cleanup nsg resources if in RG#8718
Open
awesomenix wants to merge 1 commit into
Open
fix: check if any node exists and cleanup nsg resources if in RG#8718awesomenix wants to merge 1 commit into
awesomenix wants to merge 1 commit into
Conversation
awesomenix
commented
Jun 16, 2026
Contributor
- Updated E2E cluster reuse cleanup to treat an existing MC_ node resource group with no VMSS as unusable, forcing cluster recreation instead of later proxy/VMSS failures.
- Also renamed and expanded the subnet cleanup helper to detach both route table and NSG references from the shared subnet when they point to a deleting node resource group.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the E2E cluster reuse/cleanup logic to (1) avoid reusing clusters whose node resource group is in a bad state (deleting or missing expected node resources), and (2) improve shared subnet cleanup by detaching both route table and NSG references when they belong to a deleting node resource group.
Changes:
- Rename/expand shared subnet cleanup to detach both route table and NSG when they reference the deleting node resource group.
- Treat an existing node resource group with no VMSS as unusable to force cluster recreation earlier.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| e2e/shared_infra.go | Renames and broadens subnet cleanup helper to detach route table + NSG references tied to a deleting node RG. |
| e2e/cluster.go | Adds a VMSS-existence check to decide whether a node RG is usable; updates callers to the renamed subnet cleanup helper. |
Comment on lines
+477
to
+481
| shouldDetachRouteTable, err := subnetResourceIDInResourceGroup(routeTableID(subnetResp.Properties.RouteTable), nodeResourceGroup) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| if !shouldDetach { | ||
| return nil | ||
| shouldDetachNSG, err := subnetResourceIDInResourceGroup(networkSecurityGroupID(subnetResp.Properties.NetworkSecurityGroup), nodeResourceGroup) |
Comment on lines
+493
to
+503
| func hasVMSSInResourceGroup(ctx context.Context, resourceGroupName string) (bool, error) { | ||
| pager := config.Azure.VMSS.NewListPager(resourceGroupName, nil) | ||
| if !pager.More() { | ||
| return false, nil | ||
| } | ||
| page, err := pager.NextPage(ctx) | ||
| if err != nil { | ||
| return false, fmt.Errorf("failed to list VMSS in node resource group %q: %w", resourceGroupName, err) | ||
| } | ||
| return len(page.Value) > 0, nil | ||
| } |
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.