controller

package
v1.2.0 Latest Latest
Warning

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

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

README

Workflow Controller

Documentation

Index

Constants

View Source
const (
	// DevModeEnvName determines whether workflow controller is in development mode.
	// In development mode, resource resolver containers, coordinator containers will
	// have image pull policy being 'Always', otherwise it's 'IfNotPresent'.
	DevModeEnvName = "DEVELOP_MODE"

	// ConfigFileKey is key of config file in ConfigMap
	ConfigFileKey = "workflow-controller.json"

	// CoordinatorImage is key of coordinator image in config file
	CoordinatorImage = "coordinator"
	// GCImage is key of the GC image in config file
	GCImage = "gc"
	// DindImage is key of the docker-in-docker image in config file
	DindImage = "dind"
	// ToolboxImage is key of the cyclone toolbox image in config file
	ToolboxImage = "toolbox"
)

Variables

This section is empty.

Functions

func ImagePullPolicy added in v0.9.3

func ImagePullPolicy() corev1.PullPolicy

ImagePullPolicy determines image pull policy based on environment variable DEVELOP_MODE This pull policy will be used in image resolver containers and coordinator containers.

func InitControlCluster added in v0.9.6

func InitControlCluster(client clientset.Interface) error

InitControlCluster initializes control cluster for workflow to run.

func InitLogger

func InitLogger(logging *LoggingConfig)

InitLogger inits logging

func LoadConfig

func LoadConfig(cm *corev1.ConfigMap) error

LoadConfig loads configuration from ConfigMap

Types

type DindSettings added in v0.9.6

type DindSettings struct {
	// InsecureRegistries is list of insecure registries, for docker registries with
	// self-signed certs, it's useful to bypass the cert check.
	InsecureRegistries []string `json:"insecure_registries"`
	// Bip specifies IP subnet used for docker0 bridge
	Bip string `json:"bip"`
}

DindSettings is settings for Docker in Docker.

type ExecutionContext added in v0.9.3

type ExecutionContext struct {
	// Namespace is namespace where to run workflow.
	Namespace string `json:"namespace"`
	// PVC is pvc used to run workflow. It's used to transfer artifacts in WorkflowRun, and
	// also to help share resources among stages within WorkflowRun. If no PVC is given here,
	// input resources won't be shared among stages, but need to be pulled every time it's needed.
	// And also if no PVC given, artifacts are not supported.
	PVC string `json:"pvc"`
	// ServiceAccount is the service account applied to the pod runed
	ServiceAccount string `json:"service_account"`
}

ExecutionContext defines default namespace and pvc used to run workflow.

type GCConfig

type GCConfig struct {
	// Enabled controllers whether GC is enabled, if set to false, no GC would happen.
	Enabled bool `json:"enabled"`
	// DelaySeconds defines the time after a WorkflowRun terminated to perform GC. When configured to 0.
	// it equals to gc immediately.
	DelaySeconds time.Duration `json:"delay_seconds"`
	// RetryCount defines how many times to retry when GC failed, 0 means no retry.
	RetryCount int `json:"retry"`
	// ResourceRequirements is default resource requirements for the gc Pod
	ResourceRequirements corev1.ResourceRequirements `json:"resource_quota"`
}

GCConfig configures GC

type LimitsConfig

type LimitsConfig struct {
	// Maximum WorkflowRuns to be kept for each Workflow
	MaxWorkflowRuns int `json:"max_workflowruns"`
}

LimitsConfig configures maximum WorkflowRun to keep for each Workflow

type LoggingConfig

type LoggingConfig struct {
	Level string `json:"level"`
}

LoggingConfig configures logging

type ParallelismConfig added in v1.0.0

type ParallelismConfig struct {
	// Overall controls overall parallelism of WorkflowRun executions
	Overall ParallelismConstraint `json:"overall"`
	// SingleWorkflow controls parallelism of WorkflowRun executions for single Workflow
	SingleWorkflow ParallelismConstraint `json:"single_workflow"`
}

ParallelismConfig configures how many WorkflowRun allows to run in parallel. If maximum parallelism exceeded, new WorkflowRun will wait in waiting queue. Waiting queue will also have a maxinum size, if maxinum size exceeded, new WorkflowRun will fail directly.

type ParallelismConstraint added in v1.0.0

type ParallelismConstraint struct {
	// MaxParallel specifies max number of WorkflowRun allows to run in parallel
	MaxParallel int64 `json:"max_parallel"`
	// MaxQueueSize specifies max number WorkflowRun allows to wait for running in queue
	MaxQueueSize int64 `json:"max_queue_size"`
}

ParallelismConstraint puts constraints on parallelism

type Result added in v1.2.0

type Result struct {
	// Requeue tells the Controller to requeue the reconcile key.
	// If it is set to false, the controller will not requeue even if error occurred.
	// If it is nil, the controller will retry at most 3 times on errors.
	Requeue *bool

	// RequeueAfter if greater than 0, tells the Controller to requeue the reconcile key after the Duration.
	// Implies that Requeue is true, there is no need to set Requeue to true at the same time as RequeueAfter.
	RequeueAfter time.Duration
}

Result contains the result of a Reconciler invocation.

type WorkersNumber added in v1.1.0

type WorkersNumber struct {
	ExecutionCluster int `json:"execution_cluster"`
	WorkflowTrigger  int `json:"workflow_trigger"`
	WorkflowRun      int `json:"workflow_run"`
	Pod              int `json:"pod"`
}

WorkersNumber defines workers number for various controller

type WorkflowControllerConfig added in v0.9.3

type WorkflowControllerConfig struct {
	// Images that used in controller, such as gc image.
	Images map[string]string `json:"images"`
	// Logging configuration, such as log level.
	Logging LoggingConfig `json:"logging"`
	// GC configuration
	GC GCConfig `json:"gc"`
	// Limits of each resources should be retained
	Limits LimitsConfig `json:"limits"`
	// Parallelism configures how many WorkflowRun allows to run in parallel
	Parallelism *ParallelismConfig `json:"parallelism"`
	// ResourceRequirements is default resource requirements for containers in stage Pod
	ResourceRequirements corev1.ResourceRequirements `json:"default_resource_quota"`
	// ExecutionContext defines default namespace and pvc used to run workflow.
	ExecutionContext ExecutionContext `json:"execution_context"`
	// CycloneServerAddr is address of the Cyclone Server
	CycloneServerAddr string `json:"cyclone_server_addr"`
	// NotificationURL represents the config to send notifications after workflowruns finish.
	// It can be configured as Cyclone server notification URL to take advantage of its scenarized functions.
	NotificationURL string `json:"notification_url"`
	// DindSettings is settings for Docker in Docker
	DindSettings DindSettings `json:"dind"`
	// WorkersNumber defines workers number for various controller
	WorkersNumber WorkersNumber `json:"workers_number"`
	// ResyncPeriodSeconds defines resync period in seconds for controllers
	ResyncPeriodSeconds time.Duration `json:"resync_period_seconds"`
}

WorkflowControllerConfig configures Workflow Controller

Config is Workflow Controller config instance

Directories

Path Synopsis
pod

Jump to

Keyboard shortcuts

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