feat(cli): tb-agent k8s 设备边车镜像(部署即注册)#27
Open
evilstar9527 wants to merge 2 commits into
Open
Conversation
main 上 package.json 已移除 @biomejs/biome(eslint 迁移),但锁文件残留 95 行, 导致 pnpm 每次 exec 前 deps-status 校验判定不一致、试图 purge node_modules, 无 TTY 环境(husky pre-commit)下直接 abort。重新同步消除漂移。
新增常驻 tb connect 的边车镜像,让 k8s/ACK pod 部署即反向注册到 device/ 下。 - packages/cli/Dockerfile:多阶段从 monorepo 构建 tb-agent(CLI 版本 == 网关版本), pnpm deploy --prod 隔出最小运行时,tini 作 PID1 转发 SIGTERM(WS 优雅下线)+ 回收 shell 子进程僵尸;ENTRYPOINT=tb、CMD=--help,k8s 用 args 覆盖为 connect ... - .github/workflows/publish-agent.yml:cli-v* tag 触发发布到 ghcr.io/tokenrollai/tool-bridge/tb-agent(amd64+arm64),带 tag/版本一致性校验 - llmdoc/guides/k8s-device-sidecar.md:原理(login vs connect)、三条铁律 (受限 SK / Downward API pod 名 / env 凭证)、可 apply 的 Deployment 清单、排障 - README.md + modules-and-boundaries.md:部署矩阵与文档索引补一行
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Member
|
我建议单独开一个 Repo, 把这类非核心的功能适配抽走 @evilstar9527 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
动机
k8s/ACK 里的 pod 只
tb login是看不到的——login仅把凭证写进本地 profile,不注册任何设备;tb connect才开常驻 WebSocket 把节点挂到device/下。本 PR 提供一个常驻tb connect的边车镜像,让 pod 部署即被 tool-bridge 发现,业务容器零改动。改动
packages/cli/Dockerfile— tb-agent 镜像。多阶段从 monorepo 构建(CLI 版本 == 网关版本,不依赖 npm 发布时序),pnpm deploy --prod隔出最小运行时;tini 作 PID1 转发 SIGTERM(触发 WS 优雅关闭、节点即时下线)+ 回收 shell 子进程僵尸。ENTRYPOINT=["tini","--","tb"]、CMD=["--help"],k8s 用args覆盖为connect ...。.github/workflows/publish-agent.yml—cli-v*tag 触发发布到ghcr.io/tokenrollai/tool-bridge/tb-agent(amd64+arm64),带 tag/版本一致性校验,与 publish-cli.yml 同 tag 同源。llmdoc/guides/k8s-device-sidecar.md— 原理(login vs connect)、三条铁律(受限 SK--register-path/ Downward API 注入 pod 名 / env 凭证)、可直接 apply 的 Deployment 清单(含原生 sidecar 变体)、排障。README.md+modules-and-boundaries.md— 部署矩阵与文档索引各补一行。拆成两个 commit:
chore(deps)重新同步pnpm-lock.yaml—— main 上 biome 已随 eslint 迁移移除但锁文件残留 95 行,导致 pnpm deps-status 校验在无 TTY 环境(husky)下 abort。此为 main 既有漂移,顺手修掉解锁 pre-commit。feat(cli)本功能。验证
pnpm --filter @tool-bridge/cli --prod deploy --legacy产出的/out仅含dist/index.js+ 5 个 prod 依赖(commander/marked/marked-terminal/partysocket/ws),node dist/index.js --help正常,connect能完整加载模块图进入常驻循环。镜像多阶段结构 / tini / 符号链接沿用已验证的根 Dockerfile 模式。docker build -f packages/cli/Dockerfile -t tb-agent .→docker run --rm -e TB_BASE_URL=... -e TB_SK=<受限SK> tb-agent connect --device-id smoke --allow echo,确认 UIdevice/下即时出现、Ctrl-C 后即时下线。