Skip to content

Commit

Permalink
Merge pull request kubernetes#11349 from a-robinson/targets
Browse files Browse the repository at this point in the history
Detect if UpdateTCPLoadBalancer left its GCE target pool in an incorrect state
  • Loading branch information
davidopp committed Jul 17, 2015
2 parents 7b82f6e + b0351ff commit 9d06b37
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/cloudprovider/gce/gce.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 9d06b37

Please sign in to comment.