satoken

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package satoken provides a Service Account Token getter and cache for kubernetes ServiceAccount tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages service account tokens for pods.

func NewManager

func NewManager(c clientset.Interface, log logr.Logger) *Manager

NewManager returns a new token manager.

func (*Manager) GetServiceAccountToken

func (m *Manager) GetServiceAccountToken(ctx context.Context, namespace, name string, tr *authenticationv1.TokenRequest) (*authenticationv1.TokenRequest, error)

GetServiceAccountToken gets a service account token from cache or from the TokenRequest API. This process is as follows: * Check the cache for the current token request. * If the token exists and does not require a refresh, return the current token. * Attempt to refresh the token. * If the token is refreshed successfully, save it in the cache and return the token. * If refresh fails and the old token is still valid, log an error and return the old token. * If refresh fails and the old token is no longer valid, return an error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL