Migrate the controller to use TokenRequest and rotate token periodically

Kubernetes-commit: 244b244f9d84c56ad3a5af255b70c793f6bfd39c
This commit is contained in:
WanLinghao 2019-02-19 11:42:05 +08:00 committed by Kubernetes Publisher
parent c6841eb0ec
commit 0dbf86afcf

View File

@ -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 {
base http.RoundTripper
ort http.RoundTripper