common

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BashTaskName is the name of the bash task
	BashTaskName string = "bash"
)
View Source
const (
	// ExecTaskName is the name of this file implements
	ExecTaskName string = "exec"
)
View Source
const (
	// LibraryName is the name of this task library
	LibraryName string = "common"
)
View Source
const (
	// PromoteKubectlTaskName is the name of the task
	PromoteKubectlTaskName string = "promote-kubectl"
)
View Source
const (
	// ReadinessTaskName is the name of the readiness task
	ReadinessTaskName string = "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 MakeBashTask

func MakeBashTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeBashTask converts an exec task spec into an exec task.

func MakeExec

func MakeExec(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeExec converts an exec task spec into an exec task.

func MakePromoteKubectlTask

func MakePromoteKubectlTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakePromoteKubectlTask converts a task spec into an task.

func MakeReadinessTask

func MakeReadinessTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeReadinessTask creates a readiness task with correct defaults.

func MakeTask

func MakeTask(t *v2alpha2.TaskSpec) (tasks.Task, error)

MakeTask constructs a Task from a TaskSpec or returns an error if any.

Types

type BashInputs

type BashInputs struct {
	Script string `json:"script" yaml:"script"`
}

BashInputs contain the name and arguments of the command to be executed.

type BashTask

type BashTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	With           BashInputs `json:"with" yaml:"with"`
}

BashTask encapsulates a command that can be executed.

func (*BashTask) Run

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

Run the command.

type ExecInputs

type ExecInputs struct {
	Cmd                  string        `json:"cmd" yaml:"cmd"`
	Args                 []interface{} `json:"args,omitempty" yaml:"args,omitempty"`
	DisableInterpolation bool          `json:"disableInterpolation,omitempty" yaml:"disableInterpolation,omitempty"`
}

ExecInputs contain the name and arguments of the command to be executed.

type ExecTask

type ExecTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	With           ExecInputs `json:"with" yaml:"with"`
}

ExecTask encapsulates a command that can be executed.

func (*ExecTask) Run

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

Run the command.

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 PromoteKubectlInputs

type PromoteKubectlInputs struct {
	Manifest string `json:"manifest" yaml:"manifest"`
	//+optional
	Namespace *string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	//+optional
	Recursive *bool `json:"recursive,omitempty" yaml:"recursive,omitempty"`
}

PromoteKubectlInputs contain the name and arguments of the command to be executed.

type PromoteKubectlTask

type PromoteKubectlTask struct {
	tasks.TaskMeta `json:",inline" yaml:",inline"`
	With           PromoteKubectlInputs `json:"with" yaml:"with"`
}

PromoteKubectlTask encapsulates a promotion details.

func (*PromoteKubectlTask) Run

Run the command.

func (*PromoteKubectlTask) ToBashTask

func (t *PromoteKubectlTask) ToBashTask() *BashTask

ToBashTask converts a PromoteKubectl task to a Bash task

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 {
	tasks.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