API¶
Argo Server provides the API to programmatically auto tasks.
url: http://localhost:2746/api/v1
info: http://localhost:2746/api/v1/info
access token¶
To allow the api to automate the tasks, an access token, which is a Kubernetes service account token, should be created:
a
service accountfor the automation user:a
rolewith the right permission:a
role bindingto bind the role to the service accounta
service account tokenfor the service account
## use api API endpoints use json as plyload
curl http://localhost:2746/api/v1/workflows/argo \
-H "Authorization: $ARGO_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"workflow": {
"metadata": {
"generateName": "my-hello-wf"
},
"spec": {
"templates": [
{
"name": "main",
"container": {
"image": "docker/whalesay",
"command": [
"cowsay"
],
"args": [
"hello"
]
}
}
],
"entrypoint": "main"
}
}
}'
webhook¶
The endpoint that is specifically designed to create workflows via an api is api/v1/events.
only allowed to create workflows from a
WorkflowTemplate, thus is more secureonly allowed to parse the HTTP payload and use it as parameters
only allowed to integrate with other systems without having to change those systems
also supports GitHub and GitLab, so can trigger workflow from git actions
To use the webhook, a WorkflowTemplate and a WorkflowEventBinding should be created