bootstrap

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireSource

func AcquireSource(
	ctx context.Context, acquiredSvid chan<- bool,
) *workloadapi.X509Source

AcquireSource establishes a connection to the workload API, fetches the X.509 bundle, and returns an X509Source. It takes a context and a channel acquiredSvid to signal when the SVID has been acquired. If there are any errors during the process, the function logs a fatal message and exits.

func CreateCryptoKey

func CreateCryptoKey(id *string, updatedSecret chan<- bool)

CreateCryptoKey generates or reuses a cryptographic key pair for the application, taking an id for logging purposes and a channel updatedSecret to signal when the secret has been updated. If the secret key is not mounted at the expected location or there are any errors reading the key file, the function logs a fatal message and exits. If the secret has not been set in the cluster, the function generates a new key pair, persists them, and signals the updatedSecret channel.

func Monitor

func Monitor(
	correlationId *string,
	acquiredSvid <-chan bool,
	updatedSecret <-chan bool,
	serverStarted <-chan bool,
	timedOut <-chan bool,
)

Monitor listens to various channels to track the progress of acquiring an identity, updating the age key, and starting the server. It takes a correlationId for logging purposes and four channels: acquiredSvid, updatedSecret, serverStarted, and timedOut. When all three of the first events (acquiring identity, updating age key, and starting the server) have occurred, the function initializes the state and creates a readiness probe. If a timeout occurs before all three events happen, the function logs a fatal message.

func NotifyTimeout

func NotifyTimeout(timedOut chan<- bool)

NotifyTimeout waits for the duration specified by env.SafeBootstrapTimeout() and then sends a 'true' value to the provided 'timedOut' channel. This function can be used to notify other parts of the application when a specific timeout has been reached.

Types

This section is empty.

Jump to

Keyboard shortcuts

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