Merge pull request #51761 from karataliu/ccmupdatenode
Automatic merge from submit-queue (batch tested with PRs 51819, 51706, 51761, 51818, 51500) Fix providerID update validation **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**: ```release-note ```
This commit is contained in:
@@ -3476,6 +3476,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"))
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: move reset function to its own location
|
||||
// Ignore metadata changes now that they have been tested
|
||||
oldNode.ObjectMeta = node.ObjectMeta
|
||||
|
Reference in New Issue
Block a user