Suspend and Resume

    In KubeVela, you can choose to use the command to manually suspend the execution of the workflow, or use a built-in special step type suspend to automatically suspend the workflow.

    If you have an application in runningWorkflow state, you want to stop the execution of the workflow, you can use vela workflow suspend to stop the workflow and use vela workflow resume to continue it.

    • Suspend the application

    tip

    Nothing will happen if you suspend an application that has already finished running workflow, which is in running status.

    Apply the following example:

    1. apiVersion: core.oam.dev/v1beta1
    2. kind: Application
    3. metadata:
    4. name: suspend-demo
    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. workflow:
    18. steps:
    19. - name: apply1
    20. properties:
    21. component: comp1
    22. - name: suspend
    23. type: suspend
    24. - name: apply2
    25. type: apply-component
    26. properties:
    27. component: comp2
    1. vela status suspend-demo

    expected output

    As you can see, when the first step is completed, the suspend step will be executed and this step will suspend the workflow.

    Resume the Workflow

    Once the workflow is suspended, you can use the vela workflow resume command to manually resume the workflow.

    Take the above suspended application as an example:

    1. vela workflow resume suspend-demo

    After successfully continuing the workflow, view the status of the app:

    1. vela status suspend-demo

    As you can see, the workflow has continued to execute.

    If you want the workflow to be continued automatically after a period of time has passed. Then, you can add a duration parameter to the suspend step. When the duration time elapses, the workflow will automatically continue execution.

    Apply the following example:

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

    Use vela status to check the status of the Application:

    1. vela status auto-resume

    expected output