Only delete node object on GCE

This commit is contained in:
Ole Markus With 2022-02-18 21:55:28 +01:00
parent 437c2347ad
commit 2ba9c1670f
1 changed files with 2 additions and 3 deletions

View File

@ -409,9 +409,8 @@ func (c *RollingUpdateCluster) drainTerminateAndWait(u *cloudinstances.CloudInst
}
}
// We unregister the node before deleting it; if the replacement comes up with the same name it would otherwise still be cordoned
// (It often seems like GCE tries to re-use names)
if !isBastion && !c.CloudOnly {
// GCE often re-uses names, so we delete the node object to prevent the new instance from using the cordoned Node object
if c.Cluster.Spec.GetCloudProvider() == api.CloudProviderGCE && !isBastion && !c.CloudOnly {
if u.Node == nil {
klog.Warningf("no kubernetes Node associated with %s, skipping node deletion", instanceID)
} else {