-
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
fix deleting all tags on AKS resources #2916
Conversation
@@ -327,6 +324,11 @@ func (s *ManagedClusterSpec) Parameters(existing interface{}) (params interface{ | |||
// AgentPool changes are managed through AMMP. | |||
managedCluster.AgentPoolProfiles = existingMC.AgentPoolProfiles | |||
|
|||
// Do not trigger an update because of nil/empty discrepancies between the two sets of tags. | |||
if len(existingMC.Tags) == 0 && len(managedCluster.Tags) == 0 { | |||
existingMC.Tags = managedCluster.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.
would this be better?
existingMC.Tags, managedCluster.Tags = nil, nil
setting the "existing" to the "local" seems to suggest we're preferring the "local" value, when in fact what we're really trying to do is to ensure that they both have the same value so that a diff isn't computed between them
is that right?
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 suppose what I was trying to enforce here is that the resulting managedCluster.Tags
always resolves to a non-nil, empty map when the spec.additionalTags
are nil or empty. But I see now that it looks fine for managedCluster.Tags
to be nil when existingMC.Tags
is also empty since our desired state already matches the actual state in that case. Overall I think your suggestion is a bit more clear so I'll test that to make sure it works and make that change unless I run into any issues.
/retest |
Great find! |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis 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 |
/cherry-pick release-1.5 |
@jackfrancis: once the present PR merges, I will cherry-pick it on top of release-1.5 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. |
/cherry-pick release-1.6 |
@jackfrancis: once the present PR merges, I will cherry-pick it on top of release-1.6 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. |
@jackfrancis: #2916 failed to apply on top of branch "release-1.5":
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. |
@jackfrancis: #2916 failed to apply on top of branch "release-1.6":
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. |
nevermind the cherry-picks, the |
The field is new for AzureManagedMachinePools, but this issue does affect AzureManagedControlPlane's |
What type of PR is this?
/kind bug
What this PR does / why we need it: When
spec.additionalTags
are defined onAzureManagedControlPlane
orAzureManagedMachinePool
resources, setting them tonull
or empty does not delete all tags because the resultingPUT
request specifiesnull
tags which seems to be interpreted by AKS as "do not change the tags." This change ensures that if the tags are specified in the CAPZ resources asnull
, then a non-nil, empty set of tags are sent to the AKS API to express "please delete all of the existing tags."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: I came across this issue while implementing an e2e test covering this scenario (currently drafted in #2917). Those tests verify this new behavior for me locally. Additional context in #2745 (comment) and #2802.
Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
TODOs:
Release note:
Note:
spec.additionalTags
is not yet implemented for AzureManagedMachinePools in any tagged release