Skip to content

Commit 96818ec

Browse files
Merge pull request #129 from shiftstack/merge-bot-master
Merge https://github.com/kubernetes/cloud-provider-openstack:master into master
2 parents 2f5f61e + c1bad3a commit 96818ec

File tree

4 files changed

+37
-17
lines changed

4 files changed

+37
-17
lines changed

docs/openstack-cloud-controller-manager/expose-applications-using-loadbalancer-type-service.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,13 @@ Request Body:
207207
Reference to a tls container. This option works with Octavia, when this option is set then the cloud provider will create an Octavia Listener of type `TERMINATED_HTTPS` for a TLS Terminated loadbalancer.
208208
Format for tls container ref: `https://{keymanager_host}/v1/containers/{uuid}`
209209

210+
When `container-store` parameter is set to `external` format for `default-tls-container-ref` could be any string.
211+
210212
Not supported when `lb-provider=ovn` is configured in openstack-cloud-controller-manager.
211213

212214
- `loadbalancer.openstack.org/load-balancer-id`
213215

214-
This annotation is automatically added to the Service if it's not specified when creating. After the Service is created successfully it shouldn't be changed, otherwise the Service won't behave as expected.
216+
This annotation is automatically added to the Service if it's not specified when creating. After the Service is created successfully it shouldn't be changed, otherwise the Service won't behave as expected.
215217

216218
If this annotation is specified with a valid cloud load balancer ID when creating Service, the Service is reusing this load balancer rather than creating another one. Again, it shouldn't be changed after the Service is created.
217219

@@ -413,9 +415,9 @@ To enable PROXY protocol support, the openstack-cloud-controller-manager config
413415
ports:
414416
- containerPort: 8080
415417
EOF
416-
418+
417419
$ kubectl expose deployment echoserver --type=ClusterIP --target-port=8080
418-
420+
419421
$ cat <<EOF | kubectl apply -f -
420422
apiVersion: networking.k8s.io/v1
421423
kind: Ingress
@@ -437,7 +439,7 @@ To enable PROXY protocol support, the openstack-cloud-controller-manager config
437439
port:
438440
number: 80
439441
EOF
440-
442+
441443
$ kubectl get ing
442444
NAME CLASS HOSTS ADDRESS PORTS AGE
443445
test-proxy-protocol <none> test.com 103.250.240.24.nip.io 80 58m
@@ -580,7 +582,7 @@ $ openstack loadbalancer listener list --loadbalancer 2b224530-9414-4302-8163-5a
580582
+--------------------------------------+----------+---------------+
581583
```
582584

583-
The load balancer will be deleted after `service-2` is deleted.
585+
The load balancer will be deleted after `service-2` is deleted.
584586

585587
### IPv4 / IPv6 dual-stack services
586588
Since Kubernetes 1.20, Kubernetes clusters can run in dual-stack mode,

docs/openstack-cloud-controller-manager/using-openstack-cloud-controller-manager.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,18 @@ Although the openstack-cloud-controller-manager was initially implemented with N
177177
178178
* `use-octavia`
179179
Whether or not to use Octavia for LoadBalancer type of Service implementation instead of using Neutron-LBaaS. Default: true
180-
180+
181181
* `floating-network-id`
182182
Optional. The external network used to create floating IP for the load balancer VIP. If there are multiple external networks in the cloud, either this option must be set or user must specify `loadbalancer.openstack.org/floating-network-id` in the Service annotation.
183183
184184
* `floating-subnet-id`
185185
Optional. The external network subnet used to create floating IP for the load balancer VIP. Can be overridden by the Service annotation `loadbalancer.openstack.org/floating-subnet-id`.
186186
187187
* `floating-subnet`
188-
Optional. A name pattern (glob or regexp if starting with `~`) for the external network subnet used to create floating IP for the load balancer VIP. Can be overridden by the Service annotation `loadbalancer.openstack.org/floating-subnet`. If multiple subnets match the first one with still available IPs is used.
188+
Optional. A name pattern (glob or regexp if starting with `~`) for the external network subnet used to create floating IP for the load balancer VIP. Can be overridden by the Service annotation `loadbalancer.openstack.org/floating-subnet`. If multiple subnets match the first one with still available IPs is used.
189189
190190
* `floating-subnet-tags`
191-
Optional. Tags for the external network subnet used to create floating IP for the load balancer VIP. Can be overridden by the Service annotation `loadbalancer.openstack.org/floating-subnet-tags`. If multiple subnets match the first one with still available IPs is used.
191+
Optional. Tags for the external network subnet used to create floating IP for the load balancer VIP. Can be overridden by the Service annotation `loadbalancer.openstack.org/floating-subnet-tags`. If multiple subnets match the first one with still available IPs is used.
192192
193193
* `lb-method`
194194
The load balancing algorithm used to create the load balancer pool. The value can be `ROUND_ROBIN`, `LEAST_CONNECTIONS`, or `SOURCE_IP`. Default: `ROUND_ROBIN`
@@ -227,7 +227,7 @@ Although the openstack-cloud-controller-manager was initially implemented with N
227227
228228
* `cascade-delete`
229229
Determines whether or not to perform cascade deletion of load balancers. Default: true.
230-
230+
231231
* `flavor-id`
232232
The id of the loadbalancer flavor to use. Uses octavia default if not set.
233233
@@ -243,7 +243,7 @@ Although the openstack-cloud-controller-manager was initially implemented with N
243243
* floating-subnet-tags. The same with `floating-subnet-tags` option above.
244244
* network-id. The same with `network-id` option above.
245245
* subnet-id. The same with `subnet-id` option above.
246-
246+
247247
* `enable-ingress-hostname`
248248
249249
Used with proxy protocol (set by annotation `loadbalancer.openstack.org/proxy-protocol: "true"`) by adding a dns suffix (nip.io) to the load balancer IP address. Default false.
@@ -260,6 +260,13 @@ Although the openstack-cloud-controller-manager was initially implemented with N
260260
Reference to a tls container. This option works with Octavia, when this option is set then the cloud provider will create an Octavia Listener of type TERMINATED_HTTPS for a TLS Terminated loadbalancer.
261261
262262
Format for tls container ref: `https://{keymanager_host}/v1/containers/{uuid}`
263+
Check `container-store` parameter if you want to disable validation.
264+
265+
* `container-store`
266+
Optional. Used to specify the store of the tls-container-ref, e.g. "barbican" or "external" - other store will cause a warning log.
267+
Default value - `barbican` - existence of tls container ref would always be performed.
268+
269+
If set to `external` format for tls container ref will not be validated.
263270
264271
* `max-shared-lb`
265272
The maximum number of Services that share a load balancer. Default: 2

pkg/openstack/loadbalancer.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,15 +1598,17 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node
15981598
"initialized and default-tls-container-ref %q is set", svcConf.tlsContainerRef)
15991599
}
16001600

1601-
// check if container exists
1601+
// check if container exists for 'barbican' container store
16021602
// tls container ref has the format: https://{keymanager_host}/v1/containers/{uuid}
1603-
slice := strings.Split(svcConf.tlsContainerRef, "/")
1604-
containerID := slice[len(slice)-1]
1605-
container, err := containers.Get(lbaas.secret, containerID).Extract()
1606-
if err != nil {
1607-
return fmt.Errorf("failed to get tls container %q: %v", svcConf.tlsContainerRef, err)
1603+
if lbaas.opts.ContainerStore == "barbican" {
1604+
slice := strings.Split(svcConf.tlsContainerRef, "/")
1605+
containerID := slice[len(slice)-1]
1606+
container, err := containers.Get(lbaas.secret, containerID).Extract()
1607+
if err != nil {
1608+
return fmt.Errorf("failed to get tls container %q: %v", svcConf.tlsContainerRef, err)
1609+
}
1610+
klog.V(4).Infof("Default TLS container %q found", container.ContainerRef)
16081611
}
1609-
klog.V(4).Infof("Default TLS container %q found", container.ContainerRef)
16101612
}
16111613

16121614
svcConf.connLimit = getIntFromServiceAnnotation(service, ServiceAnnotationLoadBalancerConnLimit, -1)

pkg/openstack/openstack.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ var userAgentData []string
5656
// supportedLBProvider map is used to define LoadBalancer providers that we support
5757
var supportedLBProvider = []string{"amphora", "octavia", "ovn"}
5858

59+
// supportedContainerStore map is used to define supported tls-container-ref store
60+
var supportedContainerStore = []string{"barbican", "external"}
61+
5962
// AddExtraFlags is called by the main package to add component specific command line flags
6063
func AddExtraFlags(fs *pflag.FlagSet) {
6164
fs.StringArrayVar(&userAgentData, "user-agent", nil, "Extra data to add to gophercloud user-agent. Use multiple times to add more than one component.")
@@ -98,6 +101,7 @@ type LoadBalancerOpts struct {
98101
EnableIngressHostname bool `gcfg:"enable-ingress-hostname"` // Used with proxy protocol by adding a dns suffix to the load balancer IP address. Default false.
99102
IngressHostnameSuffix string `gcfg:"ingress-hostname-suffix"` // Used with proxy protocol by adding a dns suffix to the load balancer IP address. Default nip.io.
100103
MaxSharedLB int `gcfg:"max-shared-lb"` // Number of Services in maximum can share a single load balancer. Default 2
104+
ContainerStore string `gcfg:"container-store"` // Used to specify the store of the tls-container-ref
101105
// revive:disable:var-naming
102106
TlsContainerRef string `gcfg:"default-tls-container-ref"` // reference to a tls container
103107
// revive:enable:var-naming
@@ -198,6 +202,7 @@ func ReadConfig(config io.Reader) (Config, error) {
198202
cfg.LoadBalancer.EnableIngressHostname = false
199203
cfg.LoadBalancer.IngressHostnameSuffix = defaultProxyHostnameSuffix
200204
cfg.LoadBalancer.TlsContainerRef = ""
205+
cfg.LoadBalancer.ContainerStore = "barbican"
201206
cfg.LoadBalancer.MaxSharedLB = 2
202207

203208
err := gcfg.FatalOnly(gcfg.ReadInto(&cfg, config))
@@ -228,6 +233,10 @@ func ReadConfig(config io.Reader) (Config, error) {
228233
klog.Warningf("Unsupported LoadBalancer Provider: %s", cfg.LoadBalancer.LBProvider)
229234
}
230235

236+
if !util.Contains(supportedContainerStore, cfg.LoadBalancer.ContainerStore) {
237+
klog.Warningf("Unsupported Container Store: %s", cfg.LoadBalancer.ContainerStore)
238+
}
239+
231240
return cfg, err
232241
}
233242

0 commit comments

Comments
 (0)