### Create Kustomization for Cluster Installation Source: https://github.com/argoproj/argo-events/blob/master/docs/developer_guide.md Create a `kustomization.yaml` file for cluster-based installation, starting with the default install resources. ```bash kustomize create --resources manifests/install.yaml ``` -------------------------------- ### Install via Helm Source: https://github.com/argoproj/argo-events/blob/master/docs/installation.md Commands to add the repository and install the Argo Events chart. ```bash helm repo add argo https://argoproj.github.io/argo-helm ``` ```bash helm install argo-events argo/argo-events -n argo-events --create-namespace ``` -------------------------------- ### Install Azure Service Bus Client Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/azure-service-bus.md Command to install the required Python library. ```bash python -m pip install azure-servicebus --upgrade ``` -------------------------------- ### Install Webhook Event Source Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/webhook.md Install the Webhook event source using kubectl. Ensure you are in the `argo-events` namespace. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml ``` -------------------------------- ### Start Minikube and Configure Docker Source: https://github.com/argoproj/argo-events/blob/master/docs/developer_guide.md Start a Minikube cluster and configure your Docker client to use Minikube's Docker daemon. This is necessary for building container images locally. ```bash minikube start eval $(minikube docker-env) ``` -------------------------------- ### Install Calendar Event-Source Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/calendar.md Installs the Calendar event-source into the argo-events namespace using kubectl. Ensure argo-events is already set up. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/calendar.yaml ``` -------------------------------- ### Install Pika Library Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/amqp.md Command to install the Pika Python library for RabbitMQ interaction. ```bash python -m pip install pika --upgrade ``` -------------------------------- ### Kustomize Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/installation.md Example kustomization.yaml base configuration. ```yaml bases: - github.com/argoproj/argo-events/manifests/cluster-install # OR - github.com/argoproj/argo-events/manifests/namespace-install ``` -------------------------------- ### Install Sensor for Webhook Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/webhook.md Apply the sensor configuration to process events from the Webhook event source. This should be done after the event source is installed and running. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/webhook.yaml ``` -------------------------------- ### Install Argo Workflows Source: https://github.com/argoproj/argo-events/blob/master/docs/quick_start.md Installs Argo Workflows using a specified version. Ensure Argo Workflows is installed before proceeding with Argo Events. ```bash export ARGO_WORKFLOWS_VERSION=3.5.4 kubectl create namespace argo kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/download/v$ARGO_WORKFLOWS_VERSION/install.yaml ``` -------------------------------- ### Example Event Log Output Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/k8s-object-trigger.md Sample JSON output showing the event context and data after processing. ```json { "context": { "type": "webhook", "specVersion": "0.3", "source": "webhook", "eventID": "30306463666539362d346666642d343336332d383861312d336538363333613564313932", "time": "2020-01-11T21:23:07.682961Z", "dataContentType": "application/json", "subject": "example" }, "data": "eyJoZWFkZXIiOnsiQWNjZXB0IjpbIiovKiJdLCJDb250ZW50LUxlbmd0aCI6WyIxOSJdLCJDb250ZW50LVR5cGUiOlsiYXBwbGljYXRpb24vanNvbiJdLCJVc2VyLUFnZW50IjpbImN1cmwvNy41NC4wIl19LCJib2R5Ijp7Im1lc3NhZ2UiOiJoZXkhISJ9fQ==" } ``` -------------------------------- ### CI/CD Integration with GitHub Actions Source: https://github.com/argoproj/argo-events/blob/master/docs/lint.md Integrate Argo Events resource linting into a GitHub Actions workflow. This example checks out the code, sets up Go, installs argo-events, and then lints resources recursively. ```yaml name: Lint Argo Events Resources on: [push, pull_request] jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.20' - name: Install argo-events run: | git clone https://github.com/argoproj/argo-events.git cd argo-events make build sudo mv dist/argo-events /usr/local/bin/ - name: Lint EventSources and Sensors run: argo-events lint -R manifests/ ``` -------------------------------- ### Duplicate Dependencies Example Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/more-about-sensors-and-triggers.md This example demonstrates disallowed duplicate dependencies within a single Sensor object when using NATS Streaming. Ensure unique eventSourceName and eventName combinations per Sensor. ```yaml spec: dependencies: - name: dep01 eventSourceName: webhook eventName: example filters: data: - path: body.value type: number comparator: "<" value: - "20.0" - name: dep02 eventSourceName: webhook eventName: example filters: data: - path: body.value type: number comparator: ">" value: - "50.0" ``` -------------------------------- ### Example GitLab Project Webhook Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/gitlab.md Configure a GitLab event-source to listen for specific events from a project. This example includes IssuesEvents, MergeRequestsEvents, and EmojiEvents. ```yaml gitlab: example: projects: - "my-project" events: - IssuesEvents - MergeRequestsEvents - EmojiEvents ``` -------------------------------- ### Install Argo Workflows Controller Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/01-introduction.md Deploys the Argo Workflows controller with cluster-scope configuration. ```bash kubectl apply -n argo -f https://github.com/argoproj/argo-workflows/releases/latest/download/install.yaml ``` -------------------------------- ### Install Argo Events Source: https://github.com/argoproj/argo-events/blob/master/docs/quick_start.md Installs Argo Events and optionally the validating admission controller. This is a prerequisite for using Argo Events. ```bash kubectl create namespace argo-events kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install.yaml # Install with a validating admission controller kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install-validating-webhook.yaml ``` -------------------------------- ### Go HTTP Server Example Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/http-trigger.md A basic Go HTTP server that reads the request body, prints it, and sends a 'hello' response. This server is used to demonstrate receiving events via HTTP. ```go package main import ( "fmt" "io" "net/http" ) func hello(w http.ResponseWriter, req *http.Request) { body, err := io.ReadAll(req.Body) if err != nil { fmt.Printf("%+v\n", err) return } fmt.Println(string(body)) fmt.Fprintf(w, "hello\n") } func main() { http.HandleFunc("/hello", hello) fmt.Println("server is listening on 8090") http.ListenAndServe(":8090", nil) } ``` -------------------------------- ### Install Argo Events Cluster-wide Source: https://github.com/argoproj/argo-events/blob/master/manifests/README.md Deploys Argo Events controllers to operate across all namespaces. ```sh kubectl create ns argo-events kubectl apply -f ./install.yaml ``` -------------------------------- ### Install Validating Webhook Source: https://github.com/argoproj/argo-events/blob/master/docs/validating-admission-webhook.md Use this command to install the validating webhook. Ensure you replace `{version}` with the desired Argo Events version. ```shell kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/{version}/manifests/install-validating-webhook.yaml ``` -------------------------------- ### Kubeless Function Output Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/http-trigger.md Example output log from the Kubeless function execution. ```text {'event-time': None, 'extensions': {'request': }, 'event-type': None, 'event-namespace': None, 'data': '{"first_name":"foo","last_name":"bar"}', 'event-id': None} ``` -------------------------------- ### Example GitLab Group Webhook Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/gitlab.md Configure a GitLab event-source to listen for specific events from all projects within a group. This example includes IssuesEvents, MergeRequestsEvents, and EmojiEvents. ```yaml gitlab: example: groups: - "my-group-name" events: - IssuesEvents - MergeRequestsEvents - EmojiEvents ``` -------------------------------- ### Subscribe to NATS Subject Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/nats-trigger.md Example command to run a NATS subscriber using the go-nats-examples library to listen for messages on a specific subject. ```bash go run main.go -s localhost minio-events ``` -------------------------------- ### Example Workflow Log Output Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/01-introduction.md Sample JSON output from the workflow logs showing event context and base64 encoded data. ```json { "context": { "type": "webhook", "specVersion": "0.3", "source": "webhook", "eventID": "38376665363064642d343336352d343035372d393766662d366234326130656232343337", "time": "2020-01-11T16:55:42.996636Z", "dataContentType": "application/json", "subject": "example" }, "data": "eyJoZWFkZXIiOnsiQWNjZXB0IjpbIiovKiJdLCJDb250ZW50LUxlbmd0aCI6WyIzOCJdLCJDb250ZW50LVR5cGUiOlsiYXBwbGljYXRpb24vanNvbiJdLCJVc2VyLUFnZW50IjpbImN1cmwvNy41NC4wIl19LCJib2R5Ijp7Im1lc3NhZ2UiOiJ0aGlzIGlzIG15IGZpcnN0IHdlYmhvb2sifX0=" } ``` -------------------------------- ### Deploy Argo Events Components Source: https://github.com/argoproj/argo-events/blob/master/docs/installation.md Applies the manifest files to install Argo Events controllers and resources. ```bash kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install.yaml # Install with a validating admission controller kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install-validating-webhook.yaml ``` ```bash kubectl apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/namespace-install.yaml ``` -------------------------------- ### Apply Slack Trigger Sensor Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/slack-trigger.md Apply the example sensor configuration for the Slack trigger. This sets up the basic sensor that will be used to send messages. ```yaml kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/slack-trigger.yaml ``` -------------------------------- ### Multi-path Filtering Example Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/filters/data.md Demonstrates filtering based on multiple paths within the event data, combining conditions using a string value and regex. ```yaml filters: data: - path: 'body.action,body.labels.#(name=="Webhook").name,body.labels.#(name=="Approved").name' type: string value: - '"opened","Webhook"' - '"closed","Webhook","Approved"' ``` -------------------------------- ### More Involved Jetstream EventBus Example Source: https://github.com/argoproj/argo-events/blob/master/docs/eventbus/jetstream.md An advanced configuration for an EventBus using Jetstream, including specifying the number of replicas, persistence settings, stream configuration, operational settings, and start arguments for debugging. ```yaml apiVersion: argoproj.io/v1alpha1 kind: EventBus metadata: name: default spec: jetstream: version: latest # Do NOT use "latest" but a specific version in your real deployment replicas: 5 persistence: # optional storageClassName: standard accessMode: ReadWriteOnce volumeSize: 10Gi streamConfig: | # see default values in argo-events-controller-config maxAge: 24h settings: | max_file_store: 1GB # see default values in argo-events-controller-config startArgs: - "-D" # debug-level logs ``` -------------------------------- ### Create Test File Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/file.md Commands to create a sample file within the monitored directory inside the pod. ```bash cd test-data cat < x.txt hello EOF ``` -------------------------------- ### Create NSQ Topic Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/nsq.md Create a topic named 'hello' on the NSQD instance. This is a prerequisite for publishing messages. ```bash curl -X POST 'http://localhost:4151/topic/create?topic=hello' ``` -------------------------------- ### Example Expr Expressions Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/filters/expr.md Illustrative examples of expressions that can be used with the govaluate library for event data filtering. ```string action =~ "start" ``` ```string action == "end" && started == true ``` ```string action =~ "start" || (started == true && instances == 2) ``` -------------------------------- ### Deploy NSQ Daemon (Deployment) Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/nsq.md Sets up the nsqd component using a Deployment. It mounts a data directory, configures probes, and specifies the lookupd address. ```yaml apiVersion: apps/v1beta1 kind: Deployment metadata: name: nsqd spec: replicas: 1 selector: matchLabels: app: nsq component: nsqd template: metadata: labels: app: nsq component: nsqd spec: containers: - name: nsqd image: nsqio/nsq:v1.1.0 imagePullPolicy: Always resources: requests: cpu: 30m memory: 64Mi ports: - containerPort: 4150 name: tcp - containerPort: 4151 name: http livenessProbe: httpGet: path: /ping port: http initialDelaySeconds: 5 readinessProbe: httpGet: path: /ping port: http initialDelaySeconds: 2 volumeMounts: - name: datadir mountPath: /data command: - /nsqd - -data-path - /data - -lookupd-tcp-address - nsqlookupd.argo-events.svc:4160 - -broadcast-address - nsqd.argo-events.svc env: - name: HOSTNAME valueFrom: fieldRef: fieldPath: metadata.name terminationGracePeriodSeconds: 5 volumes: - name: datadir emptyDir: {} --- ``` -------------------------------- ### Received NATS Message Example Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/nats-trigger.md This is an example of a message received on the 'minio-events' NATS subject after a file drop event. ```text [#1] Received on [minio-events]: '{"bucket":"input","fileName":"hello.txt"}' ``` -------------------------------- ### Redis Streams Event Structure Example Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/redis-streams.md This is an example of the event structure dispatched by the Redis Streams event-source over the eventbus. ```json { "context": { "id": "64313638396337352d623565612d343639302d383262362d306630333562333437363637", "source": "redis-stream", "specversion": "1.0", "type": "redisStream", "datacontenttype": "application/json", "subject": "example", "time": "2022-03-17T04:47:42Z" }, "data": { "stream":"FOO", "message_id":"1647495121754-0", "values": {"key-1":"val-1", "key-2":"val-2"} } } ``` -------------------------------- ### Configure Minio Client Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/minio.md Add the Minio host to the local Minio client configuration. ```bash mc config host add minio http://localhost:9000 minio minio123 ``` -------------------------------- ### Deploy NSQ Lookup Daemon (StatefulSet) Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/nsq.md Configures the nsqlookupd component using a StatefulSet. Includes liveness and readiness probes, and specifies the NSQ image. ```yaml apiVersion: apps/v1beta1 kind: StatefulSet metadata: name: nsqlookupd spec: serviceName: "nsqlookupd" replicas: 1 updateStrategy: type: RollingUpdate template: metadata: labels: app: nsq component: nsqlookupd spec: containers: - name: nsqlookupd image: nsqio/nsq:v1.1.0 imagePullPolicy: Always resources: requests: cpu: 30m memory: 64Mi ports: - containerPort: 4160 name: tcp - containerPort: 4161 name: http livenessProbe: httpGet: path: /ping port: http initialDelaySeconds: 5 readinessProbe: httpGet: path: /ping port: http initialDelaySeconds: 2 command: - /nsqlookupd terminationGracePeriodSeconds: 5 ``` -------------------------------- ### Deploy Event Source and Sensor Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/minio.md Apply the event source and sensor configurations to the cluster. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/minio.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/minio.yaml ``` -------------------------------- ### Run Events Generator Help Source: https://github.com/argoproj/argo-events/blob/master/test/stress/generator/README.md Displays the help menu and available commands for the stress testing generator. ```shell go run test/stress/generator/main.go --help ``` -------------------------------- ### EventSource Validation Error Example Source: https://github.com/argoproj/argo-events/blob/master/docs/lint.md An example of a common EventSource validation error where the 'endpoint' field is missing. The solution is to ensure all required fields are provided. ```bash ✗ webhook.yaml: EventSource validation failed Error: endpoint can't be empty ``` -------------------------------- ### Build and Run argo-events Lint Source: https://github.com/argoproj/argo-events/blob/master/docs/lint.md Build the argo-events binary from source and then run the lint command with the help flag to see available options. ```bash # Build from source make build # Use the binary ./dist/argo-events lint --help ``` -------------------------------- ### Example: NATS EventBus without ClusterID Source: https://github.com/argoproj/argo-events/blob/master/docs/validating-admission-webhook.md This example demonstrates creating an 'exotic' NATS EventBus without the required 'ClusterID' field, which will be rejected by the validating webhook. ```shell cat < apiVersion: argoproj.io/v1alpha1 > kind: EventBus > metadata: > name: default > spec: > nats: > exotic: {} > EOF Error from server (BadRequest): error when creating "STDIN": admission webhook "webhook.argo-events.argoproj.io" denied the request: "spec.nats.exotic.clusterID" is missing ``` -------------------------------- ### Example Sensor for GitLab Events Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/gitlab.md An example sensor configuration to trigger an Argo workflow when a GitLab event occurs. This sensor is designed to work with the GitLab event-source. ```yaml https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/gitlab.yaml ``` -------------------------------- ### Create Minio Bucket Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/minio.md Create a new bucket named 'input' using the Minio client. ```bash mc mb minio/input ``` -------------------------------- ### Example: Prohibited Auth Strategy Update Source: https://github.com/argoproj/argo-events/blob/master/docs/validating-admission-webhook.md This example shows an attempt to update the 'auth' field for a native NATS EventBus, which is an immutable field and will be denied by the validating webhook. ```shell Error from server (BadRequest): error when applying patch: {"metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"argoproj.io/v1alpha1\",\"kind\":\"EventBus\",\"metadata\":{\"annotations\":{},\"name\":\"default\",\"namespace\":\"argo-events\"},\"spec\":{\"nats\":{\"native\":{\"replicas\":3}}}}"}},"spec":{"nats":{"native":{\"auth\":null,\"maxAge\":null,\"securityContext\":null}}}} to: Resource: "argoproj.io/v1alpha1, Resource=eventbus", GroupVersionKind: "argoproj.io/v1alpha1, Kind=EventBus" Name: "default", Namespace: "argo-events" for: "test-eventbus.yaml": admission webhook "webhook.argo-events.argoproj.io" denied the request: "spec.nats.native.auth" is immutable, can not be updated ``` -------------------------------- ### Deploy Kubernetes Resources Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/azure-service-bus.md Commands to apply the secret, event source, and sensor configurations. ```bash kubectl -n argo-events apply -f azure-secret.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/azure-service-bus.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/azure-service-bus.yaml ``` -------------------------------- ### Sensor Validation Error Example Source: https://github.com/argoproj/argo-events/blob/master/docs/lint.md An example of a common Sensor validation error indicating that no triggers were found. The solution is to add at least one trigger to the sensor specification. ```bash ✗ sensor.yaml: Sensor validation failed Error: no triggers found ``` -------------------------------- ### Create Sensor Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/bitbucketserver.md Apply the sensor configuration to trigger workflows based on Bitbucket events. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/master/examples/sensors/bitbucketserver.yaml ``` -------------------------------- ### Apply Event Sources and Sensors Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/06-trigger-conditions.md Commands to deploy event sources and sensors for testing trigger conditions. ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/06-trigger-conditions/webhook-event-source.yaml ``` ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/06-trigger-conditions/minio-event-source.yaml ``` ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/06-trigger-conditions/sensor-01.yaml ``` ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/06-trigger-conditions/sensor-02.yaml ``` -------------------------------- ### Deploy Event Source and Sensor Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/amqp.md Commands to apply the AMQP event source and sensor configurations. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/amqp.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/amqp.yaml ``` -------------------------------- ### Deploying and Testing Script Filters Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/filters/script.md Commands to deploy event sources and sensors, and test the filtering logic via HTTP requests. ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml ``` ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/filter-script.yaml ``` ```bash kubectl port-forward svc/webhook-eventsource-svc 12000 curl -d '{"hello": "world"}' -X POST http://localhost:12000/example ``` ```bash curl -X POST -d '{"a": "b", "d": {"e": "z"}}' http://localhost:12000/example ``` -------------------------------- ### Run Stress Test with New Resources Source: https://github.com/argoproj/argo-events/blob/master/test/stress/README.md Creates a webhook EventSource and log trigger Sensor, runs for 5 minutes, and generates a report. ```shell go run ./test/stress/main.go --eb-type jetstream --es-type webhook --trigger-type log --hard-timeout 5m ``` -------------------------------- ### Troubleshoot Resources Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/01-introduction.md Commands to inspect event source and sensor objects for debugging. ```bash kubectl -n argo-events get eventsource event-source-object-name -o yaml ``` ```bash kubectl -n argo-events get sensor sensor-object-name -o yaml ``` -------------------------------- ### Example Message Payload Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/azure-service-bus.md The resulting JSON structure generated by the sensor payload configuration. ```json { "message": "some message here" // name/key of the object } ``` -------------------------------- ### View Stress Test Help Source: https://github.com/argoproj/argo-events/blob/master/test/stress/README.md Displays the available command-line arguments for the stress testing utility. ```shell # Make sure you have sourced a KUBECONFIG file go run ./test/stress/main.go --help ``` -------------------------------- ### Deploy Kubernetes Resources Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/azure-service-bus.md Commands to apply secret, event-source, and sensor configurations to the cluster. ```bash kubectl -n argo-events apply -f azure-secret.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/webhook.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/azure-service-bus-sensor.yaml ``` -------------------------------- ### Deploy Kubernetes Resources Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/aws-sqs.md Commands to apply secrets, event sources, sensors, and test message dispatching. ```bash kubectl -n argo-events apply -f aws-secret.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/aws-sqs.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/aws-sqs.yaml ``` ```bash aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/XXXXX/test --message-body '{"message": "hello"}' ``` -------------------------------- ### Stress Test Report Output Source: https://github.com/argoproj/argo-events/blob/master/test/stress/README.md Example of the summary report generated after a stress test execution. ```text ++++++++++++++++++++++++ Events Summary +++++++++++++++++++++++ Event Name : test Total processed events : 243 Events sent successful : 243 Events sent failed : 0 First event sent at : 2021-03-19 09:42:03.895959 -0700 PDT m=+101.008343356 Last event sent at : 2021-03-19 09:42:08.251331 -0700 PDT m=+105.363714318 Total time taken : 4.355370962s -- +++++++++++++++++++++++ Actions Summary +++++++++++++++++++++++ Trigger Name : log-trigger Total triggered actions : 243 Action triggered successfully : 243 Action triggered failed : 0 First action triggered at : 2021-03-19 09:42:03.907679 -0700 PDT m=+101.020062977 Last action triggered at : 2021-03-19 09:42:08.253928 -0700 PDT m=+105.366311326 Total time taken : 4.346248349s -- ``` -------------------------------- ### EventBus Warning Output Source: https://github.com/argoproj/argo-events/blob/master/docs/lint.md Example of the warning message displayed when an EventBus is not available during offline linting. ```bash ! sensor.yaml: Sensor validation incomplete (EventBus not available) Note: nil eventbus ``` -------------------------------- ### Script Filter Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/filters/script.md Example of defining a script filter within the event source configuration. ```yaml filters: script: |- if event.body.a == "b" and event.body.d.e == "z" then return true else return false end ``` -------------------------------- ### Build and Push Multi-Arch Image to ttl.sh Source: https://github.com/argoproj/argo-events/blob/master/docs/developer_guide.md Build a multi-arch container image and push it to ttl.sh using the generated ephemeral repository name and version. Requires `DOCKER_PUSH=true`. ```bash DOCKER_PUSH=true IMAGE_NAMESPACE=ttl.sh/$IMG_REPO VERSION=$IMG_VERSION make image-multi ``` -------------------------------- ### Deploy Kubernetes Resources Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/azure-queue-storage.md Commands to apply the secret, event source, and sensor configurations to the cluster. ```bash kubectl -n argo-events apply -f azure-secret.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/event-sources/azure-queue-storage.yaml ``` ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/azure-queue-storage.yaml ``` -------------------------------- ### Log Trigger JSON Output Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/log.md Example of the JSON structure logged by the Log trigger when an event is received. ```json { "level": "info", "ts": 1604783266.973979, "logger": "argo-events.sensor", "caller": "log/log.go:35", "msg": "{\"eventTime\":\"2020-11-07 21:07:46.9658533 +0000 UTC m=+20468.986115001\"}", "sensorName": "log", "triggerName": "log-trigger", "dependencyName": "test-dep", "eventContext": "{\"id\":\"37363664356662642d616364322d343563332d396362622d353037653361343637393237\",\"source\":\"calendar\",\"specversion\":\"1.0\",\"type\":\"calendar\",\"datacontenttype\":\"application/json\",\"subject\":\"example-with-interval\",\"time\":\"2020-11-07T21:07:46Z\"}" } ``` -------------------------------- ### Apply Webhook Sensor Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/02-parameterization.md Command to apply the sensor configuration for parameterization. ```bash kubectl -n argo-events apply -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/tutorials/02-parameterization/sensor-01.yaml ``` -------------------------------- ### Kafka EventBus Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/eventbus/kafka.md Example YAML configuration for an EventBus using Kafka. ```yaml kind: EventBus metadata: name: default spec: kafka: url: kafka:9092 # must be managed independently topic: "example" # optional ``` -------------------------------- ### Create Service Account for EventSource Source: https://github.com/argoproj/argo-events/blob/master/docs/service-accounts.md Create a Kubernetes service account to be used by an EventSource. ```bash kubectl -n your-namespace create sa my-sa ``` -------------------------------- ### Example Event Payload Format Source: https://github.com/argoproj/argo-events/blob/master/docs/tutorials/02-parameterization.md The expected structure of the event received by the sensor, containing context and data fields. ```json { "context": { "type": "type_of_event_source", "specversion": "cloud_events_version", "source": "name_of_the_event_source", "id": "unique_event_id", "time": "event_time", "datacontenttype": "type_of_data", "subject": "name_of_the_configuration_within_event_source" }, "data": { "body": { "name": "foo bar", "message": "hello there!!" }, } } ``` -------------------------------- ### Build and Load Local Docker Image Source: https://github.com/argoproj/argo-events/blob/master/docs/developer_guide.md Build the container images for Argo Events and load them into the local Kubernetes cluster (e.g., Minikube, Kind, K3D). ```bash make image ``` -------------------------------- ### Configure a Custom Trigger in a Sensor Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/build-your-own-trigger.md Example of a Sensor resource definition utilizing the custom trigger configuration block. ```yaml apiVersion: argoproj.io/v1alpha1 kind: Sensor metadata: name: webhook-sensor spec: dependencies: - name: test-dep eventSourceName: webhook eventName: example triggers: - template: name: webhook-workflow-trigger custom: # the url of the trigger server. serverURL: tekton-trigger.argo-events.svc:9000 # spec is map of string->string and it is sent over to trigger server. # the spec can be anything you want as per your use-case, just make sure the trigger server understands the spec map. spec: url: "https://raw.githubusercontent.com/VaibhavPage/tekton-cd-trigger/master/example.yaml" # These parameters are applied on resource fetched and returned by the trigger server. # e.g. consider a trigger server which invokes TektonCD pipeline runs, then # the trigger server can return a TektonCD PipelineRun resource. # The parameters are then applied on that PipelineRun resource. parameters: - src: dependencyName: test-dep dataKey: body.namespace dest: metadata.namespace # These parameters are applied on entire template body. # So that you can parameterize anything under `custom` key such as `serverURL`, `spec` etc. parameters: - src: dependencyName: test-dep dataKey: body.url dest: custom.spec.url ``` -------------------------------- ### Data Filter with Template Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/filters/data.md Example of using a sprig template to process incoming data before applying the filter comparison. ```yaml filters: data: - path: body.message type: string value: - "hello world" template: "{{ b64dec .Input }}" ``` -------------------------------- ### EventBus Node Anti-Affinity Configurations Source: https://github.com/argoproj/argo-events/blob/master/docs/dr_ha_recommendations.md Examples for configuring pod anti-affinity to ensure high availability across nodes. ```yaml spec: nats: native: auth: token affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - podAffinityTerm: labelSelector: matchLabels: controller: eventbus-controller eventbus-name: default topologyKey: kubernetes.io/hostname weight: 100 ``` ```yaml spec: nats: native: auth: token affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchLabels: controller: eventbus-controller eventbus-name: default topologyKey: kubernetes.io/hostname ``` -------------------------------- ### Deploy Argo Events with Custom Image Source: https://github.com/argoproj/argo-events/blob/master/docs/developer_guide.md Build the kustomization and apply it to the cluster to deploy Argo Events using the custom container image specified in `kustomization.yaml`. ```bash kustomize build . | kubectl apply -f - ``` -------------------------------- ### EventBus Pod Disruption Budget Source: https://github.com/argoproj/argo-events/blob/master/docs/dr_ha_recommendations.md Defines a PDB to ensure availability during voluntary disruptions, recommended for 3-replica setups. ```yaml apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: eventbus-default-pdb spec: maxUnavailable: 1 selector: matchLabels: controller: eventbus-controller eventbus-name: default ``` -------------------------------- ### Create NSQ Channel Source: https://github.com/argoproj/argo-events/blob/master/docs/eventsources/setup/nsq.md Create a channel named 'my-channel' for the 'hello' topic. Channels are used to consume messages from a topic. ```bash curl -X POST 'http://localhost:4151/channel/create?topic=hello&channel=my-channel' ``` -------------------------------- ### Kafka TLS Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/eventbus/kafka.md Example YAML configuration for enabling TLS on a Kafka connection. ```yaml tls: caCertSecret: name: my-secret key: ca-cert-key clientCertSecret: name: my-secret key: client-cert-key clientKeySecret: name: my-secret key: client-key-key ``` -------------------------------- ### Install Argo Events Namespace-scoped Source: https://github.com/argoproj/argo-events/blob/master/manifests/README.md Deploys Argo Events to operate within a single namespace without requiring cluster-wide permissions. ```sh kubectl create ns argo-events kubectl apply -f ./namespace-install.yaml ``` -------------------------------- ### Apply Sensor Configuration Source: https://github.com/argoproj/argo-events/blob/master/docs/sensors/triggers/k8s-object-trigger.md Applies the sensor configuration file to the cluster. ```bash kubectl apply -n argo-events -f https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/sensors/trigger-standard-k8s-resource.yaml ```