Skip to content
Permalink
Browse files

add experimental support for Service Type=LoadBalancer w/ NSX-T

Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
  • Loading branch information
andrewsykim committed Nov 3, 2019
1 parent 04cdca2 commit 4bdbe49c4777785b633a6190e37e13fa637b0b74
1 go.mod
@@ -15,6 +15,7 @@ require (
github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3
github.com/vmware/go-vmware-nsxt v0.0.0-20190201205556-16aa0443042d
github.com/vmware/govmomi v0.21.0
golang.org/x/lint v0.0.0-20190409202823-959b441ac422 // indirect
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
2 go.sum
@@ -314,6 +314,8 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/vishvananda/netlink v0.0.0-20171020171820-b2de5d10e38e/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk=
github.com/vishvananda/netns v0.0.0-20171111001504-be1fbeda1936/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
github.com/vmware/go-vmware-nsxt v0.0.0-20190201205556-16aa0443042d h1:95uMoAryJvAwfDSxlgQEbT9xkNyWTB5YIxCweItbjGc=
github.com/vmware/go-vmware-nsxt v0.0.0-20190201205556-16aa0443042d/go.mod h1:AzmozsuEImWQcg9Cfef9oMNoPQKcNaps6VkyJhzbSf0=
github.com/vmware/govmomi v0.20.1/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU=
github.com/vmware/govmomi v0.21.0 h1:jc8uMuxpcV2xMAA/cnEDlnsIjvqcMra5Y8onh/U3VuY=
github.com/vmware/govmomi v0.21.0/go.mod h1:zbnFoBQ9GIjs2RVETy8CNEpb+L+Lwkjs3XZUL0B3/m0=
@@ -95,8 +95,12 @@ func (vs *VSphere) Initialize(clientBuilder cloudprovider.ControllerClientBuilde
// LoadBalancer returns a balancer interface. Also returns true if the
// interface is supported, false otherwise.
func (vs *VSphere) LoadBalancer() (cloudprovider.LoadBalancer, bool) {
klog.Warning("The vSphere cloud provider does not support load balancers")
return nil, false
if vs.loadbalancer == nil {
klog.Warning("The vSphere cloud provider does not support load balancers")
return nil, false
}

return vs.loadbalancer, true
}

// Instances returns an instances interface. Also returns true if the
@@ -152,12 +156,23 @@ func buildVSphereFromConfig(cfg *vcfg.Config) (*VSphere, error) {
vcList: make(map[string]*VCenterInfo),
}

var err error
var loadbalancer cloudprovider.LoadBalancer
if cfg.LoadbalancerNSXT != nil {
// TODO: feature gate this config with an env var?
loadbalancer, err = newNSXTLoadBalancer(cfg.Global.ClusterID, cfg.LoadbalancerNSXT)
if err != nil {
return nil, err
}
}

vs := VSphere{
cfg: cfg,
nodeManager: nm,
instances: newInstances(nm),
zones: newZones(nm, cfg.Labels.Zone, cfg.Labels.Region),
server: server.NewServer(cfg.Global.APIBinding, nm),
cfg: cfg,
nodeManager: nm,
instances: newInstances(nm),
loadbalancer: loadbalancer,
zones: newZones(nm, cfg.Labels.Zone, cfg.Labels.Region),
server: server.NewServer(cfg.Global.APIBinding, nm),
}
return &vs, nil
}

0 comments on commit 4bdbe49

Please sign in to comment.
You can’t perform that action at this time.