github.com/argoproj/argo-events@v1.9.1/docs/sensors/triggers/argo-workflow.md (about)

     1  # Argo Workflow Trigger
     2  
     3  Argo workflow is K8s custom resource which help orchestrating parallel jobs on Kubernetes.
     4  
     5  <br/>
     6  <br/>
     7  
     8  <p align="center">
     9    <img src="https://github.com/argoproj/argo-events/blob/master/docs/assets/argo-workflow-trigger.png?raw=true" alt="Argo Workflow Trigger"/>
    10  </p>
    11  
    12  <br/>
    13  <br/>
    14  
    15  ## Trigger a workflow
    16  
    17  Note: You will need to have [Argo Workflows](https://argoproj.github.io/argo-workflows/) installed to make this work.
    18  
    19  1. Make sure to have the eventbus deployed in the namespace.
    20  
    21  1. We will use webhook event-source and sensor to trigger an Argo workflow.
    22  
    23  1. Set up the `operate-workflow-sa` service account that the sensor will use
    24  
    25          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/rbac/sensor-rbac.yaml
    26  
    27  1. Let's set up a webhook event-source to process incoming requests.
    28  
    29          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
    30  
    31  1. Create the sensor.
    32  
    33          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/special-workflow-trigger-shortened.yaml
    34  
    35  1. Let's expose the webhook event-source pod using `port-forward` so that we can make a request to it.
    36    
    37          kubectl -n argo-events port-forward <name-of-event-source-pod> 12000:12000   
    38  
    39  1. Use either Curl or Postman to send a post request to the `http://localhost:12000/example`.
    40  
    41          curl -d '{"message":"ok"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
    42  
    43  1. List the workflow using `argo list`.
    44  
    45  ## Parameterization
    46  
    47  Similar to other type of triggers, sensor offers parameterization for the Argo workflow trigger. Parameterization is specially useful when
    48  you want to define a generic trigger template in the sensor and populate the workflow object values on the fly.
    49  
    50  You can learn more about trigger parameterization [here](https://argoproj.github.io/argo-events/tutorials/02-parameterization/).
    51  
    52  ## Policy
    53  
    54  Trigger policy helps you determine the status of the triggered Argo workflow object and decide whether to stop or continue sensor.
    55  
    56  Take a look at [K8s Trigger Policy](https://argoproj.github.io/argo-events/sensors/triggers/k8s-object-trigger/#policy).
    57  
    58  ## Argo CLI
    59  
    60  In addition to the example above, you can leverage other functionalities
    61  provided by the Argo CLI such as,
    62  
    63  1. Submit
    64  1. Submit --from
    65  1. Resubmit
    66  1. Resume
    67  1. Retry
    68  1. Suspend
    69  1. Terminate
    70  1. Stop
    71  
    72  To make use of Argo CLI operations in `argoWorkflow` trigger template,
    73  
    74          argoWorkflow:
    75            operation: submit  # submit, submit-from, resubmit, resume, retry, suspend, terminate or stop
    76  
    77  Complete example is available [here](https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/special-workflow-trigger.yaml).