github.com/argoproj/argo-events@v1.9.1/docs/tutorials/03-trigger-sources.md (about) 1 # Trigger Sources 2 3 A trigger source is the source of trigger resource. It can be either external source such 4 as `Git`, `S3`, `K8s Configmap`, `File`, any valid `URL` that hosts the resource or an internal resource 5 which is defined in the sensor object itself like `Inline` or `Resource`. 6 7 In the previous sections, you have been dealing with the `Resource` trigger source. In this tutorial, we will explore other trigger sources. 8 9 ## Prerequisites 10 11 1. The `Webhook` event-source is already set up. 12 13 ## Git 14 15 Git trigger source refers to K8s trigger refers to the K8s resource stored in Git. 16 17 The specification for the Git source is available [here](https://github.com/argoproj/argo-events/blob/master/api/sensor.md#argoproj.io/v1alpha1.GitArtifact). 18 19 1. In order to fetch data from git, you need to set up the private SSH key in sensor. 20 21 2. If you don't have ssh keys available, create them following this [guide](https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent). 22 23 3. Create a K8s secret that holds the SSH keys. 24 25 kubectl -n argo-events create secret generic git-ssh --from-file=key=.ssh/<YOUR_SSH_KEY_FILE_NAME> 26 27 4. Create a K8s secret that holds known hosts. 28 29 kubectl -n argo-events create secret generic git-known-hosts --from-file=ssh_known_hosts=.ssh/known_hosts 30 31 5. Create a sensor with the git trigger source and refer it to the `hello world` workflow stored on the Argo Git project. 32 33 kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/03-trigger-sources/sensor-git.yaml 34 35 6. Use either Curl or Postman to send a post request to the `http://localhost:12000/example`. 36 37 curl -d '{"message":"ok"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example 38 39 7. Now, you should see an Argo workflow being created. 40 41 kubectl -n argo-events get wf 42 43 ## S3 44 45 You can refer to the K8s resource stored on S3 compliant store as the trigger source. 46 47 For this tutorial, lets set up a minio server which is S3 compliant store. 48 49 1. Create a K8s secret called `artifacts-minio` that holds your minio access key and secret key. 50 The access key must be stored under `accesskey` key and secret key must be stored under `secretkey`. 51 52 2. Follow steps described [here](https://github.com/minio/minio/tree/master/docs/orchestration/kubernetes#minio-deployment-on-kubernetes) to set up the minio server. 53 54 3. Make sure a service is available to expose the minio server. 55 56 4. Create a bucket called `workflows` and store a basic `hello world` Argo workflow with key name `hello-world.yaml`. 57 58 5. Create the sensor with trigger source as S3. 59 60 kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/03-trigger-sources/sensor-minio.yaml 61 62 6. Use either Curl or Postman to send a post request to the `http://localhost:12000/example`. 63 64 curl -d '{"message":"ok"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example 65 66 7. Now, you should see an Argo workflow being created. 67 68 kubectl -n argo-events get wf 69 70 ## K8s Configmap 71 72 K8s configmap can be treated as trigger source if needed. 73 74 1. Lets create a configmap called `trigger-store`. 75 76 kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/03-trigger-sources/trigger-store.yaml 77 78 2. Create a sensor with trigger source as configmap and refer it to the `trigger-store`. 79 80 kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/03-trigger-sources/sensor-cm.yaml 81 82 3. Use either Curl or Postman to send a post request to the `http://localhost:12000/example`. 83 84 curl -d '{"message":"ok"}' -H "Content-Type: application/json" -X POST http://localhost:12000/example 85 86 4. Now, you should see an Argo workflow being created. 87 88 kubectl -n argo-events get wf 89 90 ## File & URL 91 92 File and URL trigger sources are pretty self explanatory. The example sensors are available under [examples/sensors](https://github.com/argoproj/argo-events/tree/master/examples/sensors) folder.