docs: add apis and preheat (#712)

* docs: add apis and preheat

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2021-10-09 20:23:19 +08:00
parent feaa0a9333
commit 7533e23e2f
No known key found for this signature in database
GPG Key ID: 8B4E5D1290FA2FFB
6 changed files with 5279 additions and 0 deletions

2599
docs/en/api/api.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,39 @@
# Preheat
P2P provides two types of preheating: `image` and `file`. Users can be preheat in the `console` or directly call `preheat api` for preheating
## Console
TODO
## API
Use preheat apis for preheating. First create a POST request for preheating, you can refer to [create preheat api document](../../api/api.md#create-preheat)
```bash
curl --request POST 'http://dragonfly-manager:8080/api/v1/preheats' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "image",
"url": "https://registry-1.docker.io/v2/library/busybox/manifests/latest",
"scheduler_cluster_id": 1
}'
```
If the output of command above has content like
```bash
{"id":"group_28439e0b-d4c3-43bf-945e-482b54c49dc5","status":"PENDING","create_at":"2021-10-09T11:54:50.6182794Z"}
```
Polling the preheating status with id. if status is `SUCCESS`, preheating is successful, you can refer to [get preheat api document](../../api/api.md#get-preheat)
```bash
curl --request GET 'http://manager-domain:8080/api/v1/preheats/group_28439e0b-d4c3-43bf-945e-482b54c49dc5'
```
If the status is `SUCCESS`, the preheating is successful.
```bash
{"id":"group_28439e0b-d4c3-43bf-945e-482b54c49dc5","status":"SUCCESS","create_at":"2021-10-09T11:54:50.5712334Z"}
```

View File

@ -23,3 +23,4 @@ This table describes some container runtimes version and documents.
- Container Runtimes
- [cri-o mirror](../user-guide/registry-mirror/cri-o.md) - make Dragonfly as Registry Mirror for CRIO daemon
- [cri-containerd mirror](../user-guide/registry-mirror/cri-containerd.md) - make Dragonfly as Registry Mirror for containerd daemon
- [preheat](../user-guide/preheat/preheat.md) - preheat feature

2599
docs/zh-CN/api/api.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
# 预热
P2P 加速可预热两种类型数据 `image``file`, 用户可以在控制台操作或者直接调用 api 进行预热。
## Console
TODO
## API
用户使用 api 进行预热。首先发送 POST 请求创建预热任务,具体 api 可以参考文档 [create preheat api document](../../api/api.md#create-preheat)。
```bash
curl --request POST 'http://dragonfly-manager:8080/api/v1/preheats' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "image",
"url": "https://registry-1.docker.io/v2/library/busybox/manifests/latest",
"scheduler_cluster_id": 1
}'
```
命令行日志返回预热任务 ID。
```bash
{"id":"group_28439e0b-d4c3-43bf-945e-482b54c49dc5","status":"PENDING","create_at":"2021-10-09T11:54:50.6182794Z"}
```
使用预热任务 ID 轮训查询任务是否成功,具体 api 可以参考文档 [get preheat api document](../../api/api.md#get-preheat)。
```bash
curl --request GET 'http://manager-domain:8080/api/v1/preheats/group_28439e0b-d4c3-43bf-945e-482b54c49dc5'
```
如果返回预热任务状态为 `SUCCESS`,表示预热成功。
```bash
{"id":"group_28439e0b-d4c3-43bf-945e-482b54c49dc5","status":"SUCCESS","create_at":"2021-10-09T11:54:50.5712334Z"}
```

View File

@ -22,3 +22,4 @@
- Container Runtimes
- [cri-o mirror](../user-guide/registry-mirror/cri-o.md) - 使用 Dragonfly 作为 CRIO daemon 的 Registry Mirror
- [cri-containerd mirror](../user-guide/registry-mirror/cri-containerd.md) - 使用 Dragonfly 作为 containerd daemon 的 Registry Mirror
- [preheat](../user-guide/preheat/preheat.md) - 预热功能