diff --git a/pkg/clients/compute.go b/pkg/clients/compute.go index 20891b443b..0fbd20de31 100644 --- a/pkg/clients/compute.go +++ b/pkg/clients/compute.go @@ -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) diff --git a/pkg/clients/image.go b/pkg/clients/image.go index 822a02401d..329cb951d6 100644 --- a/pkg/clients/image.go +++ b/pkg/clients/image.go @@ -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) diff --git a/pkg/clients/loadbalancer.go b/pkg/clients/loadbalancer.go index 03141173d4..7ec2b2c673 100644 --- a/pkg/clients/loadbalancer.go +++ b/pkg/clients/loadbalancer.go @@ -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) diff --git a/pkg/clients/networking.go b/pkg/clients/networking.go index ec17746dc1..23ad3c8fdf 100644 --- a/pkg/clients/networking.go +++ b/pkg/clients/networking.go @@ -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) diff --git a/pkg/clients/volume.go b/pkg/clients/volume.go index bd77355cea..32395863e7 100644 --- a/pkg/clients/volume.go +++ b/pkg/clients/volume.go @@ -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) diff --git a/pkg/scope/provider.go b/pkg/scope/provider.go index 5a22dafcdb..4b0b5e61c2 100644 --- a/pkg/scope/provider.go +++ b/pkg/scope/provider.go @@ -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)