fix: failed to keep s3 bucket retain#595
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Pull request overview
This PR fixes S3 data being deleted when pvcRetentionPolicy=Delete is used together with s3RetentionPolicy=Retain, by ensuring released buckets do not run the S3 cleanup job during finalization. It also adjusts LogSet retention-policy getters to better handle older objects where only one of the two policies is set.
Changes:
- Skip S3 data deletion and directly remove the
BucketDataFinalizerwhen aBucketClaimis inStatusReleased(retain behavior). - Update
LogSetSpecretention-policy getters to implement PVC↔S3 inheritance when only one policy is present, defaulting toDeletewhen neither is set.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/controllers/bucketclaim/controller.go | Avoids deleting S3 data when the bucket is already marked Released (retain semantics) by skipping the cleanup job and removing the finalizer. |
| api/core/v1alpha1/logset_types.go | Updates retention-policy getters to infer missing PVC/S3 policies for backward compatibility with older resources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dfb51ac to
a0528f4
Compare
Code Review: fix: failed to keep s3 bucket retain
〇、总结(TL;DR)本 PR 修复
一、PR 描述评审设计文档状态PR body 四维评审
二、方案评审2.0 变更可视化修改前(简化): 修改后: Retention policy getter: 2.1 方案合理性✅ 总体合理。 ✅ getter 兼容逻辑合理。Webhook/default helper 仍会在新对象上把缺失 policy 落到 spec,getter 改为只读后主要影响旧对象或绕过 webhook 的测试对象;新增 UT 覆盖了 nil、单字段、双字段组合,并断言 getter 不修改 spec。 🟡 测试语义需要同步更新。本 PR 改变了 Released 删除路径,已有两个 e2e “reclaim job success” 场景现在不会再触发 reclaim job,见 I-1。 2.2/2.3 不适用本 PR 无架构重构或存量破坏性 API 变更; 2.4 测试方案梳理
回归验证效率:
本地验证情况:
三、变更概述PR 在 PR 同时调整 LogSet 的 PVC/S3 retention policy getter:不再调用会写回 spec 的 测试方面新增 getter UT、BucketClaim finalizer UT 和一个真实 MinIO e2e 回归场景,覆盖 #594 的关键路径。 四、代码审查(逐文件)
问题: 影响:回归测试名称和断言会误导后续维护者,以为缺 bucket / 缺 prefix 的 S3 cleanup job 成功路径仍有 e2e 保护;实际上相关 job 逻辑已不被这些用例触达。 建议:二选一处理:
问题: 影响: 建议:把 4.5、API / 配置变更清单
五、潜在风险检查
|
|
Tick the box to add this pull request to the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes # #594
What this PR does / why we need it:
Not Available
Special notes for your reviewer:
Not Available
Additional documentation (e.g. design docs, usage docs, etc.):
Not Available