resolver

package
v0.0.0-...-f6080a5 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSAMissing = errors.New("the serviceAccountName does not exist")

Functions

func GetToken

func GetToken(
	ctx context.Context,
	wg *sync.WaitGroup,
	client *kubernetes.Clientset,
	serviceAccount types.NamespacedName,
	refreshConfig TokenRefreshConfig,
) (string, error)

GetToken will use the TokenRequest API to get a token for the service account and return a file path to where the token is stored. A new token will be requested and stored in the file before the token expires. If an unrecoverable error occurs during a token refresh, refreshConfig.OnFailedRefresh is called if it's defined.

Types

type TemplateResolvers

type TemplateResolvers struct {
	templaterequest.UnimplementedTemplateResolverServer

	DynamicWatcher depclient.DynamicWatcher
	// contains filtered or unexported fields
}

func NewTemplateResolvers

func NewTemplateResolvers(
	ctx context.Context,
	kubeconfig *rest.Config,
	tokenRequestingClient *kubernetes.Clientset,
	appUpdates chan event.GenericEvent,
) (*TemplateResolvers, source.TypedSource[reconcile.Request])

func (*TemplateResolvers) Resolve

type TokenRefreshConfig

type TokenRefreshConfig struct {
	// The token lifetime in seconds.
	ExpirationSeconds int64
	// The minimum refresh minutes before expiration. This must be <= MaxRefreshMins.
	MinRefreshMins float64
	// The maximum refresh minutes before expiration. This must be >= MinRefreshMins.
	MaxRefreshMins float64
	// If a token refresh encountered an unrecoverable error, then this is called.
	OnFailedRefresh func(error)
}

Jump to

Keyboard shortcuts

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