openstack: set region in cluster cloud client (#3375)

This commit is contained in:
3u13r 2024-09-26 11:08:06 +02:00 committed by GitHub
parent d65987cb15
commit 882d602524
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 27 additions and 0 deletions

View file

@ -54,6 +54,10 @@ func New(ctx context.Context) (*MetadataClient, error) {
if err != nil {
return nil, fmt.Errorf("getting user domain name: %w", err)
}
regionName, err := imds.regionName(ctx)
if err != nil {
return nil, fmt.Errorf("getting region name: %w", err)
}
clientOpts := &clientconfig.ClientOpts{
AuthType: clientconfig.AuthV3Password,
@ -63,6 +67,7 @@ func New(ctx context.Context) (*MetadataClient, error) {
Username: username,
Password: password,
},
RegionName: regionName,
}
serversClient, err := clientconfig.NewServiceClient(ctx, "compute", clientOpts)