apiVersion:argoproj.io/v1alpha1kind:EventBusmetadata:name:defaultspec:nats:native:# Optional, defaults to 3. If it is < 3, set it to 3, that is the minimal requirement.replicas:3# Optional, authen strategy, "none" or "token", defaults to "none"auth:token# containerTemplate:# resources:# requests:# cpu: "10m"# metricsContainerTemplate:# resources:# requests:# cpu: "10m"# antiAffinity: false# persistence:# storageClassName: standard# accessMode: ReadWriteOnce# volumeSize: 10Gi
apiVersion:argoproj.io/v1alpha1kind:EventSourcemetadata:name:webhookspec:service:ports:- port:12000targetPort:12000webhook:# event-source can run multiple HTTP servers. Simply define a unique port to start a new HTTP serverexample:# port to run HTTP server onport:"12000"# endpoint to listen toendpoint:/example# HTTP request method to allow. In this case, only POST requests are acceptedmethod:POST# example-foo:# port: "12000"# endpoint: /example2# method: POST# Uncomment to use secure webhook# example-secure:# port: "13000"# endpoint: "/secure"# method: "POST"# # k8s secret that contains the cert# serverCertSecret:# name: my-secret# key: cert-key# # k8s secret that contains the private key# serverKeySecret:# name: my-secret# key: pk-key
# sensor rbacapiVersion:v1kind:ServiceAccountmetadata:name:operate-workflow-sa---# Similarly you can use a ClusterRole and ClusterRoleBindingapiVersion:rbac.authorization.k8s.io/v1kind:Rolemetadata:name:operate-workflow-rolerules:- apiGroups:- argoproj.ioverbs:- "*"resources:- workflows- workflowtemplates- cronworkflows- clusterworkflowtemplates---apiVersion:rbac.authorization.k8s.io/v1kind:RoleBindingmetadata:name:operate-workflow-role-bindingroleRef:apiGroup:rbac.authorization.k8s.iokind:Rolename:operate-workflow-rolesubjects:- kind:ServiceAccountname:operate-workflow-sa---# workflow rbac# This file enables a Workflow Pod (running Emissary executor) to be able to read and patch WorkflowTaskResults,# which get shared with the Workflow Controller. The Controller uses the results to update Workflow status.apiVersion:rbac.authorization.k8s.io/v1kind:Rolemetadata:annotations:workflows.argoproj.io/description:| Recomended minimum permissions for the `emissary` executor.name:executorrules:- apiGroups:- argoproj.ioresources:- workflowtaskresultsverbs:- create- patch---apiVersion:rbac.authorization.k8s.io/v1kind:RoleBindingmetadata:name:executor-defaultroleRef:apiGroup:rbac.authorization.k8s.iokind:Rolename:executorsubjects:- kind:ServiceAccountname:default
触发 workflow
1
2
3
kubectl -n argo-events get pod -l eventsource-name=webhook -o custom-columns=:.status.podIP
curl -d '{"message":"this is my first webhook"}' -H "Content-Type: application/json" -X POST http://10.90.209.234:12000/example