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.6

Quick Start

This first run promotes a piece of configuration from staging to production, with a person approving in between. It shows the three things most workflows do: run steps in order, stop for approval, and pass data from one step to the next. It only writes ConfigMaps, so it runs on any cluster and pulls no images.

Needs: the vela-workflow controller (Install), and the vela CLI to resume the run.

The WorkflowRun​

promote-config.yaml
apiVersion: core.oam.dev/v1alpha1
kind: WorkflowRun
metadata:
name: promote-config
namespace: default
spec:
workflowSpec:
steps:
- name: write-staging
type: apply-object
properties:
value:
apiVersion: v1
kind: ConfigMap
metadata:
name: hello-staging
namespace: default
data:
greeting: Hello from KubeVela Workflow
logLevel: info
- name: approve
type: suspend
- name: read-staging
type: read-object
properties:
apiVersion: v1
kind: ConfigMap
name: hello-staging
outputs:
- name: staging-data
valueFrom: output.value.data
- name: write-prod
type: apply-object
inputs:
- from: staging-data
parameterKey: value.data
properties:
value:
apiVersion: v1
kind: ConfigMap
metadata:
name: hello-prod
namespace: default
StepTypeDoes
write-stagingapply-objectWrites the staging ConfigMap.
approvesuspendStops the run until someone resumes it.
read-stagingread-objectReads the staging ConfigMap back, and gives its data to later steps as the output staging-data.
write-prodapply-objectWrites the production ConfigMap, with staging-data as its data through inputs.

Run it​

kubectl apply -f promote-config.yaml
kubectl get workflowrun promote-config

The first step runs, and the run stops at approve:

NAME PHASE AGE
promote-config suspending 5s
kubectl get workflowrun promote-config \
-o jsonpath='{range .status.steps[*]}{.name}{"\t"}{.phase}{"\n"}{end}'
write-staging succeeded
approve suspending

hello-staging exists; hello-prod doesn't yet. Approve the promotion:

vela workflow resume promote-config
Successfully resume workflow: promote-config

The other two steps run, and the run finishes:

NAME PHASE AGE
promote-config succeeded 9s
write-staging succeeded
approve succeeded
read-staging succeeded
write-prod succeeded

Production now has staging's data:

kubectl get configmap hello-prod -o jsonpath='{.data}'
{"greeting":"Hello from KubeVela Workflow","logLevel":"info"}

The run is finished for good: editing it does nothing, and deleting it leaves the ConfigMaps. To run it again, vela workflow restart promote-config. The phases are listed in WorkflowRun Status.

note

vela workflow list needs KubeVela's Application CRD, and fails with no matches for kind "Application" on a cluster that has only the vela-workflow chart. vela workflow resume, suspend, terminate and restart work there; use kubectl get workflowruns to list them.

Clean up​

kubectl delete workflowrun promote-config
kubectl delete configmap hello-staging hello-prod

In an Application​

With KubeVela 1.10 installed, an Application's spec.workflow runs on the engine inside vela-core, with no vela-workflow controller. KubeVela's Application Workflow overview starts from there.

Next​