readinesscheck

package
v0.116.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDaemonSet

func CheckDaemonSet(ds *appsv1.DaemonSet) error

CheckDaemonSet checks whether the given DaemonSet is ready. A DaemonSet is considered ready if its controller observed its current revision and if its desired number of scheduled pods is equal to its updated number of scheduled pods.

func CheckDeployment

func CheckDeployment(dp *appsv1.Deployment) error

CheckDeployment checks whether the given Deployment is ready.

func CheckPod

func CheckPod(pod *corev1.Pod) error

CheckPod checks whether the given Pod is ready. A Pod is considered ready if it successfully completed or if it has the the PodReady condition set to true.

func CheckReplicaSet

func CheckReplicaSet(rs *appsv1.ReplicaSet) error

CheckReplicaSet checks whether the given ReplicaSet is ready. A ReplicaSet is considered ready if its controller observed its current revision and if the number of updated replicas is equal to the number of replicas.

func CheckReplicationController

func CheckReplicationController(rc *corev1.ReplicationController) error

CheckReplicationController checks whether the given ReplicationController is ready. A ReplicationController is considered ready if its controller observed its current revision and if the number of updated replicas is equal to the number of replicas.

func CheckStatefulSet

func CheckStatefulSet(sts *appsv1.StatefulSet) error

CheckStatefulSet checks whether the given StatefulSet is ready. A StatefulSet is considered ready if its controller observed its current revision, it is not in an update (i.e. UpdateRevision is empty) and if its current replicas are equal to its desired replicas.

func IsObjectReady

func IsObjectReady(ctx context.Context, kubeClient client.Client, obj *unstructured.Unstructured,
	checkObject checkObjectFunc) error

IsObjectReady gets an updated version of an object and checks if it is ready.

func IsRecoverableError

func IsRecoverableError(err error) bool

func IsRelevantForDefaultReadinessCheck

func IsRelevantForDefaultReadinessCheck(groupKind schema.GroupKind) bool

func WaitForObjectsReady

func WaitForObjectsReady(ctx context.Context, timeout time.Duration, kubeClient client.Client,
	getObjects ObjectsToWatchFunc, fn checkObjectFunc, interruptionChecker interruption.InterruptionChecker, operation string) error

WaitForObjectsReady waits for objects to be heatlhy and returns an error if all the objects are not ready after the timeout.

Types

type CustomReadinessCheck

type CustomReadinessCheck struct {
	Client              client.Client
	CurrentOp           string
	Timeout             *lsv1alpha1.Duration
	ManagedResources    []lsv1alpha1.TypedObjectReference
	Configuration       health.CustomReadinessCheckConfiguration
	InterruptionChecker interruption.InterruptionChecker
	LsClient            client.Client
	DeployItem          *lsv1alpha1.DeployItem
}

CustomReadinessCheck contains all the data and methods required to kick off a custom readiness check

func (*CustomReadinessCheck) CheckObject

CheckObject checks the readiness of an object and returns an error if the object is considered unready

func (*CustomReadinessCheck) CheckResourcesReady

func (c *CustomReadinessCheck) CheckResourcesReady(ctx context.Context) error

CheckResourcesReady starts a custom readiness check by checking the readiness of the submitted resources

type DefaultReadinessCheck

type DefaultReadinessCheck struct {
	Context             context.Context
	Client              client.Client
	CurrentOp           string
	Timeout             *lsv1alpha1.Duration
	ManagedResources    []lsv1alpha1.TypedObjectReference
	FailOnMissingObject bool
	InterruptionChecker interruption.InterruptionChecker
}

DefaultReadinessCheck contains all the data and methods required to kick off a default readiness check

func (*DefaultReadinessCheck) CheckObject

DefaultCheckObject checks if the object is ready and returns an error otherwise. A non-managed object returns nil.

func (*DefaultReadinessCheck) CheckResourcesReady

func (d *DefaultReadinessCheck) CheckResourcesReady() error

CheckResourcesReady implements the default readiness check for Kubernetes manifests

type ObjectNotReadyError

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

ObjectNotReadyError holds information about an unready object and implements the go error interface. This is a subtype of RecoverableError.

func NewObjectNotReadyError

func NewObjectNotReadyError(u *unstructured.Unstructured, err error) *ObjectNotReadyError

func (*ObjectNotReadyError) Error

func (e *ObjectNotReadyError) Error() string

Error implements the go error interface.

type ObjectsToWatchFunc

type ObjectsToWatchFunc func() ([]*unstructured.Unstructured, error)

type RecoverableError

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

RecoverableError defines an error that occurs during the readiness check, but is recoverable. Means, the error could be sporadic and therefore the readiness check is not interrupted.

func NewRecoverableError

func NewRecoverableError(err error) *RecoverableError

func (*RecoverableError) Error

func (e *RecoverableError) Error() string

Error implements the go error interface.

type StatusType

type StatusType string

StatusType defines the value of a Status.

const (
	StatusReady    StatusType = "Ready"
	StatusNotReady StatusType = "NotReady"
	StatusUnknown  StatusType = "Unknown"
)

Jump to

Keyboard shortcuts

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