A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Workflow 0.7

Workflow Working Mechanism

This page covers how the workflow engine runs steps, and how it retries a step that waits or fails. It works the same in vela-core, for an Application's workflow, and in the vela-workflow controller, for a WorkflowRun.

Running Mode​

A workflow runs in one of two modes: StepByStep or DAG. In StepByStep mode, steps run one after another, in the order they are listed. In DAG mode, every step starts at once, and a step that has dependsOn or inputs waits until the steps it depends on have finished. Steps default to StepByStep and the sub-steps of a step-group to DAG; set mode to change either. See Dependency and Sub Steps.

Suspend and Retry​

The engine retries a step, or suspends the workflow, for different reasons:

  1. If a step fails or waits for a condition, the engine runs it again after a backoff time, which grows with each retry.
  2. If a step fails too many times, it stops being retried and fails with the reason FailedAfterRetries, and the workflow fails. With the EnableSuspendOnFailure feature gate on, the workflow suspends instead, and resumes when you run vela workflow resume.
  3. If a step waits for manual approval, such as a suspend step, the workflow suspends at once.

Backoff Time​

The backoff time before a retry is int(0.05 * 2^(n-1)) seconds, where n is the number of retries, and at least 1 second. The first ten are:

Times2^(n-1)0.05*2^(n-1)Requeue After(s)
110.051
220.11
340.21
480.41
5160.81
6321.61
7643.23
81286.46
925612.812
1051225.625
............

A waiting step backs off for at most 60 seconds, and a failed step for at most 300 seconds.

Maximum Retry Times​

A failed step is retried at most 10 times by default.

A step whose resources are not healthy yet is waiting, not failed, so it keeps waiting for them and never runs out of retries.

Change the limits​

Both controllers take the same flags, and both charts the same values:

FlagChart valueDefault
--max-workflow-wait-backoff-timeworkflow.backoff.maxTime.waitState60 (seconds)
--max-workflow-failed-backoff-timeworkflow.backoff.maxTime.failedState300 (seconds)
--max-workflow-step-error-retry-timesworkflow.step.errorRetryTimes10
--feature-gates=EnableSuspendOnFailure=trueworkflow.enableSuspendOnFailurefalse

For vela-core, the flags are listed with the rest of its bootstrap parameters.

Applications keep their resources in place​

While an Application's workflow runs, or waits on a condition, vela-core also re-applies the resources it has already applied, so they don't drift. This is an Application feature, not part of the engine, and a WorkflowRun does not do it. See Workflow Working Mechanism in the KubeVela docs.