-
Notifications
You must be signed in to change notification settings - Fork 431
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
wait for ASO tags to converge before updating #4149
Conversation
/cherry-pick release-1.11 |
@nojnhuh: once the present PR merges, I will cherry-pick it on top of release-1.11 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. |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4149 +/- ##
==========================================
+ Coverage 57.82% 57.85% +0.03%
==========================================
Files 187 187
Lines 19195 19205 +10
==========================================
+ Hits 11099 11111 +12
+ Misses 7468 7466 -2
Partials 628 628
☔ View full report in Codecov by Sentry. |
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.
Some questions inline.
@@ -710,7 +710,7 @@ func TestCreateOrUpdateResource(t *testing.T) { | |||
|
|||
specMock.MockTagsGetterSetter.EXPECT().GetActualTags(gomock.Any()).Return(nil) | |||
specMock.MockTagsGetterSetter.EXPECT().GetAdditionalTags().Return(nil) | |||
specMock.MockTagsGetterSetter.EXPECT().GetDesiredTags(gomock.Any()).Return(nil) | |||
specMock.MockTagsGetterSetter.EXPECT().GetDesiredTags(gomock.Any()).Return(nil).Times(2) |
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.
specMock.MockTagsGetterSetter.EXPECT().GetDesiredTags(gomock.Any()).Return(nil).Times(2)
Does this mean that the test will try to check the chain twice?
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.
Trying to understand, why are we checking two times specifically ?
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.
That means this will be called twice or else the test should fail. gomock complains if no count is specified this way and the function is called more than once. Whether we specify .Times(2)
or .AnyTimes()
doesn't matter to me since the "2" isn't significant other than to get the test to pass.
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.
Okay, I see the reason why we are testing for .Times(2)
in this chain.
That is because the func .GetDesiredTags()
gets called twice in tags.go
. Good granular check. Thanks for adding.
@@ -47,6 +50,14 @@ func reconcileTags[T genruntime.MetaObject](t TagsGetterSetter[T], existing T, r | |||
} | |||
|
|||
existingTags = t.GetActualTags(existing) | |||
if !reflect.DeepEqual(t.GetDesiredTags(existing), existingTags) && |
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.
Asking out of curiosity since I have not touched this piece of code; How do the tags get merged?
Does this transient error being returned here reflect that CAPZ is waiting for some external agent to "merge" the tags for us?
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.
The tags get merged based on the CAPZ resource and ASO spec and status as defined further down in this function. The tests might help clarify.
A transient error gets returned when we're assuming ASO is actively doing work to reconcile spec.tags
and then update status.tags
.
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.
Makes sense after going over the code below this change.
It would be good to have a short comment summarizing the reason for early return however.
/lgtm |
LGTM label has been added. Git tree hash: 2b01d27b24620fd9713d7cc3415e1befb736ea27
|
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.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mboersma 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 |
@nojnhuh: #4149 failed to apply on top of branch "release-1.11":
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
What this PR does / why we need it:
From https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/4069/files#r1344633228:
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 #
Special notes for your reviewer:
TODOs:
Release note: