controllers

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ApiVersion       = v1alpha1.GroupVersion.String()
	KindWorkflow     = "Workflow"
	KindWorkflowNode = "WorkflowNode"
)

Functions

func BootstrapWorkflowControllers

func BootstrapWorkflowControllers(mgr manager.Manager, logger logr.Logger, recorderBuilder *recorder.RecorderBuilder) error

func ConditionEqualsTo

func ConditionEqualsTo(status v1alpha1.WorkflowNodeStatus, conditionType v1alpha1.WorkflowNodeConditionType, expected corev1.ConditionStatus) bool

func SetCondition

func SetCondition(status *v1alpha1.WorkflowNodeStatus, condition v1alpha1.WorkflowNodeCondition)

func SetWorkflowCondition

func SetWorkflowCondition(status *v1alpha1.WorkflowStatus, condition v1alpha1.WorkflowCondition)

func WorkflowAborted

func WorkflowAborted(workflow v1alpha1.Workflow) bool

func WorkflowConditionEqualsTo

func WorkflowConditionEqualsTo(status v1alpha1.WorkflowStatus, conditionType v1alpha1.WorkflowConditionType, expected corev1.ConditionStatus) bool

func WorkflowNodeFinished

func WorkflowNodeFinished(status v1alpha1.WorkflowNodeStatus) bool

Types

type AbortNodeReconciler

type AbortNodeReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

func NewAbortNodeReconciler

func NewAbortNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *AbortNodeReconciler

func (*AbortNodeReconciler) Reconcile

func (it *AbortNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile watches `WorkflowNodes`, if: 1. the abort condition is `False`, just return. 2. the abort condition is `True`, the node is not `TypeStatusCheck`, it will propagate abort condition to children nodes. 3. the abort condition is `True`, the node is `TypeStatusCheck`, it will add abort annotation to the parent workflow.

type AbortWorkflowReconciler

type AbortWorkflowReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

func NewAbortWorkflowReconciler

func NewAbortWorkflowReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *AbortWorkflowReconciler

func (*AbortWorkflowReconciler) Reconcile

Reconcile watches `Workflows`, if the workflow has the abort annotation, it will set the abort condition of the `entry node` to `True`.

type ChaosNodeReconciler

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

func NewChaosNodeReconciler

func NewChaosNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *ChaosNodeReconciler

func (*ChaosNodeReconciler) Reconcile

func (it *ChaosNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

type ChildNodesFetcher

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

func NewChildNodesFetcher

func NewChildNodesFetcher(kubeClient client.Client, logger logr.Logger) *ChildNodesFetcher

type DeadlineReconciler

type DeadlineReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

func NewDeadlineReconciler

func NewDeadlineReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *DeadlineReconciler

func (*DeadlineReconciler) Reconcile

func (it *DeadlineReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

type ParallelNodeReconciler

type ParallelNodeReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

ParallelNodeReconciler watches on nodes which type is Parallel

func NewParallelNodeReconciler

func NewParallelNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *ParallelNodeReconciler

func (*ParallelNodeReconciler) Reconcile

Reconcile is extremely like the one in SerialNodeReconciler, only allows the parallel schedule, and respawn **all** the children tasks during retry

type SerialNodeReconciler

type SerialNodeReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

SerialNodeReconciler watches on nodes which type is Serial

func NewSerialNodeReconciler

func NewSerialNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *SerialNodeReconciler

func (*SerialNodeReconciler) Reconcile

func (it *SerialNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Reconcile should be invoked by: changes on a serial node, or changes on a node which controlled by serial node. So we need to setup EnqueueRequestForOwner while setting up this reconciler.

Reconcile does these things: 1. walk through on tasks in spec, compare them with the node instances (listed with v1alpha1.LabelControlledBy), remove the outdated instance; 2. find out the node needs to be created, then create one if exists; 3. update the status of serial node;

In this reconciler, we SHOULD NOT use v1alpha1.WorkflowNodeStatus as the state. Because v1alpha1.WorkflowNodeStatus is generated by this reconciler, if that itself also depends on that state, it will be complex to decide when to update the status, and even require to update status more than one time, that sounds not good. And We MUST update v1alpha1.WorkflowNodeStatus by "observing real world" at EACH TIME, such as listing controlled children nodes. We only update v1alpha1.WorkflowNodeStatus once(wrapped with retry on conflict), at the end of this method.

type SortByCreationTimestamp

type SortByCreationTimestamp []v1alpha1.WorkflowNode

func (SortByCreationTimestamp) Len

func (it SortByCreationTimestamp) Len() int

func (SortByCreationTimestamp) Less

func (it SortByCreationTimestamp) Less(i, j int) bool

func (SortByCreationTimestamp) Swap

func (it SortByCreationTimestamp) Swap(i, j int)

type SortGenericChaosByCreationTimestamp

type SortGenericChaosByCreationTimestamp []v1alpha1.GenericChaos

func (SortGenericChaosByCreationTimestamp) Len

func (SortGenericChaosByCreationTimestamp) Less

func (SortGenericChaosByCreationTimestamp) Swap

type SortScheduleByCreationTimestamp

type SortScheduleByCreationTimestamp []v1alpha1.Schedule

func (SortScheduleByCreationTimestamp) Len

func (SortScheduleByCreationTimestamp) Less

func (SortScheduleByCreationTimestamp) Swap

func (it SortScheduleByCreationTimestamp) Swap(i, j int)

type StatusCheckReconciler

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

func NewStatusCheckReconciler

func NewStatusCheckReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *StatusCheckReconciler

func (*StatusCheckReconciler) Reconcile

type TaskReconciler

type TaskReconciler struct {
	*ChildNodesFetcher
	// contains filtered or unexported fields
}

func NewTaskReconciler

func NewTaskReconciler(kubeClient client.Client, restConfig *rest.Config, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *TaskReconciler

func (*TaskReconciler) FetchPodControlledByThisWorkflowNode

func (it *TaskReconciler) FetchPodControlledByThisWorkflowNode(ctx context.Context, node v1alpha1.WorkflowNode) ([]corev1.Pod, error)

func (*TaskReconciler) Reconcile

func (it *TaskReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

func (*TaskReconciler) SpawnTaskPod

func (it *TaskReconciler) SpawnTaskPod(ctx context.Context, node *v1alpha1.WorkflowNode, workflow *v1alpha1.Workflow) (*corev1.Pod, error)

type WorkflowEntryReconciler

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

WorkflowEntryReconciler watches on Workflow, creates new Entry Node for created Workflow.

func NewWorkflowEntryReconciler

func NewWorkflowEntryReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *WorkflowEntryReconciler

func (*WorkflowEntryReconciler) Reconcile

Jump to

Keyboard shortcuts

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