7.1 KiB
7.1 KiB
平台运维
本文件覆盖 Secret、runtime migration、observability、platform infra、CI tools image、PipelineRun 清理和 rollout 补记。
Secret 管理
bun scripts/cli.ts hwlab g14 secret status --lane v02 \
--name hwlab-v02-openfga|hwlab-v02-master-server-admin-api-key
bun scripts/cli.ts hwlab g14 secret ensure --lane v02 \
--name hwlab-v02-master-server-admin-api-key [--dry-run|--confirm]
bun scripts/cli.ts hwlab g14 secret delete --lane v02 \
--name <obsolete-secret> [--dry-run|--confirm]
bun scripts/cli.ts agentrun control-plane secret-sync \
--node <node> --lane <lane> [--secret-id <yaml-secret-id>] \
[--dry-run|--confirm] [-o json|yaml] [--full|--raw]
Secret 只通过 YAML sourceRef/targetKey 和受控 CLI 下发;输出只披露对象名、key 名、presence、fingerprint 和摘要,不打印完整凭据。
- AgentRun
secret-sync --dry-run的默认文本、JSON 和 YAML 使用同一个有界投影:- 直接展示 YAML Secret ID、目标 Secret/key、source presence/fingerprint;
- 阻断时展示 activation fence identity、状态、关联 runner/run/command identity 和可执行只读下钻;
- 所有模式固定
valuesPrinted=false。
--secret-id <yaml-secret-id>是单个声明的稳定下钻;--full与--raw才请求 exhaustive probe/capture。secret-sync是 YAML 声明的配置维护入口,不是 source delivery 或 CI/CD 恢复入口。
运行时迁移
bun scripts/cli.ts hwlab g14 control-plane runtime-migration \
--lane v02 [--dry-run|--confirm]
通过 runtime 容器内 migration CLI 执行迁移。不要用手工 pod shell 或裸数据库命令作为长期入口。
可观测性
bun scripts/cli.ts hwlab g14 observability status|apply|query|targets|boundary|closeout \
[--lane v02] [--promql <expr>] [--expect-count N] [--expect-value V] [--dry-run|--confirm]
管理 G14 Prometheus 基础设施和 HWLAB lane 监控 closeout。状态、耗时、失败原因、trace、命令结果或关键证据不可见时,先补 CLI/日志/状态输出再继续。
平台基础设施
bun scripts/cli.ts platform-infra sub2api plan|apply|status|validate
bun scripts/cli.ts platform-infra sub2api codex-pool plan|sync|validate|expose|configure-local
bun scripts/cli.ts platform-infra gitea status|validate --target JD01
bun scripts/cli.ts platform-infra gitea mirror status --target JD01
bun scripts/cli.ts platform-infra gitea mirror webhook status --target JD01
bun scripts/cli.ts platform-infra pipelines-as-code status|history --target JD01 [--consumer <id>]
bun scripts/cli.ts platform-infra pipelines-as-code help platform-bootstrap
bun scripts/cli.ts platform-infra pipelines-as-code help compatibility-diagnostics
bun scripts/cli.ts platform-infra kafka groups --node <node> [--limit N|--full|--raw]
bun scripts/cli.ts platform-infra kafka groups cleanup --node <node> --policy <yaml-policy-id> [--confirm]
bun scripts/cli.ts platform-infra wechat-archive plan|apply|status|validate|pull
bun scripts/cli.ts platform-infra wechat-archive wcf-host-status|collector-plan|collector-apply|collector-status
platform-infra是 UniDesk 运维的平台基础设施控制面:- 新增平台服务优先进入该命名空间或对应 YAML target;
- 旧
devops-infra只作为渐进迁移来源; - 其他平台服务继续遵循各自 owning YAML 与专项 skill。
- Gitea mirror 和 Pipelines-as-Code 的 source-of-truth:
- 分别为
config/platform-infra/gitea.yaml与config/platform-infra/pipelines-as-code.yaml; - migrated consumer 的唯一交付触发是
release plan审阅后由 CLI 手动发送 PaC webhook; - 默认入口只有 Gitea/PaC status、history 与只读 debug。
- 分别为
- 平台维护入口边界:
closeout只在 PaC compatibility diagnostics scope 中保留为只读历史观察;- 会 POST hook test 的
webhook-test已删除; apply只属于首次平台 bootstrap,不能补齐 source PR 合并后的交付;- 任何读取失败都必须显式报告,不能误报为空表成功。
CI 工具镜像
bun scripts/cli.ts hwlab g14 tools-image status
bun scripts/cli.ts hwlab g14 tools-image build \
--name ci-node-tools --tag <tag> \
[--dockerfile deploy/ci/hwlab-ci-node-tools.Dockerfile] [--dry-run|--confirm]
tools image 构建只在目标 host 和本地 registry 的受控路径中执行,不把 master server 当通用构建机。
- 默认工具集:
- CI tools image 必须随镜像提供
kubectl; kubectl必须由 owning YAML 的内联 Dockerfile 构建,不得在 PipelineRun、Pod 或 Job 启动后安装;- Dockerfile 构建自检必须包含
kubectl version --client; - 有界 CI helper、cleanup 和 bootstrap 可以直接调用镜像内的
kubectl; - 产品业务镜像和长期 controller 不继承该运行时依赖。
- CI tools image 必须随镜像提供
PipelineRun 清理
bun scripts/cli.ts hwlab g14 control-plane cleanup-runs \
--lane v02|g14|all [--min-age-minutes N] [--limit N] [--dry-run|--confirm]
bun scripts/cli.ts hwlab nodes control-plane cleanup-runs \
--node <node> --lane v03 [--min-age-minutes N] [--limit N] [--dry-run|--confirm --wait]
bun scripts/cli.ts hwlab g14 control-plane cleanup-released-pvs \
--lane all [--limit N] [--dry-run|--confirm]
-
清理范围:
- 只删除已完成 PipelineRun 及其 Tekton TaskRun/Pod/PVC 链路;
- 不触碰 registry storage、业务 PVC、Secret、runtime workload 或 GitOps desired state。
-
定点清理:
- 带
--pipeline-run或--source-commit时必须直接查询目标对象; - 对象不存在返回
target-pipelinerun-not-found; - 对象未完成返回
target-pipelinerun-not-terminal。
- 带
-
调试期旧执行取消:
- CI/CD 不稳定或首次部署调试期间,先核对对象的 repository、consumer、source commit、创建时间、状态和更新事件 identity;
- 已被更新事件明确替代的旧 PipelineRun、TaskRun 或旧事件仍在占用并发槽、阻塞队列或执行已知错误输入时,可以直接取消,不必等待 hard timeout;
- 取消必须精确到单个旧对象,只终止执行和释放资源,不删除 GitOps desired state、Argo Application、runtime workload、业务数据、Secret 或 source/ref;
- 优先走受控取消入口;入口缺失或自身故障时,按
$unidesk-daddevP2 记录 identity、取消动作、终态和后继事件恢复证据; - 更新事件开始执行只证明队列解阻,最终验收仍以正常 PaC、GitOps/Argo 和 runtime 自动链收敛为准。
-
大型 PipelineRun 造成 Kine/SQLite 压力时:
- cleanup 只属于控制面快速缓解;
- 长期修复必须消除 renderer 中重复内联的
taskSpec,并通过 PR 合并后的 plan 与手动 webhook 验收; - 根因判定、k3s 紧急恢复和防复发规则见 incident-recovery.md。
Rollout 记录
bun scripts/cli.ts hwlab g14 record-rollout --pr <number> --source-commit <sha>
用于手动补记 CI/CD 耗时、TaskRun 指标和语义化 changelog 到指挥简报。补记不能替代真实 runtime closeout。