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

     1  # Getting Started
     2  
     3  We are going to set up a sensor and event-source for webhook. The goal is to trigger an Argo workflow upon an HTTP Post request.
     4  
     5  Note: You will need to have [Argo Workflows](https://argoproj.github.io/argo-workflows/) installed to make this work.
     6  The Argo Workflow controller will need to be configured to listen for Workflow objects created in `argo-events` namespace.
     7    (See [this](https://github.com/argoproj/argo-workflows/blob/master/docs/managed-namespace.md) link.)
     8    The Workflow Controller will need to be installed either in a cluster-scope configuration (i.e. no "--namespaced" argument) so that it has visiblity to all namespaces, or with "--managed-namespace" set to define "argo-events" as a namespace it has visibility to. To deploy Argo Workflows with a cluster-scope configuration you can use this installation yaml file:
     9  
    10          kubectl create namespace argo
    11          kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v<<ARGO_WORKFLOWS_VERSION>>/install.yaml
    12  
    13  1. Install Argo Events
    14  
    15          kubectl create namespace argo-events
    16          kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install.yaml
    17          # Install with a validating admission controller
    18          kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install-validating-webhook.yaml
    19  
    20  
    21  1. Make sure to have the eventbus pods running in the namespace. Run following command to create the eventbus.
    22  
    23          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/eventbus/native.yaml
    24  
    25  1. Setup event-source for webhook as follows.
    26  
    27          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
    28  
    29     The above event-source contains a single event configuration that runs an HTTP server on port `12000` with endpoint `example`.
    30  
    31     After running the above command, the event-source controller will create a pod and service.
    32  
    33  1. Create a service account with RBAC settings to allow the sensor to trigger workflows, and allow workflows to function.
    34  
    35           # sensor rbac
    36          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/rbac/sensor-rbac.yaml
    37           # workflow rbac
    38          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/rbac/workflow-rbac.yaml
    39  
    40  1. Create webhook sensor.
    41  
    42          kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/webhook.yaml
    43  
    44     Once the sensor object is created, sensor controller will create corresponding pod and a service.
    45  
    46  1. Expose the event-source pod via Ingress, OpenShift Route or port forward to consume requests over HTTP.
    47  
    48          kubectl -n argo-events port-forward $(kubectl -n argo-events get pod -l eventsource-name=webhook -o name) 12000:12000 &
    49  
    50  1. Use either Curl or Postman to send a post request to the <http://localhost:12000/example>.
    51  
    52          curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
    53  
    54  1. Verify that an Argo workflow was triggered.
    55  
    56          kubectl -n argo-events get workflows | grep "webhook"