Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
b2d68c79
Commit
b2d68c79
authored
Apr 18, 2015
by
Masahiro Sano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use auto reauth when access token is expired
parent
ff59f316
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
19 deletions
+2
-19
openstack.go
pkg/cloudprovider/openstack/openstack.go
+2
-19
No files found.
pkg/cloudprovider/openstack/openstack.go
View file @
b2d68c79
...
...
@@ -76,7 +76,6 @@ type LoadBalancerOpts struct {
// OpenStack is an implementation of cloud provider Interface for OpenStack.
type
OpenStack
struct
{
provider
*
gophercloud
.
ProviderClient
authOpts
gophercloud
.
AuthOptions
region
string
lbOpts
LoadBalancerOpts
}
...
...
@@ -117,11 +116,7 @@ func (cfg Config) toAuthOptions() gophercloud.AuthOptions {
TenantID
:
cfg
.
Global
.
TenantId
,
TenantName
:
cfg
.
Global
.
TenantName
,
// Persistent service, so we need to be able to renew
// tokens.
// (gophercloud doesn't appear to actually reauth yet,
// hence the explicit openstack.Authenticate() calls
// below)
// Persistent service, so we need to be able to renew tokens.
AllowReauth
:
true
,
}
}
...
...
@@ -138,15 +133,13 @@ func readConfig(config io.Reader) (Config, error) {
}
func
newOpenStack
(
cfg
Config
)
(
*
OpenStack
,
error
)
{
authOpts
:=
cfg
.
toAuthOptions
()
provider
,
err
:=
openstack
.
AuthenticatedClient
(
authOpts
)
provider
,
err
:=
openstack
.
AuthenticatedClient
(
cfg
.
toAuthOptions
())
if
err
!=
nil
{
return
nil
,
err
}
os
:=
OpenStack
{
provider
:
provider
,
authOpts
:
authOpts
,
region
:
cfg
.
Global
.
Region
,
lbOpts
:
cfg
.
LoadBalancer
,
}
...
...
@@ -162,11 +155,6 @@ type Instances struct {
func
(
os
*
OpenStack
)
Instances
()
(
cloudprovider
.
Instances
,
bool
)
{
glog
.
V
(
4
)
.
Info
(
"openstack.Instances() called"
)
if
err
:=
openstack
.
Authenticate
(
os
.
provider
,
os
.
authOpts
);
err
!=
nil
{
glog
.
Warningf
(
"Failed to reauthenticate: %v"
,
err
)
return
nil
,
false
}
compute
,
err
:=
openstack
.
NewComputeV2
(
os
.
provider
,
gophercloud
.
EndpointOpts
{
Region
:
os
.
region
,
})
...
...
@@ -413,11 +401,6 @@ type LoadBalancer struct {
func
(
os
*
OpenStack
)
TCPLoadBalancer
()
(
cloudprovider
.
TCPLoadBalancer
,
bool
)
{
glog
.
V
(
4
)
.
Info
(
"openstack.TCPLoadBalancer() called"
)
if
err
:=
openstack
.
Authenticate
(
os
.
provider
,
os
.
authOpts
);
err
!=
nil
{
glog
.
Warningf
(
"Failed to reauthenticate: %v"
,
err
)
return
nil
,
false
}
// TODO: Search for and support Rackspace loadbalancer API, and others.
network
,
err
:=
openstack
.
NewNetworkV2
(
os
.
provider
,
gophercloud
.
EndpointOpts
{
Region
:
os
.
region
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment