test(gitops): 添加 Flux prune canary
lint / yaml (push) Successful in 8s
lint / ansible (push) Successful in 3m19s
lint / terraform (push) Successful in 32s
lint / yaml (pull_request) Successful in 9s
lint / ansible (pull_request) Successful in 3m8s
lint / terraform (pull_request) Successful in 34s

This commit is contained in:
2026-09-09 20:04:34 +00:00
parent 11049f99c7
commit 531011c257
4 changed files with 14 additions and 1 deletions
+1
View File
@@ -34,6 +34,7 @@ What changed in this homelab, when, and why. Newest first.
| GitOps | Flux `v2.9.5` 的四个核心 controller 已上线;集群内只读 Gitea source 与 `prune: false` 的 root Kustomization 均在合并 revision `aaa54a1` 上 Ready,完成了首个 pull reconciliation 闭环 | | GitOps | Flux `v2.9.5` 的四个核心 controller 已上线;集群内只读 Gitea source 与 `prune: false` 的 root Kustomization 均在合并 revision `aaa54a1` 上 Ready,完成了首个 pull reconciliation 闭环 |
| cleanup | 已把 `bao-acme` HTTP-01 solver 改到 Envoy Gateway 的明文 listener,并删除不再承载流量的 Contour namespace、provisioner、RBAC、GatewayClass 和全部 `projectcontour.io` CRD;Envoy Gateway、证书、DNS 与 Gitea 复查正常 | | cleanup | 已把 `bao-acme` HTTP-01 solver 改到 Envoy Gateway 的明文 listener,并删除不再承载流量的 Contour namespace、provisioner、RBAC、GatewayClass 和全部 `projectcontour.io` CRD;Envoy Gateway、证书、DNS 与 Gitea 复查正常 |
| GitOps canary | 加入由 Flux 部署到独立 `gitops-canary` namespace 的 `http-echo` Deployment 和 Service;历史 Contour HTTPRoute 明确排除在 Kustomization 之外,初始保持 `prune: false` | | GitOps canary | 加入由 Flux 部署到独立 `gitops-canary` namespace 的 `http-echo` Deployment 和 Service;历史 Contour HTTPRoute 明确排除在 Kustomization 之外,初始保持 `prune: false` |
| prune 验证 | 为 `http-echo` 加入无业务依赖的 `flux-prune-canary` ConfigMap;先在 `prune: false` 下确认 Flux inventory,后续通过独立 PR 删除并仅为 canary 开启 prune |
`Carried forward`: re-verify OpenBao/ESO recovery and remaining Secret inventory; `Carried forward`: re-verify OpenBao/ESO recovery and remaining Secret inventory;
configure an off-site Git mirror; plan the Gitea upgrade beyond 1.25.5; configure an off-site Git mirror; plan the Gitea upgrade beyond 1.25.5;
+6 -1
View File
@@ -7,7 +7,8 @@ Flux 将它部署到独立的 `gitops-canary` namespace。
| --- | --- | | --- | --- |
| `deployment.yaml` | 两个 `hashicorp/http-echo` 副本。 | | `deployment.yaml` | 两个 `hashicorp/http-echo` 副本。 |
| `service.yaml` | 只在集群内可达的 ClusterIP Service。 | | `service.yaml` | 只在集群内可达的 ClusterIP Service。 |
| `kustomization.yaml` | Flux 实际构建入口,只包含 Deployment 和 Service。 | | `prune-canary-configmap.yaml` | 无业务依赖的临时资源,用于验证 Flux 受控删除。 |
| `kustomization.yaml` | Flux 实际构建入口;明确排除历史 HTTPRoute。 |
| `httproute.yaml` | 保留的历史 Contour 示例,**不在 Kustomization 中,不会部署**。 | | `httproute.yaml` | 保留的历史 Contour 示例,**不在 Kustomization 中,不会部署**。 |
## 验证 ## 验证
@@ -22,3 +23,7 @@ sudo k3s kubectl -n gitops-canary get deployment,service,pod
初始 `prune: false`。验证自动部署后,可以手动把 Deployment replicas 改成 1, 初始 `prune: false`。验证自动部署后,可以手动把 Deployment replicas 改成 1,
确认 Flux 恢复为 Git 中的 2。删除行为应使用单独的无业务 ConfigMap 和 PR 测试, 确认 Flux 恢复为 Git 中的 2。删除行为应使用单独的无业务 ConfigMap 和 PR 测试,
验证完成前不得为此路径启用 prune。 验证完成前不得为此路径启用 prune。
`flux-prune-canary` ConfigMap 分两次 PR 验证:第一次在 `prune: false` 时创建并
确认进入 Flux inventory;第二次从清单删除它,同时仅为 `http-echo`
Kustomization 开启 prune,确认 Flux 只删除这个测试对象。
+1
View File
@@ -2,4 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- deployment.yaml - deployment.yaml
- prune-canary-configmap.yaml
- service.yaml - service.yaml
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: flux-prune-canary
data:
purpose: verify-controlled-flux-pruning