TABLE
https://www.atlantbh.com/implementing-ci-cd-pipeline-using-argo-workflows-and-argo-events/ https://github.com/argoproj/argo-events/blob/master/examples/event-sources/resource.yaml https://siebjee.nl/posts/how-i-manage-elasticsearch/#setting-up-argo-events
DEPLOYMENT + VALUES
EVENTBUS
apiVersion: argoproj.io/v1alpha1
kind: EventBus
metadata:
name: minio
namespace: argo-events
spec:
nats:
native:
replicas: 3
auth: none
MINIO SECRET
---
kind: Secret
apiVersion: v1
metadata:
name: artifacts-minio
namespace: argo-events
stringData:
accesskey: <ACCESS-KEY>
secretkey: <SECRET-KEY>
CA CERTIFICATES
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ca-certificates
namespace: argo-events
data:
ca-certificates.crt: |-
-----BEGIN CERTIFICATE-----
MIIFijCCA3KgAwIBAgIUYeYPin86X #..
EVENTSOURCE
---
apiVersion: argoproj.io/v1alpha1
kind: EventSource
metadata:
name: minio
namespace: argo-events
spec:
eventBusName: minio
minio:
example:
bucket:
name: modules
endpoint: artifacts.automation.sthings-vsphere.labul.sva.de
events:
- s3:ObjectCreated:Put
- s3:ObjectRemoved:Delete
insecure: false
accessKey:
key: accesskey
name: artifacts-minio
secretKey:
key: secretkey
name: artifacts-minio
template:
container:
env:
- name: DEBUG_LOG
value: "true"
volumeMounts:
- name: certs-volume
mountPath: /etc/ssl/certs
volumes:
- name: certs-volume
configMap:
name: ca-certificates
SERVICE ACCOUNT
---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: argo-events
name: operate-workflow-sa
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: operate-workflow
labels:
rbac.authorization.k8s.io/aggregate-to-view: "true"
rules:
- apiGroups:
- argoproj.io
resources:
- workflows
- workflows/finalizers
- workfloweventbindings
- workfloweventbindings/finalizers
- workflowtemplates
- workflowtemplates/finalizers
- cronworkflows
- cronworkflows/finalizers
- clusterworkflowtemplates
- clusterworkflowtemplates/finalizers
- workflowtaskresults
- workflowtaskresults/finalizers
verbs:
- get
- list
- watch
- create
- apiGroups:
- ""
resources:
- pods
verbs:
- get
- watch
- patch
- apiGroups:
- ""
resources:
- pods/log
verbs:
- get
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: operate-workflow
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: operate-workflow
subjects:
- kind: ServiceAccount
name: operate-workflow-sa
namespace: argo-events
SENSOR
apiVersion: argoproj.io/v1alpha1
kind: Sensor
metadata:
name: minio
namespace: argo-events
spec:
eventBusName: minio
template:
serviceAccountName: operate-workflow-sa
container:
env:
- name: DEBUG_LOG
value: "true"
dependencies:
- name: test-dep
eventSourceName: minio
eventName: example
triggers:
- template:
name: minio-workflow-trigger
k8s:
operation: create
source:
resource:
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: artifact-workflow-2-
# namespace: argo-workflows
spec:
serviceAccountName: operate-workflow-sa
entrypoint: whalesay
arguments:
parameters:
- name: message
# the value will get overridden by event payload from test-dep
value: THIS_WILL_BE_REPLACED
templates:
- name: whalesay
inputs:
parameters:
- name: message
container:
command:
- cowsay
image: docker/whalesay:latest
args: ["{{inputs.parameters.message}}"]
# The container args from the workflow are overridden by the s3 notification key
parameters:
- src:
dependencyName: test-dep
dataKey: notification.0.s3.object.key
dest: spec.arguments.parameters.0.value
retryStrategy:
steps: 3