Skip to content

Commit ee99acf

Browse files
authored
[occm] Support keystone token for openstack auth (#2964)
* support keystone token in cloud config * add struct tags for token
1 parent a4a25a5 commit ee99acf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

docs/openstack-cloud-controller-manager/using-openstack-cloud-controller-manager.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@ The options in `Global` section are used for openstack-cloud-controller-manager
155155
* `application-credential-secret`
156156
The secret of an application credential to authenticate with.
157157
* `tls-insecure`
158-
If set to `true`, then the server's certificate will not be verified. Default is `false`.
158+
If set to `true`, then the server’s certificate will not be verified. Default is `false`.
159+
* `token`
160+
Keystone token.
159161
160162
### Networking
161163

pkg/client/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type AuthOpts struct {
5656
EndpointType gophercloud.Availability `gcfg:"os-endpoint-type" mapstructure:"os-endpoint-type" name:"os-endpointType" value:"optional"`
5757
CAFile string `gcfg:"ca-file" mapstructure:"ca-file" name:"os-certAuthorityPath" value:"optional"`
5858
TLSInsecure string `gcfg:"tls-insecure" mapstructure:"tls-insecure" name:"os-TLSInsecure" value:"optional" matches:"^true|false$"`
59+
Token string `gcfg:"token" mapstructure:"token" name:"os-token" value:"optional"`
5960

6061
// TLS client auth
6162
CertFile string `gcfg:"cert-file" mapstructure:"cert-file" name:"os-clientCertPath" value:"optional" dependsOn:"os-clientKeyPath"`
@@ -150,6 +151,7 @@ func (authOpts AuthOpts) ToAuthOptions() gophercloud.AuthOptions {
150151
ApplicationCredentialID: authOpts.ApplicationCredentialID,
151152
ApplicationCredentialName: authOpts.ApplicationCredentialName,
152153
ApplicationCredentialSecret: authOpts.ApplicationCredentialSecret,
154+
Token: authOpts.Token,
153155
},
154156
}
155157

@@ -231,6 +233,7 @@ func ReadClouds(authOpts *AuthOpts) error {
231233
authOpts.ApplicationCredentialID = replaceEmpty(authOpts.ApplicationCredentialID, cloud.AuthInfo.ApplicationCredentialID)
232234
authOpts.ApplicationCredentialName = replaceEmpty(authOpts.ApplicationCredentialName, cloud.AuthInfo.ApplicationCredentialName)
233235
authOpts.ApplicationCredentialSecret = replaceEmpty(authOpts.ApplicationCredentialSecret, cloud.AuthInfo.ApplicationCredentialSecret)
236+
authOpts.Token = replaceEmpty(authOpts.Token, cloud.AuthInfo.Token)
234237

235238
return nil
236239
}

0 commit comments

Comments
 (0)