Skip to content

fix(cleanup): enhance pod deletion logic and add tests for standalone pods#317

Merged
matthyx merged 1 commit into
mainfrom
clean-standalone-pods
Apr 30, 2026
Merged

fix(cleanup): enhance pod deletion logic and add tests for standalone pods#317
matthyx merged 1 commit into
mainfrom
clean-standalone-pods

Conversation

@matthyx
Copy link
Copy Markdown
Contributor

@matthyx matthyx commented Apr 30, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved cleanup operations to properly handle pod-based workloads as cleanable resource types. Pods are now correctly processed during cleanup cycles, ensuring orphaned pod profiles are appropriately removed.
  • Tests

    • Added tests validating pod cleanup behavior in standalone scenarios, confirming proper profile removal and retention across different workload configurations.

… pods

Signed-off-by: Matthias Bertschy <matthias.bertschy@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6522328-f225-4ba9-8c2b-501cf23d0021

📥 Commits

Reviewing files that changed from the base of the PR and between 2dbea36 and 8be42b9.

📒 Files selected for processing (2)
  • pkg/registry/file/cleanup.go
  • pkg/registry/file/cleanup_test.go

📝 Walkthrough

Walkthrough

The changes extend the workload cleanup logic to recognize "pod" as a cleanable workload kind by introducing an isCleanableWlidKind helper function. A new test suite validates cleanup behavior for standalone pod workloads with specific label and annotation configurations.

Changes

Cohort / File(s) Summary
Workload Kind Validation
pkg/registry/file/cleanup.go
Introduced isCleanableWlidKind helper function to route workload kind validation. Now treats "pod" as cleanable, replacing direct Workloads containment check in deleteByWlid logic.
Standalone Pod Cleanup Tests
pkg/registry/file/cleanup_test.go
Added new unit test suite for deleteByTemplateHashOrWlid with pod-scoped ObjectMeta. Tests deletion and preservation scenarios based on workload-id mapping presence in ResourceMaps.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A helper hops in, declaring pods are clean,
No more workload walls standing in between,
Tests verify each hop with care,
Pod cleanup logic, fair and square! 🧹✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: enhancing pod deletion logic and adding tests for standalone pods, which matches the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clean-standalone-pods

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
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@github-actions
Copy link
Copy Markdown

Summary:

  • License scan: failure
  • Credentials scan: failure
  • Vulnerabilities scan: success
  • Unit test: success
  • Go linting: failure

@matthyx matthyx merged commit 2a689d8 into main Apr 30, 2026
7 checks passed
@matthyx matthyx deleted the clean-standalone-pods branch April 30, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants