...

Package controllers

import "github.com/chaos-mesh/chaos-mesh/pkg/workflow/controllers"
Overview
Index

Overview ▾

Index ▾

Variables
func BootstrapWorkflowControllers(mgr manager.Manager, logger logr.Logger, recorderBuilder *recorder.RecorderBuilder) error
func ConditionEqualsTo(status v1alpha1.WorkflowNodeStatus, conditionType v1alpha1.WorkflowNodeConditionType, expected corev1.ConditionStatus) bool
func GetCondition(status v1alpha1.WorkflowNodeStatus, conditionType v1alpha1.WorkflowNodeConditionType) *v1alpha1.WorkflowNodeCondition
func GetWorkflowCondition(status v1alpha1.WorkflowStatus, conditionType v1alpha1.WorkflowConditionType) *v1alpha1.WorkflowCondition
func SetCondition(status *v1alpha1.WorkflowNodeStatus, condition v1alpha1.WorkflowNodeCondition)
func SetWorkflowCondition(status *v1alpha1.WorkflowStatus, condition v1alpha1.WorkflowCondition)
func WorkflowAborted(workflow v1alpha1.Workflow) bool
func WorkflowConditionEqualsTo(status v1alpha1.WorkflowStatus, conditionType v1alpha1.WorkflowConditionType, expected corev1.ConditionStatus) bool
func WorkflowNodeFinished(status v1alpha1.WorkflowNodeStatus) bool
type AbortNodeReconciler
    func NewAbortNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *AbortNodeReconciler
    func (it *AbortNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type AbortWorkflowReconciler
    func NewAbortWorkflowReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *AbortWorkflowReconciler
    func (it *AbortWorkflowReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type ChaosNodeReconciler
    func NewChaosNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *ChaosNodeReconciler
    func (it *ChaosNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type ChildNodesFetcher
    func NewChildNodesFetcher(kubeClient client.Client, logger logr.Logger) *ChildNodesFetcher
type DeadlineReconciler
    func NewDeadlineReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *DeadlineReconciler
    func (it *DeadlineReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type ParallelNodeReconciler
    func NewParallelNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *ParallelNodeReconciler
    func (it *ParallelNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type SerialNodeReconciler
    func NewSerialNodeReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *SerialNodeReconciler
    func (it *SerialNodeReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type SortByCreationTimestamp
    func (it SortByCreationTimestamp) Len() int
    func (it SortByCreationTimestamp) Less(i, j int) bool
    func (it SortByCreationTimestamp) Swap(i, j int)
type SortGenericChaosByCreationTimestamp
    func (it SortGenericChaosByCreationTimestamp) Len() int
    func (it SortGenericChaosByCreationTimestamp) Less(i, j int) bool
    func (it SortGenericChaosByCreationTimestamp) Swap(i, j int)
type SortScheduleByCreationTimestamp
    func (it SortScheduleByCreationTimestamp) Len() int
    func (it SortScheduleByCreationTimestamp) Less(i, j int) bool
    func (it SortScheduleByCreationTimestamp) Swap(i, j int)
type StatusCheckReconciler
    func NewStatusCheckReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *StatusCheckReconciler
    func (it *StatusCheckReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
type TaskReconciler
    func NewTaskReconciler(kubeClient client.Client, restConfig *rest.Config, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *TaskReconciler
    func (it *TaskReconciler) FetchPodControlledByThisWorkflowNode(ctx context.Context, node v1alpha1.WorkflowNode) ([]corev1.Pod, error)
    func (it *TaskReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)
    func (it *TaskReconciler) SpawnTaskPod(ctx context.Context, node *v1alpha1.WorkflowNode, workflow *v1alpha1.Workflow) (*corev1.Pod, error)
type WorkflowEntryReconciler
    func NewWorkflowEntryReconciler(kubeClient client.Client, eventRecorder recorder.ChaosRecorder, logger logr.Logger) *WorkflowEntryReconciler
    func (it *WorkflowEntryReconciler) Reconcile(ctx context.Context, request reconcile.Request) (reconcile.Result, error)

Package files

abort_node_reconciler.go abort_workflow_reconciler.go bootstrap.go chaos_node_reconciler.go deadline_reconciler.go new_node.go parallel_node_reconciler.go serial_node_reconciler.go statuscheck_reconciler.go task_reconciler.go utils.go workflow_entry_reconciler.go

Variables

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

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 GetCondition

func GetCondition(status v1alpha1.WorkflowNodeStatus, conditionType v1alpha1.WorkflowNodeConditionType) *v1alpha1.WorkflowNodeCondition

func GetWorkflowCondition

func GetWorkflowCondition(status v1alpha1.WorkflowStatus, conditionType v1alpha1.WorkflowConditionType) *v1alpha1.WorkflowCondition

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

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

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

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

ParallelNodeReconciler watches on nodes which type is Parallel

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

func NewParallelNodeReconciler

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

func (*ParallelNodeReconciler) Reconcile

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

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

type SerialNodeReconciler

SerialNodeReconciler watches on nodes which type is Serial

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

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 (it SortGenericChaosByCreationTimestamp) Len() int

func (SortGenericChaosByCreationTimestamp) Less

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

func (SortGenericChaosByCreationTimestamp) Swap

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

type SortScheduleByCreationTimestamp

type SortScheduleByCreationTimestamp []v1alpha1.Schedule

func (SortScheduleByCreationTimestamp) Len

func (it SortScheduleByCreationTimestamp) Len() int

func (SortScheduleByCreationTimestamp) Less

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

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

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

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

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

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

func NewWorkflowEntryReconciler

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

func (*WorkflowEntryReconciler) Reconcile

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