Skip to content

Commit 436e7b3

Browse files
Fix clouds.yaml authentication (#2927)
Signed-off-by: Justin Lamp <[email protected]> Co-authored-by: Justin Lamp <[email protected]>
1 parent d5fa5d2 commit 436e7b3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pkg/kms/barbican/barbican.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ package barbican
22

33
import (
44
"context"
5+
"os"
56

67
"github.com/gophercloud/gophercloud/v2"
78
"github.com/gophercloud/gophercloud/v2/openstack"
89
"github.com/gophercloud/gophercloud/v2/openstack/keymanager/v1/secrets"
910
"k8s.io/cloud-provider-openstack/pkg/client"
11+
"k8s.io/klog/v2"
1012
)
1113

1214
type KMSOpts struct {
@@ -26,6 +28,17 @@ type Barbican struct {
2628

2729
// NewBarbicanClient creates new BarbicanClient
2830
func NewBarbicanClient(cfg Config) (*gophercloud.ServiceClient, error) {
31+
if cfg.Global.UseClouds {
32+
if cfg.Global.CloudsFile != "" {
33+
os.Setenv("OS_CLIENT_CONFIG_FILE", cfg.Global.CloudsFile)
34+
}
35+
if err := client.ReadClouds(&cfg.Global); err != nil {
36+
return nil, err
37+
}
38+
klog.V(5).Infof("Config, loaded from the %s:", cfg.Global.CloudsFile)
39+
client.LogCfg(cfg.Global)
40+
}
41+
2942
provider, err := client.NewOpenStackClient(&cfg.Global, "barbican-kms-plugin")
3043
if err != nil {
3144
return nil, err

0 commit comments

Comments
 (0)