readiness

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TaskName is the name of the readiness task
	TaskName string = "common/readiness"
)

Variables

This section is empty.

Functions

func IsDNSLabel

func IsDNSLabel(value string) bool

IsDNSLabel tests for a string that conforms to the definition of a label in DNS (RFC 1035/1123). The following function is implemented in (very) old versions of k8s util package. This function doesn't seem to exist in newer versions, so reimplemented here.

func Make

func Make(t *v2alpha2.TaskSpec) (core.Task, error)

Make creates a readiness task with correct defaults.

Types

type ObjRef

type ObjRef struct {
	// Kind of the object. Specified in the TYPE[.VERSION][.GROUP] format used by `kubectl`
	// See https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#get
	Kind string `json:"kind" yaml:"kind"`
	// Namespace of the object. Optional. If left unspecified, this will be defaulted to the namespace of the experiment
	Namespace *string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	// Name of the object
	Name string `json:"name" yaml:"name"`
	// Wait for condition. Optional.
	// Any value that is accepted by the --for flag of the `kubectl wait` command can be specified.
	// See https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#wait
	WaitFor *string `json:"waitFor,omitempty" yaml:"waitFor,omitempty"`
}

ObjRef contains details about a specific K8s object whose existence and readiness will be checked

type ReadinessInputs

type ReadinessInputs struct {
	// InitialDelaySeconds is optional and defaulted to 5 secs. The first check will be performed after this delay.
	InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty" yaml:"initialDelaySeconds,omitempty"`
	// NumRetries is optional and defaulted to 12. This is the number of retries that will be attempted after the first check. Total number of trials = 1 + NumRetries.
	NumRetries *int32 `json:"numRetries,omitempty" yaml:"numRetries,omitempty"`
	// IntervalSeconds is optional and defaulted to 5 secs
	// Retries will be attempted periodically every IntervalSeconds
	IntervalSeconds *int32 `json:"intervalSeconds,omitempty" yaml:"intervalSeconds,omitempty"`
	// ObjRefs is a list of K8s objects along with optional readiness conditions
	ObjRefs []ObjRef `json:"objRefs,omitempty" yaml:"objRefs,omitempty"`
}

ReadinessInputs contains a list of K8s object references along with optional readiness conditions for them. The inputs also specify the delays and retries involved in the existence and readiness checks. This task will also check for existence of objects specified in the VersionInfo field of the experiment.

type ReadinessTask

type ReadinessTask struct {
	core.TaskMeta `json:",inline" yaml:",inline"`
	With          ReadinessInputs `json:"with" yaml:"with"`
}

ReadinessTask checks existence and readiness of specified resources

func (*ReadinessTask) Run

func (t *ReadinessTask) Run(ctx context.Context) error

Run checks existence and readiness of K8s objects.

Jump to

Keyboard shortcuts

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