conditions

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

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

func New

func New(r *resources.Resources) *Condition

New is used to create a new Condition that can be used to perform a series of pre-defined wait checks against a resource in question

func (*Condition) ContainersReady

ContainersReady is a helper function used to check if the pod condition v1.ContainersReady has reached v1.ConditionTrue

func (*Condition) DeploymentAvailable added in v0.3.0

func (c *Condition) DeploymentAvailable(name, namespace string) apimachinerywait.ConditionWithContextFunc

DeploymentAvailable is a helper function used to check if the deployment condition appsv1.DeploymentAvailable has reached v1.ConditionTrue state

func (*Condition) DeploymentConditionMatch

func (c *Condition) DeploymentConditionMatch(deployment k8s.Object, conditionType appsv1.DeploymentConditionType, conditionState v1.ConditionStatus) apimachinerywait.ConditionWithContextFunc

DeploymentConditionMatch is a helper function that can be used to check a specific condition match for the Deployment in question.

func (*Condition) JobCompleted

JobCompleted is a helper function used to check if the Job has been completed successfully by checking if the batchv1.JobCompleted has reached the v1.ConditionTrue state

func (*Condition) JobConditionMatch

func (c *Condition) JobConditionMatch(job k8s.Object, conditionType batchv1.JobConditionType, conditionState v1.ConditionStatus) apimachinerywait.ConditionWithContextFunc

JobConditionMatch is a helper function that can be used to check the Job Completion or runtime status against a specific condition. This function accepts both conditionType and conditionState as argument and hence you can use this to match both positive or negative cases with suitable values passed to the arguments.

func (*Condition) JobFailed

JobFailed is a helper function used to check if the Job has failed by checking if the batchv1.JobFailed has reached v1.ConditionTrue state

func (*Condition) PodConditionMatch

func (c *Condition) PodConditionMatch(pod k8s.Object, conditionType v1.PodConditionType, conditionState v1.ConditionStatus) apimachinerywait.ConditionWithContextFunc

PodConditionMatch is a helper function that can be used to check a specific condition match for the Pod in question. This is extended into a few simplified match helpers such as PodReady and ContainersReady as well.

func (*Condition) PodPhaseMatch

PodPhaseMatch is a helper function that is used to check and see if the Pod Has reached a specific Phase of the runtime. This can be combined with PodConditionMatch to check if a specific condition and phase has been met. This will enable validation such as checking against CLB of a POD.

func (*Condition) PodReady

PodReady is a helper function used to check if the pod condition v1.PodReady has reached v1.ConditionTrue state

func (*Condition) PodRunning

PodRunning is a helper function used to check if the pod.Status.Phase attribute of the Pod has reached v1.PodRunning

func (*Condition) ResourceDeleted

ResourceDeleted is a helper function used to check if a resource under question has been deleted. This will enable testing cases where the resource have a finalizer and the DELETE operation of such resource have been triggered and you want to wait until the resource has been deleted.

This method can be leveraged against any Kubernetes resource to check the deletion workflow and it does so by checking the resource and waiting until it obtains a v1.StatusReasonNotFound error from the API

func (*Condition) ResourceListMatchN

func (c *Condition) ResourceListMatchN(list k8s.ObjectList, n int, matchFetcher func(object k8s.Object) bool, listOptions ...resources.ListOption) apimachinerywait.ConditionWithContextFunc

ResourceListMatchN is a helper function that can be used to check for a minimum number of returned objects in a list. This function accepts list options and a match function that can be used to adjust the set of objects queried for in the List resource operation.

func (*Condition) ResourceListN

func (c *Condition) ResourceListN(list k8s.ObjectList, n int, listOptions ...resources.ListOption) apimachinerywait.ConditionWithContextFunc

ResourceListN is a helper function that can be used to check for a minimum number of returned objects in a list. This function accepts list options that can be used to adjust the set of objects queried for in the List resource operation.

func (*Condition) ResourceMatch

func (c *Condition) ResourceMatch(obj k8s.Object, matchFetcher func(object k8s.Object) bool) apimachinerywait.ConditionWithContextFunc

ResourceMatch is a helper function used to check if the resource under question has met a pre-defined state. This can be leveraged for checking fields on a resource that may not be immediately present upon creation.

func (*Condition) ResourceScaled

func (c *Condition) ResourceScaled(obj k8s.Object, scaleFetcher func(object k8s.Object) int32, replica int32) apimachinerywait.ConditionWithContextFunc

ResourceScaled is a helper function used to check if the resource under question has a pre-defined number of replicas. This can be leveraged for checking cases such as scaling up and down a deployment or STS and any other scalable resources.

func (*Condition) ResourcesDeleted

ResourcesDeleted is a helper function that can be used to check for if a set of objects has been deleted. This function accepts a list of named objects and will wait until it is not able to find each.

func (*Condition) ResourcesFound

ResourcesFound is a helper function that can be used to check for a set of objects. This function accepts a list of named objects and will wait until it is able to retrieve each.

func (*Condition) ResourcesMatch

func (c *Condition) ResourcesMatch(list k8s.ObjectList, matchFetcher func(object k8s.Object) bool) apimachinerywait.ConditionWithContextFunc

ResourcesMatch is a helper function that can be used to check for a set of objects. This function accepts a list of named objects and a match function, and will wait until it is able to retrieve each while passing the match validation.

Jump to

Keyboard shortcuts

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