mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Detect if UpdateTCPLoadBalancer left its GCE target pool in an incorrect state.
This commit is contained in:
parent
1be091da07
commit
b0351ff266
@ -479,6 +479,19 @@ func (gce *GCECloud) UpdateTCPLoadBalancer(name, region string, hosts []string)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Try to verify that the correct number of nodes are now in the target pool.
|
||||
// We've been bitten by a bug here before (#11327) where all nodes were
|
||||
// accidentally removed and want to make similar problems easier to notice.
|
||||
updatedPool, err := gce.service.TargetPools.Get(gce.projectID, region, name).Do()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(updatedPool.Instances) != len(hosts) {
|
||||
glog.Errorf("Unexpected number of instances (%d) in target pool %s after updating (expected %d). Instances in updated pool: %s",
|
||||
len(updatedPool.Instances), name, len(hosts), strings.Join(updatedPool.Instances, ","))
|
||||
return fmt.Errorf("Unexpected number of instances (%d) in target pool %s after update (expected %d)", len(updatedPool.Instances), name, len(hosts))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user