Make OpenStack LBaaS v2 Provider configurable

Add option 'lb-provider' to the Loadbalancer section of the OpenStack
cloudprovider configuration to allow using a different LBaaS v2
provider than the default.
This commit is contained in:
Daniel Gonzalez 2017-10-19 00:00:12 +02:00
parent b3a9b802da
commit 62b8a62844
3 changed files with 3 additions and 0 deletions

View File

@ -82,6 +82,7 @@ type LoadBalancerOpts struct {
SubnetId string `gcfg:"subnet-id"` // overrides autodetection.
FloatingNetworkId string `gcfg:"floating-network-id"` // If specified, will create floating ip for loadbalancer, or do not create floating ip.
LBMethod string `gcfg:"lb-method"` // default to ROUND_ROBIN.
LBProvider string `gcfg:"lb-provider"`
CreateMonitor bool `gcfg:"create-monitor"`
MonitorDelay MyDuration `gcfg:"monitor-delay"`
MonitorTimeout MyDuration `gcfg:"monitor-timeout"`

View File

@ -515,6 +515,7 @@ func (lbaas *LbaasV2) createLoadBalancer(service *v1.Service, name string, inter
Name: name,
Description: fmt.Sprintf("Kubernetes external service %s", name),
VipSubnetID: lbaas.opts.SubnetId,
Provider: lbaas.opts.LBProvider,
}
loadBalancerIP := service.Spec.LoadBalancerIP

View File

@ -169,6 +169,7 @@ func TestCheckOpenStackOpts(t *testing.T) {
SubnetId: "6261548e-ffde-4bc7-bd22-59c83578c5ef",
FloatingNetworkId: "38b8b5f9-64dc-4424-bf86-679595714786",
LBMethod: "ROUND_ROBIN",
LBProvider: "haproxy",
CreateMonitor: true,
MonitorDelay: delay,
MonitorTimeout: timeout,