Dependency
This section will introduce how to specify dependencies for workflow steps.
note
In the version <=1.4, the steps in the workflow are executed sequentially, which means that there is an implicit dependency between steps, ie: the next step depends on the successful execution of the previous step. At this point, specifying dependencies in the workflow may not make much sense.
In versions 1.5+, you can display the execution method of the specified workflow steps (eg: change to DAG parallel execution). At this time, you can control the execution of the workflow by specifying the dependencies of the steps.
In KubeVela, the dependencies between steps can be specified by dependsOn in the steps.
For example: we want to send a message notification after deploying the component:
...workflow:steps:- name: comptype: apply-component- name: notifytype: notificationdependsOn:- comp
In this case, KubeVela waits for the completion of the step comp before executing the notify step to send a message notification.
Apply the following YAML:
apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: dependsOn-appnamespace: defaultspec:components:- name: express-servertype: webserviceproperties:image: oamdev/hello-worldports:- port: 8000workflow:steps:- name: comptype: apply-componentproperties:component: express-server- name: slack-messagetype: notificationdependsOn:- compproperties:slack:url:value: <your slack url>message:text: depends on comp
Use vela status to check the status of the Application:
$ vela status dependsAbout:Name: dependsNamespace: defaultCreated at: 2022-06-24 17:20:50 +0800 CSTStatus: runningWorkflow:mode: StepByStepfinished: trueSuspend: falseTerminated: falseSteps- id:e6votsntq3name:comptype:apply-componentphase:succeededmessage:- id:esvzxehgwcname:slack-messagetype:notificationphase:succeededmessage:Services:- Name: express-serverCluster: local Namespace: defaultType: webserviceHealthy Ready:1/1No trait applied
As you can see, all step statuses are succeeded. And when the component is successfully deployed, a message is also sent in slack.
Last updated on Feb 9, 2023 by dependabot[bot]