test(gitops): 验证 canary prune
lint / yaml (pull_request) Successful in 10s
lint / ansible (pull_request) Successful in 3m42s
lint / terraform (pull_request) Successful in 30s
lint / yaml (push) Successful in 9s
lint / ansible (push) Successful in 2m32s
lint / terraform (push) Successful in 30s

This commit is contained in:
2026-09-09 20:08:09 +00:00
parent f1d1a1a906
commit 45e3effcbe
5 changed files with 7 additions and 16 deletions
+5 -8
View File
@@ -7,7 +7,6 @@ Flux 将它部署到独立的 `gitops-canary` namespace。
| --- | --- |
| `deployment.yaml` | 两个 `hashicorp/http-echo` 副本。 |
| `service.yaml` | 只在集群内可达的 ClusterIP Service。 |
| `prune-canary-configmap.yaml` | 无业务依赖的临时资源,用于验证 Flux 受控删除。 |
| `kustomization.yaml` | Flux 实际构建入口;明确排除历史 HTTPRoute。 |
| `httproute.yaml` | 保留的历史 Contour 示例,**不在 Kustomization 中,不会部署**。 |
@@ -20,10 +19,8 @@ sudo k3s kubectl -n flux-system get kustomization http-echo
sudo k3s kubectl -n gitops-canary get deployment,service,pod
```
初始 `prune: false`。验证自动部署后,可以手动把 Deployment replicas 改成 1,
确认 Flux 恢复为 Git 中的 2。删除行为应使用单独的无业务 ConfigMap 和 PR 测试,
验证完成前不得为此路径启用 prune。
`flux-prune-canary` ConfigMap 分两次 PR 验证:第一次在 `prune: false` 时创建并
确认进入 Flux inventory;第二次从清单删除它,同时仅为 `http-echo`
Kustomization 开启 prune,确认 Flux 只删除这个测试对象。
Deployment 漂移修复已经验证:手动把 replicas 改成 1 后,Flux 能按 Git 恢复为
2。删除验证使用无业务依赖的 `flux-prune-canary` ConfigMap:第一阶段已经在
`prune: false` 时创建并确认进入 Flux inventory;本阶段从 Git 删除该对象,并仅为
`http-echo` Kustomization 开启 `prune: true`。root Kustomization 仍保持
`prune: false`,brownfield 资源不会进入此次删除范围。