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

     1  # Introduction
     2  
     3  In the tutorials, we will cover every aspect of Argo Events and demonstrate how
     4  you can leverage these features to build an event driven workflow pipeline. All
     5  the concepts you will learn in this tutorial and subsequent ones can be applied
     6  to any type of event-source.
     7  
     8  ## Prerequisites
     9  
    10  - Follow the installation guide to set up the Argo Events.
    11  - Make sure to configure Argo Workflow controller to listen to workflow objects created in `argo-events` namespace.
    12    (See [this](https://github.com/argoproj/argo-workflows/blob/master/docs/managed-namespace.md) link.)
    13    The Workflow Controller will need to be installed either in a cluster-scope configuration (i.e. no "--namespaced" argument) so that it has visibility 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:
    14  
    15          kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/latest/download/install.yaml
    16  
    17  - Make sure to read the concepts behind
    18    [eventbus](https://argoproj.github.io/argo-events/concepts/eventbus/).
    19    [sensor](https://argoproj.github.io/argo-events/concepts/sensor/).
    20    [event source](https://argoproj.github.io/argo-events/concepts/event_source/).
    21  - Follow the [instruction](https://github.com/argoproj/argo-events/tree/master/examples) to create a Service Account `operate-workflow-sa` with proper privileges, and make sure the Service Account used by Workflows (here we use `default` in the tutorials for demonstration purpose) has proper RBAC settings.
    22  
    23  ## Get Started
    24  
    25  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.
    26  
    27  - Let' set up the eventbus.
    28  
    29          kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/eventbus/native.yaml
    30  
    31  - Create the webhook event source.
    32  
    33          kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml
    34  
    35  - Create the webhook sensor.
    36  
    37          kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/webhook.yaml
    38  
    39  If the commands are executed successfully, the eventbus, event-source and sensor pods will get created. You will also notice that a service is created for the event-source.
    40  
    41  - Expose the event-source pod via Ingress, OpenShift Route or port forward to consume requests over HTTP.
    42  
    43          kubectl -n argo-events port-forward <event-source-pod-name> 12000:12000
    44  
    45  - Use either Curl or Postman to send a post request to the
    46  `http://localhost:12000/example`.
    47  
    48          curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example
    49  
    50  - Now, you should see an Argo workflow being created.
    51  
    52          kubectl -n argo-events get wf
    53  
    54  - Make sure the workflow pod ran successfully.
    55  
    56          _________________________________________
    57          / {"context":{"type":"webhook","specVersi \
    58          | on":"0.3","source":"webhook","e |
    59          | ventID":"38376665363064642d343336352d34 |
    60          | 3035372d393766662d366234326130656232343 |
    61          | 337","time":"2020-01-11T16:55:42.996636 |
    62          | Z","dataContentType":"application/json" |
    63          | ,"subject":"example"},"data":"eyJoZWFkZ |
    64          | XIiOnsiQWNjZXB0IjpbIiovKiJdLCJDb250ZW50 |
    65          | LUxlbmd0aCI6WyIzOCJdLCJDb250ZW50LVR5cGU |
    66          | iOlsiYXBwbGljYXRpb24vanNvbiJdLCJVc2VyLU |
    67          | FnZW50IjpbImN1cmwvNy41NC4wIl19LCJib2R5I |
    68          | jp7Im1lc3NhZ2UiOiJ0aGlzIGlzIG15IGZpcnN0 |
    69          \ IHdlYmhvb2sifX0="}                      /
    70           -----------------------------------------
    71              \
    72               \
    73                \
    74                              ##        .
    75                        ## ## ##       ==
    76                     ## ## ## ##      ===
    77                 /""""""""""""""""___/ ===
    78            ~~~ {~~ ~~~~ ~~~ ~~~~ ~~ ~ /  ===- ~~~
    79                 \______ o          __/
    80                  \    \        __/
    81                    \____\______/
    82  
    83  <b>Note:</b> You will see the message printed in the workflow logs contains both
    84  the event context and data, with data being base64 encoded. In later sections,
    85  we will see how to extract particular key-value from event context or data and
    86  pass it to the workflow as arguments.
    87  
    88  ## Troubleshoot
    89  
    90  If you don't see the event-source and sensor pod in `argo-events` namespace,
    91  
    92  1. Inspect the event-source.
    93  
    94     kubectl -n argo-events get eventsource event-source-object-name -o yaml
    95  
    96  2. Inspect the sensor.
    97  
    98     kubectl -n argo-events get sensor sensor-object-name -o yaml
    99  
   100     and look for any errors within the `Status`.
   101  
   102  3. Make sure the correct Role and RoleBindings are applied to the service
   103     account and there are no errors in both event-source and sensor controller.
   104  4. Check the logs of event-source and sensor controller. Make sure the
   105     controllers have processed the event-source and sensor objects and there are
   106     no errors.
   107  5. Raise an issue on GitHub or post a question on `argo-events` slack channel.