-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 { | ||
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 commentThe 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 commentThe 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. |
||
} | ||
} | ||
|
||
// TODO: move reset function to its own location | ||
// Ignore metadata changes now that they have been tested | ||
oldNode.ObjectMeta = node.ObjectMeta | ||
|
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.