mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Support trust id as a scope in the OpenStack authentication logic.
This commit is contained in:
parent
8ea400b1bf
commit
c1b3100ba2
@ -31,6 +31,8 @@ import (
|
|||||||
"github.com/rackspace/gophercloud"
|
"github.com/rackspace/gophercloud"
|
||||||
"github.com/rackspace/gophercloud/openstack"
|
"github.com/rackspace/gophercloud/openstack"
|
||||||
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
|
"github.com/rackspace/gophercloud/openstack/compute/v2/servers"
|
||||||
|
"github.com/rackspace/gophercloud/openstack/identity/v3/extensions/trust"
|
||||||
|
token3 "github.com/rackspace/gophercloud/openstack/identity/v3/tokens"
|
||||||
"github.com/rackspace/gophercloud/pagination"
|
"github.com/rackspace/gophercloud/pagination"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -102,6 +104,7 @@ type Config struct {
|
|||||||
ApiKey string `gcfg:"api-key"`
|
ApiKey string `gcfg:"api-key"`
|
||||||
TenantId string `gcfg:"tenant-id"`
|
TenantId string `gcfg:"tenant-id"`
|
||||||
TenantName string `gcfg:"tenant-name"`
|
TenantName string `gcfg:"tenant-name"`
|
||||||
|
TrustId string `gcfg:"trust-id"`
|
||||||
DomainId string `gcfg:"domain-id"`
|
DomainId string `gcfg:"domain-id"`
|
||||||
DomainName string `gcfg:"domain-name"`
|
DomainName string `gcfg:"domain-name"`
|
||||||
Region string
|
Region string
|
||||||
@ -170,7 +173,20 @@ func readInstanceID() (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newOpenStack(cfg Config) (*OpenStack, error) {
|
func newOpenStack(cfg Config) (*OpenStack, error) {
|
||||||
provider, err := openstack.AuthenticatedClient(cfg.toAuthOptions())
|
provider, err := openstack.NewClient(cfg.Global.AuthUrl)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if cfg.Global.TrustId != "" {
|
||||||
|
authOptionsExt := trust.AuthOptionsExt{
|
||||||
|
TrustID: cfg.Global.TrustId,
|
||||||
|
AuthOptions: token3.AuthOptions{AuthOptions: cfg.toAuthOptions()},
|
||||||
|
}
|
||||||
|
err = trust.AuthenticateV3Trust(provider, authOptionsExt)
|
||||||
|
} else {
|
||||||
|
err = openstack.Authenticate(provider, cfg.toAuthOptions())
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user