startupmonitor

package
v0.0.0-...-5152f1c Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePodTemplate

func GeneratePodTemplate(operatorSpec *operatorv1.StaticPodOperatorSpec, command []string, targetNamespace, targetName, targetImagePullSpec, logFile string) (string, error)

func NewCommand

func NewCommand(check ReadinessChecker, newOperatorClient func(config *rest.Config) (operatorclientv1.KubeAPIServerInterface, error)) *cobra.Command

NewCommand creates the startup-monitor cobra command. TODO: make generic for other operators. Note: normal operator client has informers that must be started and setup. We rather do not want that here.

Types

type Locker

type Locker interface {
	Lock(ctx context.Context) error
	Unlock() error
}

type Monitor

type Monitor interface {
	// Run checks the target for readiness and returns with true if the all readiness
	// checks return true within the given timeout duration, or false if the timeout
	// has passed. It will return an error if the context is done before the timeout
	// expired.
	//
	// When Run returns without error, the lock is kept (and must be released by the caller.
	// In the case it does neither timeout nor the target gets ready, the lock is released.
	//
	// installerLock blocks the installer from running in parallel. The monitor will run
	// every iteration of the probe interval with this lock taken. When Run returns
	// without error, the lock is kept (and must be released by the caller.
	// In the case it does neither timeout nor the target gets ready, the lock is released.
	Run(ctx context.Context, installerLock Locker) (ready bool, reason string, message string, err error)
}

type Options

type Options struct {
	// Revision identifier for this particular installation instance
	Revision int

	// NodeName as used to update the right nodeStatus struct in the static pod operator resource
	NodeName string

	// FallbackTimeout specifies a timeout after which the monitor starts the fall back procedure
	FallbackTimeout time.Duration

	// ResourceDir directory that holds all files supporting the static pod manifest
	ResourceDir string

	// ManifestDir directory for the static pod manifest
	ManifestDir string

	// TargetName identifies operand used to construct the final file name when reading the current and previous manifests
	TargetName string

	// KubeConfig file for authn/authz against Kube API
	KubeConfig string

	// installerLock blocks the installer from running in parallel. The monitor will run
	// every iteration of the probe interval with this lock taken.
	InstallerLockFile string

	// LogFile is the file the logs are written.
	LogFile string

	// Check is the readiness step.
	Check ReadinessChecker
}

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) Validate

func (o *Options) Validate() error

type ReadinessChecker

type ReadinessChecker interface {
	IsReady(ctx context.Context, revision int) (ready bool, reason string, message string, err error)
}

ReadinessChecker is a contract between the startup monitor and operators.

type ReadinessFunc

type ReadinessFunc func(ctx context.Context, revision int) (ready bool, reason string, message string, err error)

type WantsNodeName

type WantsNodeName interface {
	SetNodeName(string)
}

WantsNodeName an optional interface used for setting the current node name

type WantsRestConfig

type WantsRestConfig interface {
	SetRestConfig(config *rest.Config)
}

WantsRestConfig an optional interface used for setting rest config for Kube API

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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