-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaces the use of client subnet to use armnetwork.SubnetsClient` #4012
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly LGTM
a few comments about parsing a subnetID.
pkg/util/purge/resourcegroups.go
Outdated
if secGroupSubnet.ID == nil || secGroupSubnet.Name == nil { | ||
continue | ||
} | ||
|
||
vnetID, _, err := apisubnet.Split(*secGroupSubnet.ID) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
rc.log.Debugf("Removing security group from subnet: %s/%s/%s", *resourceGroup.Name, *secGroup.Name, *subnet.Name) | ||
r, err := azure.ParseResourceID(vnetID) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
subnet, err := rc.subnet.Get(ctx, *resourceGroup.Name, r.ResourceName, *secGroupSubnet.Name, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can parse subnet ID like this.
ARO-RP/pkg/cluster/ensureendpoints.go
Lines 33 to 37 in 88f29de
r, err := arm.ParseResourceID(subnetId) | |
if err != nil { | |
return err | |
} | |
subnet, err := m.armSubnets.Get(ctx, r.ResourceGroupName, r.Parent.Name, r.Name, nil) |
pkg/util/purge/resourcegroups.go
Outdated
vnetID, _, err := apisubnet.Split(*subnet.ID) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = rc.subnet.CreateOrUpdate(ctx, *subnet.ID, subnet) | ||
r, err := azure.ParseResourceID(vnetID) | ||
if err != nil { | ||
return err | ||
} | ||
err = rc.subnet.CreateOrUpdateAndWait(ctx, *resourceGroup.Name, r.ResourceName, *subnet.Name, subnet.Subnet, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can parse subnet ID like this.
ARO-RP/pkg/cluster/ensureendpoints.go
Lines 33 to 37 in 88f29de
r, err := arm.ParseResourceID(subnetId) | |
if err != nil { | |
return err | |
} | |
subnet, err := m.armSubnets.Get(ctx, r.ResourceGroupName, r.Parent.Name, r.Name, nil) |
Which issue this PR addresses:
https://issues.redhat.com/browse/ARO-12538
Replaces the use of client subnet to use
armnetwork.SubnetsClient
.What this PR does / why we need it:
Avoid deprecation.
Test plan for issue:
Tested a few times using on
dryrun
mode with pipeline Purge RedHat Dev-Gratis.https://msazure.visualstudio.com/AzureRedHatOpenShift/_build/results?buildId=110288783&view=logs&j=a4f1910f-c367-5697-edcd-724d81cde23b&t=bc103e47-9b88-5c56-fcad-f3f2f0b2ed91
Is there any documentation that needs to be updated for this PR?
No