Merge pull request #65781 from zetaab/emptysection

Automatic merge from submit-queue (batch tested with PRs 65902, 65781). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

if loadbalancer section is not defined in cloudconfig, do not init support

**What this PR does / why we need it**: if LoadBalancer section is not defined in cloudconfig, we should not initialize loadbalancer support for openstack cloudprovider.

**Which issue(s) this PR fixes**:
Fixes #65775

**Special notes for your reviewer**:

**Release note**:
```release-note
If LoadBalancer is not defined in cloud config, the loadbalancer is not initialized anymore in openstack. All setups must have some setting under that section
```
This commit is contained in:
Kubernetes Submit Queue 2018-07-09 23:07:04 -07:00 committed by GitHub
commit 0ff24a29c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,7 @@ import (
"net"
"net/http"
"os"
"reflect"
"regexp"
"strings"
"time"
@ -573,6 +574,11 @@ func (os *OpenStack) HasClusterID() bool {
func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool) {
glog.V(4).Info("openstack.LoadBalancer() called")
if reflect.DeepEqual(os.lbOpts, LoadBalancerOpts{}) {
glog.V(4).Info("LoadBalancer section is empty/not defined in cloud-config")
return nil, false
}
network, err := os.NewNetworkV2()
if err != nil {
return nil, false