-
Notifications
You must be signed in to change notification settings - Fork 430
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
AKS: enable isVnetManaged, add caching #2543
AKS: enable isVnetManaged, add caching #2543
Conversation
a2afb14
to
beb627f
Compare
beb627f
to
f5d0484
Compare
3239239
to
fd1eb5c
Compare
8b7ae51
to
c02d048
Compare
Not sure if this is relevant, but should the commit message also be changed to be more relevant to what the PR is actually doing now? I'm not sure if that's being too picky in reviews... |
Yes, will definitely change the title! |
/retitle AKS: enable isVnetManaged, add caching |
ctx := context.Background() | ||
ctx, log, done := tele.StartSpanWithLogger(ctx, "scope.ManagedControlPlaneScope.IsVnetManaged") | ||
defer done() | ||
isManaged, err := virtualnetworks.New(s).IsManaged(ctx) |
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.
In cluster.go
you called this variable isVnetManaged
.
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.
There's nothing mysterious here, I'm just preferring to use a lowercase local var to capture the response from the method name that we're calling.
d9b70b0
to
76e2d8a
Compare
if s.cache.isVnetManaged != nil { | ||
return to.Bool(s.cache.isVnetManaged) | ||
} | ||
isVnetManaged := s.Vnet().ID == "" || s.Vnet().Tags.HasOwned(s.ClusterName()) |
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.
I wonder if we should change this behavior to be the same as managed clusters eventually, although I agree this is the least dangerous change for now since it preserves existing behavior
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.
I was honestly a bit confused when implementing this for clusters, so glad to hear that suggestion.
I can throw up really quick PR after this one lands so that the scope of this PR leans a bit more towards managed clusters only.
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.
/lgtm
Remove this from PR description? |
Done |
Co-authored-by: Mike Tougeron <[email protected]>
76e2d8a
to
0f321e4
Compare
/retest |
@mtougeron @CecileRobertMichon this is ready for another (hopefully final? 🤞) review round |
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.
/lgtm
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.
looks good to me.
/approve
/approve |
/cherry-pick release-1.4 |
@CecileRobertMichon: once the present PR merges, I will cherry-pick it on top of release-1.4 in a new PR and assign it to you. In 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 kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: CecileRobertMichon, mtougeron The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@CecileRobertMichon: new pull request created: #2600 In 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 kubernetes/test-infra repository. |
What type of PR is this?
/kind bug
/kind feature
What this PR does / why we need it:
This PR enables the
IsVnetManaged()
method for AKS scenarios, which results in actual GET calls against the Azure API to determine in real-time whether the expected capz owner tag (tag is applied one time during cluster create) is present on the Virtual Network.This will address the subnet delete issue during custom VNET scenarios.
Additionally, in order to account for additional calls against the Azure APIs we've implemented a local cache to ensure we don't call the Azure APIs more than once for VNET information per reconciliation.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #2484
Special notes for your reviewer:
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
TODOs:
Release note: