Argo and Memphis using NATS Event source
Argo is a collection of open-source tools for Kubernetes to run workflows,manage clusters, and do GitOps easily.
Among Argo tools, Argo Workflows can be found. Kubernetes-native workflow engine supporting DAG and step-based workflows. Some of Argo Workflows features -
- Define workflows where each step in the workflow is a container.
- Model multi-step workflows as a sequence of tasks or capture the dependencies between tasks using a graph (DAG).
- Easily run compute-intensive jobs for machine learning or data processing in a fraction of the time using Argo Workflows on Kubernetes.
- Run CI/CD pipelines natively on Kubernetes without configuring complex software development products.
Argo-defined workflows can be triggered by incoming events which arrive from a component called "Event Source." Multiple event sources can be used simultaneously.
Memphis provides multiple features that enhance the experience with Argo, like:
- Full GUI with real-time observability
- Schema management and transformation
- REST Webhooks
- Dead-Letter Queue with automatic message retransmit
- Serverless stream enrichments
- SDKs: Node.JS, Go, Python, TypeScript, NestJS
One of the key advantages of using Memphis is the ability to troubleshoot complicated async processes using message tracing, data-level observability, self-healing policies, and real-time notifications, which can be a great help, especially for auditing and logging when events and triggers are fired from multiple places towards your Argo and potentially can create highly expensive resources and workflows.
Memphis can trigger Argo workflows via Argo Event Source.
An Event Source defines the configurations required to consume events from external sources like Memphis, NATS, AWS SNS, SQS, GCP PubSub, Webhooks, etc.
Integrating Memphis as a NATS Event Source of Argo
# url of the nats service
# jsonBody specifies that all event body payload coming from this
# source will be JSON
# subject name = memphis station
# optional backoff time for connection retries.
# if not provided, default connection backoff time will be used.
# duration in nanoseconds, or strings like "4s", "1m". following value is 10 seconds
# how many backoffs
# factor to increase on each step.
# setting factor > 1 makes backoff exponential.
kubectl create secret generic memphis-creds \
kubectl apply -f memphis_eventsource.yaml
- name: test-dep
- name: message
value: hello world
- name: whalesay
- name: message
kubectl apply -f memphis_sensor.yaml
As Memphis works with streams, wrapping the subject will enable Memphis to control the subject. To complete that step, NATS cli is needed.
nats stream add -s <MEMPHIS_BROKER_URL>:6666 --user=<MEMPHIS_APPLICATION_USER>::<MEMPHIS_CONNECTION_TOKEN>
? Stream Name argo_workflows
? Subjects argo_workflows
? Storage file
? Replication 3
? Retention Policy Limits
? Discard Policy Old
? Stream Messages Limit -1
? Per Subject Messages Limit -1
? Total Stream Size -1
? Message TTL -1
? Max Message Size -1
? Duplicate tracking time window 2m0s
? Allow message Roll-ups No
? Allow message deletion Yes
? Allow purging subjects or the entire stream Yes
Stream argo_workflows was created