Skip to main content

Argo Events


Installation

helm repo add argo https://argoproj.github.io/argo-helm \
&& helm repo update argo
mkdir -p workflow/argo/events/{helm,eventbus,eventsource}
helm search repo argo/argo-events -l | head -n  10
helm show values argo/argo-events \
--version 2.0.0 \
> workflow/argo/events/helm/values.yaml
workflow/argo/events/helm/values.yaml
configs:
jetstream:
versions:
- version: 2.8.1
natsImage: nats:2.8.1
metricsExporterImage: natsio/prometheus-nats-exporter:0.9.1
configReloaderImage: natsio/nats-server-config-reloader:0.6.3
startCommand: /nats-server
helm upgrade argo-events argo/argo-events \
--install \
--version 2.0.0 \
-n workflow \
--values workflow/argo/events/helm/values.yaml

EventBus

workflow/argo/events/eventbus/default.yaml
apiVersion: argoproj.io/v1alpha1
kind: EventBus
metadata:
name: default
namespace: workflow
spec:
jetstream: # nats streaming(stan)은 더 이상 개발되지 않음
version: 2.8.1
replicas: 3 # minimum 3
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
controller: eventbus-controller
eventbus-name: default
topologyKey: kubernetes.io/hostname
weight: 100

EventSource

Github

  • Settings -> Developer setttings -> Personal access tokens -> Generate new tokens
    • admin: repo_hook
  • secret을 임의로 정합니다.
apiVersion: v1
kind: Secret
metadata:
name: <name>
namespace: workflow
type: Opaque
data:
token: <base64-token>
secret: <base64-secret>
workflow/argo/events/eventsource/github.yaml
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
name: github
namespace: workflow
spec:
eventBusName: default
service:
ports:
- port: 12000
targetPort: 12000 # pod port
github:
example: # eventName, 임의로 설정하면 됩니다.
# https://github.com/argoproj/argo-events/blob/master/api/event-source.md#githubeventsource
owner: <owner>
repository: <repository>
webhook:
endpoint: <endpoint>
port: "12000" # pod port
method: POST
url: https://<eventsource-url>
# https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads
contentType: json
insecure: false
active: true
events:
- "*"
apiToken:
name: <secret-name>
key: token
webhookSecret:
name: <secret-name>
key: secret
  • repository -> Settings -> Webhooks -> Add webhook
    • 아래 내용에 맞춰 Webhook이 자동으로 생성됩니다.
    • Payload URL: https://<eventsource-url>/<endpoint>
    • Content type: application/json
    • Secret: <secret>
    • Enable SSL verification
    • Send me everything.
    • Active
  • github-eventsource-svc.workflow Service가 자동 생성됩니다.
  • https://<eventsource-url>/<endpoint>가 외부로 노출 될 수 있도록 네트워크를 구성합니다.

AMQP

danger

Test 중

workflow/argo/events/eventsource/rabbitmq.yaml
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
name: rabbitmq
namespace: workflow
spec:
amqp:
example: # eventName, 임의로 설정하면 됩니다.
# https://github.com/argoproj/argo-events/blob/master/api/event-source.md#amqpeventsource
url: amqp://<service>.<namespace>:5672
jsonBody: true
exchangeName: <exchange-name>
exchangeType: fanout # direct | fanout | headers | topic
routingKey: <routing-key>
auth:
username:
name: <user-secret>
key: username
password:
name: <user-secret>
key: password

Sensor

Dependencies

Triggers

Reference