From 745d2cc6c2af9072cbddb93c809e099e4e110f22 Mon Sep 17 00:00:00 2001 From: panxiao81 Date: Thu, 10 Sep 2026 05:01:46 +0000 Subject: [PATCH] =?UTF-8?q?feat(gitops):=20staged=20=E6=8E=A5=E7=AE=A1=20G?= =?UTF-8?q?itea=20Actions=20Helm=20release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + clusters/homelab/apps/gitea-actions.yaml | 14 ++++++++++ clusters/homelab/kustomization.yaml | 1 + platform/gitea-runner/README.md | 6 +++++ platform/gitea-runner/helmrelease.yaml | 32 +++++++++++++++++++++++ platform/gitea-runner/helmrepository.yaml | 8 ++++++ platform/gitea-runner/kustomization.yaml | 16 ++++++++++++ 7 files changed, 78 insertions(+) create mode 100644 clusters/homelab/apps/gitea-actions.yaml create mode 100644 platform/gitea-runner/helmrelease.yaml create mode 100644 platform/gitea-runner/helmrepository.yaml create mode 100644 platform/gitea-runner/kustomization.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e4a599..0b8fe67 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ What changed in this homelab, when, and why. Newest first. |---|---| | GitOps | PR #18 合并后,Flux 自行发现 revision `f257a2a` 并删除已在 `prune: true` 下重新进入 inventory 的测试 ConfigMap;未发送 reconcile annotation,`http-echo` Deployment/Service 保持 Ready,root 继续 `prune: false` | | Helm migration | 选定 `gitea-actions` 作为第一个 Flux HelmRelease adoption:它不承载 Git、入口、DNS、证书、数据库或 secrets controller。live StatefulSet 与 Git 都使用 regular DinD,但 Helm 保存的 release values/manifest 仍是失败的 rootless 配置;接管先固定 chart `0.1.1` 并验证 live Pod spec 不变,升级另开 PR | +| Helm adoption stage | 为 `gitea-actions` 加入固定 chart `0.1.1` 的 HelmRepository、values ConfigMap 和 `suspend: true` HelmRelease;第一阶段只让 Flux 登记对象,确认 source 与固定 chart render 后再解除 suspend,失败策略使用 `RetryOnFailure` 以避免回滚到 stored rootless manifest | `Carried forward`: adopt `gitea-actions` with a zero-change HelmRelease; then order the remaining Helm migrations by dependency and blast radius. Root Flux diff --git a/clusters/homelab/apps/gitea-actions.yaml b/clusters/homelab/apps/gitea-actions.yaml new file mode 100644 index 0000000..c98a246 --- /dev/null +++ b/clusters/homelab/apps/gitea-actions.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: gitea-actions + namespace: flux-system +spec: + interval: 10m + path: ./platform/gitea-runner + prune: false + sourceRef: + kind: GitRepository + name: flux-system + timeout: 3m + wait: false diff --git a/clusters/homelab/kustomization.yaml b/clusters/homelab/kustomization.yaml index e312ec1..b8af640 100644 --- a/clusters/homelab/kustomization.yaml +++ b/clusters/homelab/kustomization.yaml @@ -3,4 +3,5 @@ kind: Kustomization resources: - flux-system - namespaces/gitops-canary.yaml + - apps/gitea-actions.yaml - apps/http-echo.yaml diff --git a/platform/gitea-runner/README.md b/platform/gitea-runner/README.md index 606f72e..e41611a 100644 --- a/platform/gitea-runner/README.md +++ b/platform/gitea-runner/README.md @@ -26,6 +26,12 @@ rootless DinD 尝试,但 live StatefulSet 与本目录 `values.yaml` 都已经 DinD。首次 reconcile 的验收条件是修正 Helm 存储状态,同时 live Pod spec、PVC identity、runner capacity 和在线状态保持不变。接管稳定后再用独立 PR 升级 chart。 +接管分两阶段:第一阶段提交 `suspend: true` 的 HelmRelease、HelmRepository 和由 +`values.yaml` 生成的 ConfigMap。Flux 只登记这些对象,不执行 Helm action。合并后 +检查 HelmRepository Ready,并用固定 chart 重复比较期望清单与 live StatefulSet; +第二阶段才解除 suspend。失败重试使用 `RetryOnFailure`,不会用 stored rootless +release 做 rollback。 + ## 历史 review-first bootstrap 这是 Flux 安装前执行过的一次性手动部署流程,保留用于恢复和审计: diff --git a/platform/gitea-runner/helmrelease.yaml b/platform/gitea-runner/helmrelease.yaml new file mode 100644 index 0000000..d0a0d0f --- /dev/null +++ b/platform/gitea-runner/helmrelease.yaml @@ -0,0 +1,32 @@ +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: gitea-actions + namespace: gitea-actions +spec: + chart: + spec: + chart: actions + interval: 1h + sourceRef: + kind: HelmRepository + name: gitea-charts + version: 0.1.1 + driftDetection: + mode: enabled + install: + strategy: + name: RetryOnFailure + retryInterval: 5m + interval: 30m + releaseName: gitea-actions + suspend: true + targetNamespace: gitea-actions + timeout: 10m + upgrade: + strategy: + name: RetryOnFailure + retryInterval: 5m + valuesFrom: + - kind: ConfigMap + name: gitea-actions-values diff --git a/platform/gitea-runner/helmrepository.yaml b/platform/gitea-runner/helmrepository.yaml new file mode 100644 index 0000000..c545a84 --- /dev/null +++ b/platform/gitea-runner/helmrepository.yaml @@ -0,0 +1,8 @@ +apiVersion: source.toolkit.fluxcd.io/v1 +kind: HelmRepository +metadata: + name: gitea-charts + namespace: gitea-actions +spec: + interval: 1h + url: https://dl.gitea.com/charts/ diff --git a/platform/gitea-runner/kustomization.yaml b/platform/gitea-runner/kustomization.yaml new file mode 100644 index 0000000..d4c6516 --- /dev/null +++ b/platform/gitea-runner/kustomization.yaml @@ -0,0 +1,16 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +generatorOptions: + disableNameSuffixHash: true + labels: + reconcile.fluxcd.io/watch: Enabled +configMapGenerator: + - name: gitea-actions-values + namespace: gitea-actions + files: + - values.yaml=values.yaml +resources: + - namespace.yaml + - external-secret.yaml + - helmrepository.yaml + - helmrelease.yaml