Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultExpirationDuration = 5 * time.Minute
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenGetter ¶
type TokenGetter struct {
// contains filtered or unexported fields
}
func NewTokenGetter ¶
func NewTokenGetter(client corev1.ServiceAccountsGetter, options ...TokenGetterOption) *TokenGetter
Returns a token getter that can fetch tokens given a service account. The token getter also caches tokens which helps reduce the number of requests to the API Server. In case a cached token is expiring a fresh token is created.
func (*TokenGetter) Delete ¶ added in v0.13.0
func (t *TokenGetter) Delete(key types.NamespacedName)
func (*TokenGetter) Get ¶
func (t *TokenGetter) Get(ctx context.Context, key types.NamespacedName) (string, error)
Get returns a token from the cache if available and not expiring, otherwise creates a new token
type TokenGetterOption ¶
type TokenGetterOption func(*TokenGetter)
func WithExpirationDuration ¶
func WithExpirationDuration(expirationDuration time.Duration) TokenGetterOption
type TokenInjectingRoundTripper ¶ added in v0.13.0
type TokenInjectingRoundTripper struct { Tripper http.RoundTripper TokenGetter *TokenGetter Key types.NamespacedName }
Click to show internal directories.
Click to hide internal directories.