Commit 6bb928a3 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #50931 from jrperritt/fix-pool-panic

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`.
parents 8a12b651 21ce3de3
...@@ -1144,10 +1144,12 @@ func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(clusterName string, service *v1. ...@@ -1144,10 +1144,12 @@ func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(clusterName string, service *v1.
if err != nil && err != ErrNotFound { if err != nil && err != ErrNotFound {
return fmt.Errorf("Error getting pool for listener %s: %v", listener.ID, err) return fmt.Errorf("Error getting pool for listener %s: %v", listener.ID, err)
} }
poolIDs = append(poolIDs, pool.ID) if pool != nil {
// If create-monitor of cloud-config is false, pool has not monitor. poolIDs = append(poolIDs, pool.ID)
if pool.MonitorID != "" { // If create-monitor of cloud-config is false, pool has not monitor.
monitorIDs = append(monitorIDs, pool.MonitorID) if pool.MonitorID != "" {
monitorIDs = append(monitorIDs, pool.MonitorID)
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment