@@ -27,6 +27,7 @@ import (
27
27
28
28
"github.com/gophercloud/gophercloud"
29
29
"github.com/gophercloud/gophercloud/openstack/keymanager/v1/containers"
30
+ "github.com/gophercloud/gophercloud/openstack/keymanager/v1/secrets"
30
31
"github.com/gophercloud/gophercloud/openstack/loadbalancer/v2/listeners"
31
32
"github.com/gophercloud/gophercloud/openstack/loadbalancer/v2/loadbalancers"
32
33
v2monitors "github.com/gophercloud/gophercloud/openstack/loadbalancer/v2/monitors"
@@ -1650,16 +1651,30 @@ func (lbaas *LbaasV2) checkService(service *corev1.Service, nodes []*corev1.Node
1650
1651
"initialized and default-tls-container-ref %q is set" , svcConf .tlsContainerRef )
1651
1652
}
1652
1653
1653
- // check if container exists for 'barbican' container store
1654
- // tls container ref has the format: https://{keymanager_host}/v1/containers/{uuid}
1654
+ // check if container or secret exists for 'barbican' container store
1655
+ // tls container ref has the format: https://{keymanager_host}/v1/containers/{uuid} or https://{keymanager_host}/v1/secrets/{uuid}
1655
1656
if lbaas .opts .ContainerStore == "barbican" {
1656
1657
slice := strings .Split (svcConf .tlsContainerRef , "/" )
1657
- containerID := slice [len (slice )- 1 ]
1658
- container , err := containers .Get (lbaas .secret , containerID ).Extract ()
1659
- if err != nil {
1660
- return fmt .Errorf ("failed to get tls container %q: %v" , svcConf .tlsContainerRef , err )
1658
+ if len (slice ) < 2 {
1659
+ return fmt .Errorf ("invalid tlsContainerRef for service %s" , serviceName )
1660
+ }
1661
+ barbicanUUID := slice [len (slice )- 1 ]
1662
+ barbicanType := slice [len (slice )- 2 ]
1663
+ if barbicanType == "containers" {
1664
+ container , err := containers .Get (lbaas .secret , barbicanUUID ).Extract ()
1665
+ if err != nil {
1666
+ return fmt .Errorf ("failed to get tls container %q: %v" , svcConf .tlsContainerRef , err )
1667
+ }
1668
+ klog .V (4 ).Infof ("Default TLS container %q found" , container .ContainerRef )
1669
+ } else if barbicanType == "secrets" {
1670
+ secret , err := secrets .Get (lbaas .secret , barbicanUUID ).Extract ()
1671
+ if err != nil {
1672
+ return fmt .Errorf ("failed to get tls secret %q: %v" , svcConf .tlsContainerRef , err )
1673
+ }
1674
+ klog .V (4 ).Infof ("Default TLS secret %q found" , secret .SecretRef )
1675
+ } else {
1676
+ return fmt .Errorf ("failed to validate tlsContainerRef for service %s: tlsContainerRef type %s unknown" , serviceName , barbicanType )
1661
1677
}
1662
- klog .V (4 ).Infof ("Default TLS container %q found" , container .ContainerRef )
1663
1678
}
1664
1679
}
1665
1680
0 commit comments