Skip to content

Commit

Permalink
Fix missing endpoint type in OpenStack endpoint clients configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Shishkin <[email protected]>
  • Loading branch information
teran committed Nov 8, 2023
1 parent ca25160 commit 2909ce5
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion pkg/clients/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ type computeClient struct{ client *gophercloud.ServiceClient }
// NewComputeClient returns a new compute client.
func NewComputeClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (ComputeClient, error) {
compute, err := openstack.NewComputeV2(providerClient, gophercloud.EndpointOpts{
Region: providerClientOpts.RegionName,
Region: providerClientOpts.RegionName,
Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
})
if err != nil {
return nil, fmt.Errorf("failed to create compute service client: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/clients/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ type imageClient struct{ client *gophercloud.ServiceClient }
// NewImageClient returns a new glance client.
func NewImageClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (ImageClient, error) {
images, err := openstack.NewImageServiceV2(providerClient, gophercloud.EndpointOpts{
Region: providerClientOpts.RegionName,
Region: providerClientOpts.RegionName,
Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
})
if err != nil {
return nil, fmt.Errorf("failed to create image service client: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/clients/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ type lbClient struct {
// NewLbClient returns a new loadbalancer client.
func NewLbClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (LbClient, error) {
loadbalancerClient, err := openstack.NewLoadBalancerV2(providerClient, gophercloud.EndpointOpts{
Region: providerClientOpts.RegionName,
Region: providerClientOpts.RegionName,
Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
})
if err != nil {
return nil, fmt.Errorf("failed to create load balancer service client: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/clients/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ type networkClient struct {
// NewNetworkClient returns an instance of the networking service.
func NewNetworkClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (NetworkClient, error) {
serviceClient, err := openstack.NewNetworkV2(providerClient, gophercloud.EndpointOpts{
Region: providerClientOpts.RegionName,
Region: providerClientOpts.RegionName,
Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
})
if err != nil {
return nil, fmt.Errorf("failed to create networking service providerClient: %v", err)
Expand Down
3 changes: 2 additions & 1 deletion pkg/clients/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ type volumeClient struct{ client *gophercloud.ServiceClient }
// NewVolumeClient returns a new cinder client.
func NewVolumeClient(providerClient *gophercloud.ProviderClient, providerClientOpts *clientconfig.ClientOpts) (VolumeClient, error) {
volume, err := openstack.NewBlockStorageV3(providerClient, gophercloud.EndpointOpts{
Region: providerClientOpts.RegionName,
Region: providerClientOpts.RegionName,
Availability: clientconfig.GetEndpointType(providerClientOpts.EndpointType),
})
if err != nil {
return nil, fmt.Errorf("failed to create volume service client: %v", err)
Expand Down
1 change: 1 addition & 0 deletions pkg/scope/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ func NewProviderClient(cloud clientconfig.Cloud, caCert []byte, logger logr.Logg
clientOpts.AuthInfo = cloud.AuthInfo
clientOpts.AuthType = cloud.AuthType
clientOpts.RegionName = cloud.RegionName
clientOpts.EndpointType = cloud.EndpointType
}

opts, err := clientconfig.AuthOptions(clientOpts)
Expand Down

0 comments on commit 2909ce5

Please sign in to comment.