Version: v1.8

Timeout of Step

Timeout of Step - 图1note

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:

  1. apiVersion: core.oam.dev/v1beta1
  2. kind: Application
  3. metadata:
  4. name: timeout-example
  5. namespace: default
  6. spec:
  7. components:
  8. - name: comp1
  9. type: webservice
  10. properties:
  11. image: crccheck/hello-world
  12. port: 8000
  13. - name: comp2
  14. type: webservice
  15. properties:
  16. image: crccheck/hello-world
  17. port: 8000
  18. workflow:
  19. steps:
  20. - name: apply-comp1
  21. type: apply-component
  22. properties:
  23. component: comp1
  24. - name: suspend
  25. type: suspend
  26. timeout: 5s
  27. - name: apply-comp2
  28. type: apply-component
  29. properties:
  30. component: comp2

Use vela status to check the status of the Application:

  1. $ vela status timeout-example
  2. About:
  3. Name: timeout-example
  4. Namespace: default
  5. Created at: 2022-06-25 00:51:43 +0800 CST
  6. Status: workflowTerminated
  7. Workflow:
  8. mode: StepByStep
  9. finished: true
  10. Suspend: false
  11. Terminated: true
  12. Steps
  13. - id:1f58n13qdp
  14. name:apply-comp1
  15. type:apply-component
  16. phase:succeeded
  17. message:
  18. - id:1pfije4ugt
  19. name:suspend
  20. type:suspend
  21. phase:failed
  22. message:
  23. - id:lqxyenjxj4
  24. name:apply-comp2
  25. type:apply-component
  26. phase:skipped
  27. message:
  28. Services:
  29. - Name: comp1
  30. Cluster: local Namespace: default
  31. Type: webservice
  32. Healthy Ready:1/1
  33. No 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 May 6, 2023 by Tianxin Dong