Skip to content

Commit

Permalink
Merge pull request kubernetes#50931 from jrperritt/fix-pool-panic
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

cloudprovider/openstack bug fix: don't try to append pool id if pool doesn't exist

**What this PR does / why we need it**:

This fixes a bug in the OpenStack cloud provider that could cause a panic.

Consider what will happen in the current `LbaasV2.EnsureLoadBalancerDeleted` code if `nil, ErrNotFound` is returned by `getPoolByListenerID`.
  • Loading branch information
Kubernetes Submit Queue authored Aug 23, 2017
2 parents 74a0b93 + 6fce2ce commit 6cdb124
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -1144,10 +1144,12 @@ func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(clusterName string, service *v1.
if err != nil && err != ErrNotFound {
return fmt.Errorf("Error getting pool for listener %s: %v", listener.ID, err)
}
poolIDs = append(poolIDs, pool.ID)
// If create-monitor of cloud-config is false, pool has not monitor.
if pool.MonitorID != "" {
monitorIDs = append(monitorIDs, pool.MonitorID)
if pool != nil {
poolIDs = append(poolIDs, pool.ID)
// If create-monitor of cloud-config is false, pool has not monitor.
if pool.MonitorID != "" {
monitorIDs = append(monitorIDs, pool.MonitorID)
}
}
}

Expand Down

0 comments on commit 6cdb124

Please sign in to comment.