Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 容器化环境下支持将待分发文件托管至Artifactory服务所在母机 #9450

Open
jsonwan opened this issue Sep 12, 2023 · 0 comments
Labels
area/ci/backend CI 后端issue kind/feat/tech 技术性特性

Comments

@jsonwan
Copy link
Collaborator

jsonwan commented Sep 12, 2023

背景:
开源版构件分发插件运行在构建机上,构建机集群机器不固定添加Job白名单不方便,因此依赖蓝盾Artifactory所在机器做文件托管。但在蓝盾容器化部署后,Artifactory服务在容器内,GSE Agent在母机上,造成分发时找不到文件。

解决方案(短期):
Artifactory容器挂载HostPath,将容器内目录映射至母机进行分发。
(1)检查helm chart相关代码(若未实现需要添加),确保将Artifactory服务依赖的分发路径挂载了对应的母机路径,并且有读写权限
代码位置:
https://github.com/TencentBlueKing/bk-ci/blob/master/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/FileTaskServiceImpl.kt#L59C82-L59C82

(2)需要将文件托管服务内获取IP的代码扩展为在容器化部署下支持获取k8s母机IP(可通过环境变量注入Pod)
代码位置:
https://github.com/TencentBlueKing/bk-ci/blob/master/src/backend/ci/core/artifactory/biz-artifactory/src/main/kotlin/com/tencent/devops/artifactory/service/impl/FileTaskServiceImpl.kt#L73C51-L73C51

(3)将k8s集群所有节点IP添加到作业平台的IP白名单
如果希望缩小添加白名单的IP范围,可以利用K8s的NodeSelector将Artifactory的Pod调度到指定的某些节点,并将这些节点IP加入白名单即可。

(4)pod销毁并漂移后可能来不及清理临时文件,造成文件残留在母机上,需要额外清理
可使用作业平台定时任务进行清理。

解决方案(长期):
使用Job提供的V3版接口获取本地文件上传URL,将文件上传至制品库,再调用Job接口作为本地文件进行分发。
依赖作业平台新版插件及SDK开源,需要开发,当前人力紧张,开发周期较长,暂无排期。

@jsonwan jsonwan added kind/bug 程序故障Bug,漏洞 kind/feat/tech 技术性特性 area/ci/backend CI 后端issue and removed kind/bug 程序故障Bug,漏洞 labels Sep 12, 2023
@irwinsun irwinsun pinned this issue Mar 27, 2024
@irwinsun irwinsun unpinned this issue May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci/backend CI 后端issue kind/feat/tech 技术性特性
Projects
None yet
Development

No branches or pull requests

1 participant