Steps, Workflows and WorkflowRuns
A workflow is a list of steps. Each step has a type, and the type decides what the step does: apply an object, wait for approval, call an HTTP endpoint, send a notification. The engine runs the steps in order, keeps the state of each one, and passes data between them. It doesn't start a pod or a job for a step: a step is a CUE template that the controller evaluates itself, so a workflow that only applies objects and waits costs no compute beyond the controller.
Where a workflow lives
The same list of steps can sit in three objects:
| Object | Holds | Run by | Runs |
|---|---|---|---|
Application (spec.workflow) | the steps that deliver the Application's components | vela-core | again on every change to the Application, which also keeps what it applied in place |
WorkflowRun (spec.workflowSpec) | a one-off list of steps | the vela-workflow controller | once. Deleting it deletes nothing its steps created |
Workflow | steps with no run of their own: a template | nothing on its own | when a WorkflowRun names it in workflowRef, or an Application in spec.workflow.ref |
This section is about the steps, which behave the same in all three. The Application parts, such as the phases around the workflow and the workflow KubeVela writes when you leave it out, are in KubeVela's Application Workflow overview.
A step
- name: deploy-prod # unique in the workflow
type: apply-deployment # a WorkflowStepDefinition
properties: # the type's parameters
image: nginx
dependsOn: [approve] # wait for other steps (DAG mode)
if: status.approve.succeeded
timeout: 10m
inputs: # take values from earlier steps
- from: image-tag
parameterKey: image
outputs: # give values to later steps
- name: deployed
valueFrom: output.value.metadata.name
Everything but name and type is optional. The guides cover each field: dependsOn, if, timeout, inputs and outputs and forEach.
A step of type step-group holds subSteps instead of properties: a group runs its sub-steps, and finishes when they have.
Step types
A step type is a WorkflowStepDefinition: a CUE template with a parameter block for the step's properties and the actions the step takes, such as kube.#Apply or http.#Do. The step's properties fill the template's parameter, an open CUE struct, so a property the template doesn't declare is ignored: a misspelt one leaves its field unset. A missing required property, or one of the wrong type, fails the step.
| Where the types come from | What you get |
|---|---|
The vela-workflow chart or addon | The built-in step types a WorkflowRun can use: apply-deployment, apply-job, apply-object, read-object, request, notification, suspend, step-group and the rest. |
| vela-core | The Application step types, such as deploy and apply-component, and most of the rest. apply-app, read-app, addon-operation, chat-gpt and apply-job come only with the chart or addon. |
| Your platform team | Types of their own, written in CUE: see Workflow Step Definition. |
The built-in types are installed in the release namespace, vela-system by default. Each type's reference entry says whether it works in an Application, a WorkflowRun or both.
Execution modes
| Mode | How steps run | Default for |
|---|---|---|
StepByStep | Each step starts when the one before it has finished. | steps |
DAG | Steps start together; dependsOn and inputs decide the order. | the subSteps of a step-group |
Set either with mode on the WorkflowRun or Workflow (workflow.mode in an Application):
spec:
mode:
steps: DAG
subSteps: StepByStep
A step with no if runs only when the steps before it succeeded, so a failure skips what comes after it. An if changes that for its own step: see If Conditions.
What a step can read
A step's template and its if condition read three things:
- Its properties, after
inputshave been filled in. - The context: the name and namespace of the run, the current step, and any values you set. See Context.
- The status of earlier steps, in
ifconditions:status.<step>.succeeded,status.<step>.failed,status.<step>.timeoutandstatus.<step>.message.
Next
- Phases and the WorkflowRun lifecycle: the phases a run and its steps go through, and what makes a step retry.
- Quick Start: run a workflow end to end.