-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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 providerID update validation #51761
Conversation
Hi @karataliu. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. 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. I understand the commands that are listed here. |
@@ -3437,6 +3437,16 @@ func ValidateNodeUpdate(node, oldNode *api.Node) field.ErrorList { | |||
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "podCIDR"), "node updates may not change podCIDR except from \"\" to valid")) | |||
} | |||
} | |||
|
|||
// Allow controller manager updating provider ID when not set | |||
if len(oldNode.Spec.ProviderID) == 0 { |
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.
if oldNode.Spec.ProviderID == ""
/ok-to-test |
oldNode.Spec.ProviderID = node.Spec.ProviderID | ||
} else { | ||
if oldNode.Spec.ProviderID != node.Spec.ProviderID { | ||
allErrs = append(allErrs, field.Forbidden(field.NewPath("spec", "providerID"), "node updates may not change providerID except from \"\" to valid")) |
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.
Can we add the new ProviderID to the error to make this easier to debug?
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.
We don't usually do that for Forbidden errors because ... I forget why. If we want to do that, we should add a field to the error struct and do it all over.
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.
Nice version of the change.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: karataliu, thockin Associated issue: 50730 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
Automatic merge from submit-queue (batch tested with PRs 51819, 51706, 51761, 51818, 51500) |
Commit found in the "release-1.7" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
What this PR does / why we need it:
Cloud controller manager supports updating providerID in #50730, but the node updating was blocked by
validation rule.
This is to propose a fix for updating the validation rule by allowing altering spec.providerID if not set.
Please check #51596 for detail
Which issue this PR fixes
fixes #51596
Special notes for your reviewer:
Release note: