mirror of
https://github.com/kubernetes/client-go.git
synced 2025-08-29 12:04:45 +00:00
Migrate the controller to use TokenRequest and rotate token periodically
Kubernetes-commit: 244b244f9d84c56ad3a5af255b70c793f6bfd39c
This commit is contained in:
parent
c6841eb0ec
commit
0dbf86afcf
@ -59,6 +59,15 @@ func NewCachedFileTokenSource(path string) oauth2.TokenSource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewCachedTokenSource returns a oauth2.TokenSource reads a token from a
|
||||||
|
// designed TokenSource. The ts would provide the source of token.
|
||||||
|
func NewCachedTokenSource(ts oauth2.TokenSource) oauth2.TokenSource {
|
||||||
|
return &cachingTokenSource{
|
||||||
|
now: time.Now,
|
||||||
|
base: ts,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type tokenSourceTransport struct {
|
type tokenSourceTransport struct {
|
||||||
base http.RoundTripper
|
base http.RoundTripper
|
||||||
ort http.RoundTripper
|
ort http.RoundTripper
|
||||||
|
Loading…
Reference in New Issue
Block a user