ORT Operator API
This repository contains a HTTP/JSON API, a Matrix chatbot and a (currently broken) Slack chatbot for the
ORT Kubernetes Operator. The bots should probably live in separate repos.
HTTP Endpoints
GET /runs
- Returns a list of all OrtRun resources
Response:
{
"runs": [
{
"name": "<name>",
"repoUrl": "<repoUrl>",
"status": {
"analyzer": "[Pending|Running|Succeeded|Failed|Aborted]",
"scanner": "[Pending|Running|Succeeded|Failed|Aborted]",
"reporter": "[Pending|Running|Succeeded|Failed|Aborted]"
}
}
]
}
GET /runs/<name>
- Return the OrtRun resources with the given name
Response:
{
"name": "<name>",
"repoUrl": "<repoUrl>",
"status": {
"analyzer": "[Pending|Running|Succeeded|Failed|Aborted]",
"scanner": "[Pending|Running|Succeeded|Failed|Aborted]",
"reporter": "[Pending|Running|Succeeded|Failed|Aborted]"
},
"kubernetesResource": "<yaml>"
}
POST /runs
- Create a new OrtRun resources
Payload:
{
"repoUrl": "https://github.com/haikoschol/cats-of-asia.git"
}
Response:
{
"name": "<name>",
"repoUrl": "<repoUrl>",
"status": {
"analyzer": "[Pending|Running|Succeeded|Failed|Aborted]",
"scanner": "[Pending|Running|Succeeded|Failed|Aborted]",
"reporter": "[Pending|Running|Succeeded|Failed|Aborted]"
},
"kubernetesResource": "<yaml>"
}
GET /logs/<name>/[analyzer|scanner|reporter]
- Fetch the logs from the analyzer, scanner or reporter of an ORT run
Response:
{
"name": "<name>",
"stage": "[analyzer|scanner|reporter]",
"podLogs": [
{
"podName": "<name>",
"podLogs": "<log>"
}
]
}
Configuration
To talk to Kubernetes, the API process first tries InClusterConfig
and if that fails looks for a kubeconfig in $HOME/.kube/config
.
if MATRIX_SERVER
is set, MATRIX_USER
and MATRIX_ACCESS_TOKEN
are assumed to be set as well and an instance of the
Matrix bot is created and run.