Skip to content

Add grace period support to pod deletion action#2125

Open
arikalon1 wants to merge 1 commit into
masterfrom
claude/delete-alert-pod-grace-period-anltwb
Open

Add grace period support to pod deletion action#2125
arikalon1 wants to merge 1 commit into
masterfrom
claude/delete-alert-pod-grace-period-anltwb

Conversation

@arikalon1

Copy link
Copy Markdown
Contributor

Summary

Added support for configurable grace period when deleting pods in the delete_alert_pod action, allowing users to specify how long Kubernetes should wait before forcefully terminating a pod.

Changes

  • Added grace_period_seconds optional parameter to DeleteAlertPodParams class
  • Updated the pod.delete() call to pass the grace period parameter
  • Added documentation for the new parameter explaining that zero means immediate deletion and omitting it uses the pod's default grace period

Implementation Details

  • The grace_period_seconds parameter is optional (defaults to None), maintaining backward compatibility
  • When None, the pod's default grace period is used by Kubernetes
  • When set to 0, the pod is deleted immediately without waiting
  • The parameter is passed directly to the underlying pod.delete() method

https://claude.ai/code/session_01GT8gcjrboPS1NkX52BBeLD

The parameter defaults to None, preserving the existing behavior
(pod's default grace period) for backward compatibility.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GT8gcjrboPS1NkX52BBeLD
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Docker image ready for 9fac765 (built in 2m 43s)

⚠️ Warning: does not support ARM (ARM images are built on release only - not on every PR)

Use this tag to pull the image for testing.

📋 Copy commands

⚠️ Temporary images are deleted after 30 days. Copy to a permanent registry before using them:

gcloud auth configure-docker us-central1-docker.pkg.dev
docker pull us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:9fac765
docker tag us-central1-docker.pkg.dev/robusta-development/temporary-builds/robusta-runner:9fac765 me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:9fac765
docker push me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:9fac765

Patch Helm values in one line:

helm upgrade --install robusta robusta/robusta \
  --reuse-values \
  --set runner.image=me-west1-docker.pkg.dev/robusta-development/development/robusta-runner-dev:9fac765

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The delete-alert-pod action adds an optional grace_period_seconds parameter and passes it to Kubernetes pod deletion, allowing immediate, custom, or default grace-period behavior.

Changes

Pod deletion grace period

Layer / File(s) Summary
Configure and apply deletion grace period
playbooks/robusta_playbooks/pod_actions.py
DeleteAlertPodParams defines the optional grace period, and delete_alert_pod forwards it to pod.delete(...).

Estimated code review effort: 1 (Trivial) | ~3 minutes

Possibly related PRs

  • robusta-dev/robusta#2079: Introduced the DeleteAlertPodParams and delete_alert_pod functionality extended by this change.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding grace period support to pod deletion.
Description check ✅ Passed The description is directly aligned with the changeset and explains the new parameter and behavior.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.
✨ 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 claude/delete-alert-pod-grace-period-anltwb

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
playbooks/robusta_playbooks/pod_actions.py (1)

67-67: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression tests for DeleteAlertPodParams.grace_period_seconds. Cover None, 0, and a positive custom value, and assert pod.delete receives the matching grace_period_seconds keyword argument.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@playbooks/robusta_playbooks/pod_actions.py` at line 67, Add regression tests
for DeleteAlertPodParams.grace_period_seconds covering None, 0, and a positive
custom value. Exercise the pod deletion flow and assert pod.delete is called
with the corresponding grace_period_seconds keyword argument in each case.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@playbooks/robusta_playbooks/pod_actions.py`:
- Line 67: Add regression tests for DeleteAlertPodParams.grace_period_seconds
covering None, 0, and a positive custom value. Exercise the pod deletion flow
and assert pod.delete is called with the corresponding grace_period_seconds
keyword argument in each case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0ec30136-be67-4c01-a4ad-0b9f6fd53a47

📥 Commits

Reviewing files that changed from the base of the PR and between eb350a4 and 62b4877.

📒 Files selected for processing (1)
  • playbooks/robusta_playbooks/pod_actions.py

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.

2 participants