Skip to content

fix 🐛: 修复集群资源漂移与删除清理 - #18

Merged
snowykami merged 1 commit into
mainfrom
codex/fix-cluster-resource-drift
Sep 14, 2026
Merged

snowykami merged 1 commit into
mainfrom
codex/fix-cluster-resource-drift

Conversation

@snowykami

@snowykami snowykami commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

根因

  • 集群资源查询把 UI 页大小下推成每个 Kubernetes Kind 的查询上限,又在权限过滤后二次分页,导致实际资源被截断。
  • 应用删除先软删除部署目标,而项目清理只查询活跃目标,最终跳过了集群命名空间与资源清理。
  • 删除流程缺少 Kubernetes 删除后的权威回读,集群删除也没有在最终提交前重新检查业务引用。
  • 历史 retained_volume_records 未桥接到当前 ProjectVolume,PVC 因此存在于集群却无法在平台管理。

修复

  • 完整拉取 Kubernetes continuation pages,过滤、排序后统一分页并返回真实 total。
  • 集群资源入口对平台用户显示全部已授权集群,并显式呈现查询失败。
  • 删除任务读取包含软删除记录的历史目标,扫描真实活跃集群,删除后回读确认;项目与集群最终提交前重新核对引用。
  • 通过一次性迁移把可确定归属的 retained 记录桥接为 ProjectVolume,并在部署、扩容、删除、导出或快照前接管 PVC。
  • 空 cluster_id 仅在恰好一个活跃全局集群时解析;多集群歧义记录保持不动,不做猜测。
  • 本 PR 不直接删除任何线上 Kubernetes 资源。

验证

  • bash scripts/ci/check-go.sh
  • AUTH_TEST_DATABASE_URL=postgres://devops:devops@127.0.0.1:5432/devops?sslmode=disable bash scripts/ci/check-go-postgres.sh
  • bash scripts/ci/check-go-race.sh
  • bash scripts/ci/check-web.sh
  • bash scripts/ci/check-agent.sh
  • git diff --check

以上均通过。

@vercel

vercel Bot commented Sep 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devops Ready Ready Preview Sep 14, 2026 9:16am UTC

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: c4588d94-9101-4544-9a9a-47bf9b7a6960


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@snowykami
snowykami merged commit f917e89 into main Sep 14, 2026
17 checks passed

This branch was successfully deployed

1 active deployment
Preview — 045805d5 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant