Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
liutension 2075e6908d | 3 years ago | |
---|---|---|
.. | ||
config | 3 years ago | |
constants | 3 years ago | |
controller | 3 years ago | |
service | 3 years ago | |
types | 3 years ago | |
utils | 3 years ago | |
.drone.yml | 3 years ago | |
.gitignore | 3 years ago | |
Dockerfile | 3 years ago | |
README.md | 3 years ago | |
config.json | 3 years ago | |
deploy.yaml | 3 years ago | |
go.mod | 3 years ago | |
go.sum | 3 years ago | |
main.go | 3 years ago |
Agents of S.H.I.E.L.D
go >= 1.12
镜像工厂,该服务可以帮助平台用户直接将容器打包成docker镜像。
分为 两个部分:
agent (image-factory-agent)在目标物理节点上运行的代理,负责执行 docker commit 和 docker push
shield (image-factory-shield) 接收镜像打包请求,并将任务分发给对应物理节点上的 agent
commit请求只需要同 shield 交互即可
该项目是 image-factory-agent
打包镜像
$ docker build -t openi/image-factory-agent:version .
部署到k8s集群
通过按需求修改 ./charts/image-factory/value.yaml
文件中agent
部分配置
// 安装
helm install octopus ./charts/image-factory
查询一个容器打成 docker 镜像后的大小
GET /v1/commit/size?container=xxx
参数(query):
返回(json格式)
{
"success":bool,// 操作成功或者失败
"size":number ,// 镜像的大小,单位 kb
"msg":"",// 附加消息,如果success 为 false,则是对应的失败信息
}
直到镜像打包成功 或者 失败,该API 才返回, 如果镜像打包时间过长,请使用另一个异步打包的接口
POST /v1/commit/sync
参数(JSON):
{
"author":"",// 作者,镜像作者
"container":"",// 目标容器的id 或 目标容器的名字
"image":"",// 新镜像的名字
"note":"",// 备注,docker commit 的 --message 选项
"transaction": "",// 该次打包镜像的事务id
"hub_user":"",// 镜像仓库用户名,可选参数
"hub_pwd":"",//镜像仓库密码,可选参数
"hub_addr":"",// 镜像仓库登录地址,比如 registry.cn-hangzhou.aliyuncs.com , 可选参数
}
返回(json 格式):
{
"success": true/false ,
"msg":""//
}
接收到提交请求,立即返回,镜像工场会根据打包进度更新该次任务的状态
POST /v1/commit/async
参数(JSON):
{
"author":"",// 作者,镜像作者
"container":"",// 目标容器的id 或 目标容器的名字
"image":"",// 新镜像的名字
"note":"",// 备注,docker commit 的 --message 选项
"transaction": "",// 该次打包镜像的事务id
"hub_user":"",// 镜像仓库用户名,可选参数
"hub_pwd":"",//镜像仓库密码,可选参数
"hub_addr":"",// 镜像仓库登录地址,比如 registry.cn-hangzhou.aliyuncs.com , 可选参数
}
返回(json 格式):
{
"success": true/false ,
"msg":""//
}
第一个: agent 在每个物理节点都运行一份实例,agent 负责 执行 docker commit
,docker push
命令。
因此首先agent应该以守护进程的方式部署在物理机上,且需要有执行 docker
命令的权限!
第二个: docker 的客户端采用的是https,在与docker 镜像仓库交互时,如果镜像仓库不是采用的https 的方式,那么会报http: server gave HTTP response to HTTPS client
错误 , 解决方法是在 docker 的 daemon.json
配置文件中加上 { "insecure-registries":["192.168.1.100:5000"] }
(假设192.168.1.100:5000
就是你的镜像仓库地址), 然后重启docker
请在部署 agent 时 确认一下 这个点。
第三个: 在 commit
的 api
中支持用户指定镜像仓库(即hub_addr
参数) ,这是可选的, 如果对应的物理机上 docker 有与目标仓库交互的权限,那么hub_user
,hub_pwd
,hub_addr
可以不填。所以在部署的时候直接 运行 docker login
命令 登录目标仓库, 那么之后就不用在 调用 commit
的api时 填 仓库的用户名密码了
agent 运行在集群的物理机上(各个物理机上都需要运行),需要有执行物理机上 docker
命令的权限
配置:
配置文件的形式(json):
{
"shield_address":"",// shield 服务的地址 ,如 http://192.168.202.20:9001
"agent_address":"",// 该agent的访问地址,可以不配置,不配置将使用物理机ip拼接地址 http://ip:port
"port":"",// 服务 监听的端口,默认是 9002
}
以配置文件的形式启动: agent --config config_file_path
或者设置环境变量:
shield 只需运行一个实例即可,理论上运行在哪里都可以
配置:
配置文件的形式(json):
{
"max_commit_exist_time":number,// commit 任务终止后,commit 记录在shield 里面的最大存活时间,默认3小时
"port":"",// 服务 监听的端口,默认是 9001
}
以配置文件的形式启动: shield --config config_file_path
或者设置环境变量:
@Deprecated 此仓库已弃用,请移步至 https://git.openi.org.cn/OpenI/octopus.
启智章鱼项目(OPENI-OCTOPUS)是一个集群管理和资源调度系统,支持在GPU集群中运行AI任务作业(比如深度学习任务作业)。平台提供了一系列接口,能够支持主流的深度学习框架。
JavaScript Go SVG Python JSX other
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》