task

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplyTaskKind        = "Apply"
	DeleteTaskKind       = "Delete"
	DummyTaskKind        = "Dummy"
	PipeTaskKind         = "Pipe"
	ToggleTaskKind       = "Toggle"
	KudoOperatorTaskKind = "KudoOperator"
)

Available tasks kinds

View Source
const (
	PipePodAnnotation = "kudo.dev/pipepod"
)

Variables

This section is empty.

Functions

func PipeArtifactName added in v0.9.0

func PipeArtifactName(meta renderer.Metadata, key string) string

PipeArtifactName returns a deterministic name for pipe artifact (ConfigMap, Secret)

func PipePodName added in v0.9.0

func PipePodName(meta renderer.Metadata) string

PipePodName returns a deterministic name for a pipe pod

Types

type ApplyTask

type ApplyTask struct {
	Name      string
	Resources []string
}

ApplyTask will apply a set of given resources to the cluster. See Run method for more details.

func (ApplyTask) Run

func (at ApplyTask) Run(ctx Context) (bool, error)

Run method for the ApplyTask. Given the task context, it renders the templates using context parameters creates runtime objects and enhances them, and applies them using the controller client. Finally, resources are checked for health.

type Context

type Context struct {
	Client     client.Client
	Discovery  discovery.CachedDiscoveryInterface
	Config     *rest.Config
	Scheme     *runtime.Scheme
	Enhancer   renderer.Enhancer
	Meta       renderer.Metadata
	Templates  map[string]string      // Raw templates
	Parameters map[string]interface{} // Instance and OperatorVersion parameters merged
	Pipes      map[string]string      // Pipe artifacts
}

Context is a engine.task execution context containing k8s client, templates parameters etc.

type DeleteTask

type DeleteTask struct {
	Name      string
	Resources []string
}

DeleteTask will delete a set of given resources from the cluster. See Run method for more details.

func (DeleteTask) Run

func (dt DeleteTask) Run(ctx Context) (bool, error)

Run method for the DeleteTask. Given the task context, it renders the templates using context parameters creates runtime objects and enhances them, and finally removes them using the controller client.

type DummyTask

type DummyTask struct {
	Name    string
	WantErr bool
	Fatal   bool
	Done    bool
}

DummyTask is a task that can fail or succeed on demand

func (DummyTask) Run

func (dt DummyTask) Run(ctx Context) (bool, error)

Run method for the tDummyTask. It has no side effects and returns a dummy error if WantErr is true

type KudoOperatorTask added in v0.14.0

type KudoOperatorTask struct {
	Name            string
	OperatorName    string
	InstanceName    string
	AppVersion      string
	OperatorVersion string
	ParameterFile   string
}

KudoOperatorTask installs an instance of a KUDO operator in a cluster

func (KudoOperatorTask) Run added in v0.14.0

func (kt KudoOperatorTask) Run(ctx Context) (bool, error)

Run method for the KudoOperatorTask which will install a child operator

type PipeFile added in v0.9.0

type PipeFile struct {
	File    string
	EnvFile string
	Kind    PipeFileKind
	Key     string
}

type PipeFileKind added in v0.9.0

type PipeFileKind string
const (
	// PipeFile will be persisted as a Secret
	PipeFileKindSecret PipeFileKind = "Secret"
	// PipeFile will be persisted as a ConfigMap
	PipeFileKindConfigMap PipeFileKind = "ConfigMap"
)

type PipeTask added in v0.9.0

type PipeTask struct {
	Name      string
	Pod       string
	PipeFiles []PipeFile
}

func (PipeTask) Run added in v0.9.0

func (pt PipeTask) Run(ctx Context) (bool, error)

type Tasker

type Tasker interface {
	Run(ctx Context) (bool, error)
}

Tasker is an interface that represents any runnable task for an operator. This method is treated as idempotent and will be called multiple times during the life-cycle of the plan execution. Method returns a boolean, signalizing that the task has finished successfully, and an error. An error can wrap the ErrFatalExecution for errors that should not be retried e.g. failed template rendering. This will result in a kudoapi.ExecutionFatalError in the plan execution status. A normal error e.g. failure during accessing the API server will be treated as "transient", meaning plan execution engine can retry it next time. Only a (true, nil) return value will be treated as successful task execution.

func Build

func Build(task *kudoapi.Task) (Tasker, error)

Build factory method takes an kudoapi.Task and returns a corresponding Tasker object

type ToggleTask added in v0.11.0

type ToggleTask struct {
	Name      string
	Parameter string
	Resources []string
}

ToggleTask will apply or delete a set of given resources to the cluster based on value of Parameter. See Run method for more details.

func (ToggleTask) Run added in v0.11.0

func (tt ToggleTask) Run(ctx Context) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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