github.com/oam-dev/kubevela@v1.9.11/docs/examples/workflow/README.md (about)

     1  ## Install Definitions
     2  
     3     ```
     4     kubectl apply -f definition.yaml
     5     ```
     6   Check Component and Workflow definitions:
     7  
     8     ```
     9      kubectl get componentDefinition
    10      kubectl get workflowstep
    11     ```
    12  
    13   Output:
    14     ```
    15      NAME              AGE
    16      singleton-server   49s
    17  
    18      NAME              AGE
    19      apply-component   49s
    20      apply-with-ip      49s
    21     ```
    22  
    23  
    24  ## Begin The Workflow Demo
    25  
    26  This Demo is to apply component in the cluster in order by workflow, and inject the IP of the previous pod into the environment variables of the next Pod.
    27  
    28  
    29  1. Apply Application:
    30  
    31      ```
    32      kubectl apply -f app.yaml
    33      ```
    34  
    35  
    36  
    37  2. Check workflow status in Application:
    38  
    39      ```
    40      kubectl get -f app.yaml
    41      ```
    42  
    43      Output:
    44      ```yaml
    45      ...
    46      status:  
    47        workflow:
    48          appRevision: application-sample-v1
    49          contextBackend:
    50            apiVersion: v1
    51            kind: ConfigMap
    52            name: workflow-application-sample-v1
    53            uid: 783769c9-0fe1-4686-8528-94ce2887a5f8
    54          stepIndex: 2
    55          steps:
    56          - name: deploy-server1
    57            phase: succeeded
    58            resourceRef:
    59              apiVersion: ""
    60              kind: ""
    61              name: ""
    62            type: apply
    63          - name: deploy-server2
    64            phase: succeeded
    65            resourceRef:
    66              apiVersion: ""
    67              kind: ""
    68              name: ""
    69            type: apply
    70  
    71        ```
    72  
    73  2. Check Resource in cluster.
    74  
    75      ```
    76      kubectl get pods
    77      ```
    78  
    79      Output:
    80  
    81      ```
    82      NAME       READY   STATUS    RESTARTS   AGE
    83      server1    1/1     Running   0          15s
    84      server2    1/1     Running   0          18s
    85      ```
    86  
    87      This means the resource has been rendered correctly.
    88  
    89  
    90  3. Check `server2` Environment variable
    91  
    92      ```
    93      kubectl exec server2 -- env|grep PrefixIP
    94      ```
    95  
    96      Output:
    97  
    98      ```
    99      PrefixIP=10.244.0.22
   100      ```
   101  ## WorkflowStep Definition Introduction.
   102  
   103  WorkflowStep consists of a series of actions, you can describe the actions to be done  step by step in WorkflowStep Definition.
   104  
   105  1. `op.#Load`
   106     Get component schema from workflow context
   107  2. `op.#Apply`
   108     Apply schema to cluster.
   109  3. `op.#ConditionalWait`
   110     Condition waits until continue is true.