Skip to content

Commit d2e921c

Browse files
committed
bugfix to handle verify from cloud.yaml (ca still doesn't work)
1 parent 845c556 commit d2e921c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/cloud/services/provider/provider.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ func NewClientFromCluster(ctrlClient client.Client, openStackCluster *infrav1.Op
5757
return newClient(cloud, caCert)
5858
}
5959

60+
// TODO(sbueringer) find out if this function does what we want
61+
// e.g. it had a bug where it didn't use the verify option of the
62+
// cloud parameter. Does it read the ca property from the paramenter?
63+
// how can a CA be set via secret? (an additional key?)
6064
func newClient(cloud clientconfig.Cloud, caCert []byte) (*gophercloud.ProviderClient, *clientconfig.ClientOpts, error) {
6165
clientOpts := new(clientconfig.ClientOpts)
6266
if cloud.AuthInfo != nil {
@@ -86,14 +90,16 @@ func newClient(cloud clientconfig.Cloud, caCert []byte) (*gophercloud.ProviderCl
8690
config.RootCAs = caCertPool
8791
}
8892
config.InsecureSkipVerify = !*cloudFromYaml.Verify
93+
} else {
94+
config.InsecureSkipVerify = !*cloud.Verify
8995
}
9096

9197
transport := &http.Transport{Proxy: http.ProxyFromEnvironment, TLSClientConfig: config}
9298
provider.HTTPClient.Transport = transport
9399

94100
err = openstack.Authenticate(provider, *opts)
95101
if err != nil {
96-
return nil, nil, fmt.Errorf("providerClient authentication err: %v", err)
102+
return nil, nil, fmt.Errorf("providerClient authentication err: %v, %+v", err, cloudFromYaml)
97103
}
98104
return provider, clientOpts, nil
99105
}

0 commit comments

Comments
 (0)