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
fd5775c1
Commit
fd5775c1
authored
Aug 16, 2017
by
Antoine Pelisse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client-go: Update RoundTrippers to be Unwrappable
parent
b248f777
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
24 additions
and
0 deletions
+24
-0
BUILD
...g/src/k8s.io/client-go/plugin/pkg/client/auth/azure/BUILD
+1
-0
azure.go
...rc/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go
+5
-0
BUILD
...ing/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/BUILD
+1
-0
gcp.go
...ng/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go
+5
-0
BUILD
...ng/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/BUILD
+1
-0
oidc.go
.../src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
+5
-0
BUILD
...c/k8s.io/client-go/plugin/pkg/client/auth/openstack/BUILD
+1
-0
openstack.go
...o/client-go/plugin/pkg/client/auth/openstack/openstack.go
+5
-0
No files found.
staging/src/k8s.io/client-go/plugin/pkg/client/auth/azure/BUILD
View file @
fd5775c1
...
...
@@ -21,6 +21,7 @@ go_library(
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/azure:go_default_library",
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go
View file @
fd5775c1
...
...
@@ -28,6 +28,7 @@ import (
"github.com/Azure/go-autorest/autorest/azure"
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/util/net"
restclient
"k8s.io/client-go/rest"
)
...
...
@@ -113,6 +114,8 @@ type azureRoundTripper struct {
roundTripper
http
.
RoundTripper
}
var
_
net
.
RoundTripperWrapper
=
&
azureRoundTripper
{}
func
(
r
*
azureRoundTripper
)
RoundTrip
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
if
len
(
req
.
Header
.
Get
(
authHeader
))
!=
0
{
return
r
.
roundTripper
.
RoundTrip
(
req
)
...
...
@@ -137,6 +140,8 @@ func (r *azureRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
return
r
.
roundTripper
.
RoundTrip
(
req2
)
}
func
(
r
*
azureRoundTripper
)
WrappedRoundTripper
()
http
.
RoundTripper
{
return
r
.
roundTripper
}
type
azureToken
struct
{
token
adal
.
Token
clientID
string
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/BUILD
View file @
fd5775c1
...
...
@@ -21,6 +21,7 @@ go_library(
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/yaml:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
"//vendor/k8s.io/client-go/util/jsonpath:go_default_library",
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go
View file @
fd5775c1
...
...
@@ -30,6 +30,7 @@ import (
"golang.org/x/net/context"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/yaml"
restclient
"k8s.io/client-go/rest"
"k8s.io/client-go/util/jsonpath"
...
...
@@ -287,6 +288,8 @@ type conditionalTransport struct {
persister
restclient
.
AuthProviderConfigPersister
}
var
_
net
.
RoundTripperWrapper
=
&
conditionalTransport
{}
func
(
t
*
conditionalTransport
)
RoundTrip
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
if
len
(
req
.
Header
.
Get
(
"Authorization"
))
!=
0
{
return
t
.
oauthTransport
.
Base
.
RoundTrip
(
req
)
...
...
@@ -306,3 +309,5 @@ func (t *conditionalTransport) RoundTrip(req *http.Request) (*http.Response, err
return
res
,
nil
}
func
(
t
*
conditionalTransport
)
WrappedRoundTripper
()
http
.
RoundTripper
{
return
t
.
oauthTransport
.
Base
}
staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/BUILD
View file @
fd5775c1
...
...
@@ -18,6 +18,7 @@ go_library(
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/golang.org/x/oauth2:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go
View file @
fd5775c1
...
...
@@ -30,6 +30,7 @@ import (
"github.com/golang/glog"
"golang.org/x/oauth2"
"k8s.io/apimachinery/pkg/util/net"
restclient
"k8s.io/client-go/rest"
)
...
...
@@ -189,6 +190,8 @@ type roundTripper struct {
wrapped
http
.
RoundTripper
}
var
_
net
.
RoundTripperWrapper
=
&
roundTripper
{}
func
(
r
*
roundTripper
)
RoundTrip
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
if
len
(
req
.
Header
.
Get
(
"Authorization"
))
!=
0
{
return
r
.
wrapped
.
RoundTrip
(
req
)
...
...
@@ -212,6 +215,8 @@ func (r *roundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
return
r
.
wrapped
.
RoundTrip
(
r2
)
}
func
(
t
*
roundTripper
)
WrappedRoundTripper
()
http
.
RoundTripper
{
return
t
.
wrapped
}
func
(
p
*
oidcAuthProvider
)
idToken
()
(
string
,
error
)
{
p
.
mu
.
Lock
()
defer
p
.
mu
.
Unlock
()
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/openstack/BUILD
View file @
fd5775c1
...
...
@@ -18,6 +18,7 @@ go_library(
deps = [
"//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/gophercloud/gophercloud/openstack:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/net:go_default_library",
"//vendor/k8s.io/client-go/rest:go_default_library",
],
)
...
...
staging/src/k8s.io/client-go/plugin/pkg/client/auth/openstack/openstack.go
View file @
fd5775c1
...
...
@@ -25,6 +25,7 @@ import (
"github.com/golang/glog"
"github.com/gophercloud/gophercloud/openstack"
"k8s.io/apimachinery/pkg/util/net"
restclient
"k8s.io/client-go/rest"
)
...
...
@@ -102,6 +103,8 @@ type tokenRoundTripper struct {
tokenGetter
TokenGetter
}
var
_
net
.
RoundTripperWrapper
=
&
tokenRoundTripper
{}
// RoundTrip adds the bearer token into the request.
func
(
t
*
tokenRoundTripper
)
RoundTrip
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
// if the authorization header already present, use it.
...
...
@@ -119,6 +122,8 @@ func (t *tokenRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
return
t
.
RoundTripper
.
RoundTrip
(
req
)
}
func
(
t
*
tokenRoundTripper
)
WrappedRoundTripper
()
http
.
RoundTripper
{
return
t
.
RoundTripper
}
// newOpenstackAuthProvider creates an auth provider which works with openstack
// environment.
func
newOpenstackAuthProvider
(
clusterAddress
string
,
config
map
[
string
]
string
,
persister
restclient
.
AuthProviderConfigPersister
)
(
restclient
.
AuthProvider
,
error
)
{
...
...
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