Timeout of Step
note
You need to upgrade to version 1.5+ to use the timeout feature.
This section introduces how to add timeout to workflow steps in KubeVela.
In KubeVela workflow, each step can specify a timeout, you can use timeout to specify the timeout time for the step.
timeout follows the duration format, e.g. 30s, 1m, etc. You can refer to Golang’s parseDuration.
If a step is not completed within the specified time, KubeVela will set the status of the step to failed and the Reason of the step will be set to Timeout.
Apply the following example:
apiVersion: core.oam.dev/v1beta1kind: Applicationmetadata:name: timeout-examplenamespace: defaultspec:components:- name: comp1type: webserviceproperties:image: crccheck/hello-worldport: 8000- name: comp2type: webserviceproperties:image: crccheck/hello-worldport: 8000workflow:steps:- name: apply-comp1type: apply-componentproperties:component: comp1- name: suspendtype: suspendtimeout: 5s- name: apply-comp2type: apply-componentproperties:component: comp2
Use vela status to check the status of the Application:
$ vela status timeout-exampleAbout:Name: timeout-exampleNamespace: defaultCreated at: 2022-06-25 00:51:43 +0800 CSTStatus: workflowTerminatedWorkflow:mode: StepByStepfinished: trueSuspend: falseTerminated: trueSteps- id:1f58n13qdpname:apply-comp1type:apply-componentphase:succeededmessage:- id:1pfije4ugtname:suspendtype:suspendphase:failedmessage:- id:lqxyenjxj4name:apply-comp2type:apply-componentphase:skippedmessage:Services:- Name: comp1Cluster: local Namespace: defaultType: webserviceHealthy Ready:1/1No trait applied
As you can see, when the first component is successfully deployed, the workflow is suspended on the second suspend step. The suspend step is set with a timeout of five seconds. If the workflow is not resumed within five seconds, the step will fail because of timeout. The third step is skipped because the previous suspend step failed.
Last updated on Feb 9, 2023 by dependabot[bot]