Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openstack: do not use region when application credential is used #589

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/controller/provider/container/openstack/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func (r *RegionAdapter) List(ctx *Context) (itr fb.Iterator, err error) {
regionList := []libclient.Region{}
region := &libclient.Region{}
err = ctx.client.GetClientRegion(region)
if ctx.client.IsApplicationCredentialAuth() {
ctx.log.Info("Application credential auth, skipping region list")
return fb.NewList().Iter(), nil
}
if err != nil {
return
}
Expand All @@ -103,6 +107,11 @@ func (r *RegionAdapter) GetUpdates(ctx *Context) (updates []Updater, err error)
regionList := []libclient.Region{}
region := &libclient.Region{}
err = ctx.client.GetClientRegion(region)
if ctx.client.IsApplicationCredentialAuth() {
ctx.log.Info("Application credential auth, skipping region update")
return []Updater{}, nil
}

if err != nil {
return
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/lib/client/openstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ type Client struct {
URL string
Options map[string]string
Log logging.LevelLogger
authTypeValue *clientconfig.AuthType
provider *gophercloud.ProviderClient
identityService *gophercloud.ServiceClient
computeService *gophercloud.ServiceClient
Expand All @@ -80,6 +81,10 @@ type Client struct {
blockStorageService *gophercloud.ServiceClient
}

func (c *Client) IsApplicationCredentialAuth() bool {
return *c.authTypeValue == clientconfig.AuthV3ApplicationCredential
}

func (c *Client) LoadOptionsFromSecret(secret *core.Secret) {
c.Options = make(map[string]string)
for key, value := range secret.Data {
Expand Down Expand Up @@ -216,6 +221,7 @@ func (c *Client) authType() (authType clientconfig.AuthType, err error) {
} else {
err = liberr.New("unsupported authentication type", "authType", configuredAuthType)
}
c.authTypeValue = &authType
return
}

Expand Down
Loading