Skip to content
This repository was archived by the owner on Mar 22, 2018. It is now read-only.

Commit d94a19d

Browse files
author
FengyunPan
committed
Fix deleting empty monitors
Fix #48094 When create-monitor of cloud-config is false, pool has not monitor and can not delete empty monitor.
1 parent 9009e12 commit d94a19d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

pkg/cloudprovider/providers/openstack/openstack_loadbalancer.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,13 @@ func (lbaas *LbaasV2) EnsureLoadBalancer(clusterName string, apiService *v1.Serv
763763
}
764764
waitLoadbalancerActiveProvisioningStatus(lbaas.network, loadbalancer.ID)
765765
monitorID = monitor.ID
766+
} else if lbaas.opts.CreateMonitor == false {
767+
glog.V(4).Infof("Do not create monitor for pool %s when create-monitor is false", pool.ID)
766768
}
767769

768-
glog.V(4).Infof("Monitor for pool %s: %s", pool.ID, monitorID)
770+
if monitorID != "" {
771+
glog.V(4).Infof("Monitor for pool %s: %s", pool.ID, monitorID)
772+
}
769773
}
770774

771775
// All remaining listeners are obsolete, delete
@@ -1106,7 +1110,10 @@ func (lbaas *LbaasV2) EnsureLoadBalancerDeleted(clusterName string, service *v1.
11061110
return fmt.Errorf("Error getting pool for listener %s: %v", listener.ID, err)
11071111
}
11081112
poolIDs = append(poolIDs, pool.ID)
1109-
monitorIDs = append(monitorIDs, pool.MonitorID)
1113+
// If create-monitor of cloud-config is false, pool has not monitor.
1114+
if pool.MonitorID != "" {
1115+
monitorIDs = append(monitorIDs, pool.MonitorID)
1116+
}
11101117
}
11111118

11121119
// get all members associated with each poolIDs

0 commit comments

Comments
 (0)