lain-cli
lain-cli copied to clipboard
feat: 集群配置增加对 registry 访问的定制能力
- 支持使用 https 访问 registry
- 支持定义外部命令来获取访问 registry API 需要的 access token
- 支持定义访问 registry API 的 access token 类型(
Bearer还是Basic) - 缩小获取 tag list 的 limit 到 1000 ,过大的话 AWS ECR 会返回错误
增加这些定制功能后,可以通过配置让集群支持 AWS ECR 作为 regisry.
我将会追加以下改动:
-
舍弃
registry_endpoint_use_https, 增加registry_api_endpoint, 直接允许定制 registry api 的访问入口. 说到底, image tag 所用的 host, 并不一定是 registry api 的地址, 比方阿里云/腾讯云这种. -
调用 aws cli 来获取 token 的流程, 看上去不适合开放给团队使用. 应该有某种固定 token 的办法吧? 否则所有用户都得本地配置好 aws cli.
最好的情况应该是类似现有的流程, 大伙本地加个环境变量 token 就够了.
-
从 mr 看来, aws ecr 和原生 registry 还是有一定区别的, 虽然区别非常小, 但增加的配置项都没啥通用性. 比如这个
registry_token_fetch_cmd.我认为应该单独实现 ecr.py, 然后里边直接继承
Registry. 这样既能复用代码, 也能名正言顺地写死 ecr 的定制代码.
ECR 的主要区别在于:
- access token 有有效期,过期了就需要用命令再次获取
- registry api 的 token type 是
Basic而非Bearer - tag list 获取的
n参数过大会报错