-
Notifications
You must be signed in to change notification settings - Fork 8
fix(controller): skip reaping succeeded Job pods #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -431,6 +431,12 @@ func (r *PodPlacementReconciler) reapTerminalPod(ctx context.Context, pod *corev | |
| if !util.IsTerminalPodPhase(pod.Status.Phase) { | ||
| return false, nil | ||
| } | ||
| // Do not delete succeeded Pods owned by Jobs; keep for status reporting. | ||
| if pod.Status.Phase == corev1.PodSucceeded { | ||
| if owner := metav1.GetControllerOf(pod); owner != nil && owner.Kind == "Job" { | ||
| return false, nil | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 5 'NodeClaim|Pod-less|PodSucceeded|Succeeded' internal --glob '*.go'Repository: InftyAI/Nebula Length of output: 42424 🏁 Script executed: set -euo pipefail
printf '%s\n' '--- changed diff ---'
git diff c605d6c5ee0104d60b96032e91f8ab8ebc0de05b..0f261b4e8f7d442fce0e089a27266b51ee1303bb -- internal/controller/pod_placement_helpers.go internal/controller/pod_placement_controller.go
printf '%s\n' '--- helper symbols ---'
rg -n -C 35 'func .*reapTerminalPod|reapTerminalPod|PodSucceeded|owner.*Job|Kind.*Job' internal/controller/pod_placement_helpers.go
printf '%s\n' '--- NodeClaim reconcile and teardown symbols ---'
rg -n -C 35 'func \(r \*NodeClaimReconciler\) Reconcile|desiredPhase|self.delete|SelfDelete|Delete|finalizer|Provider|PodRef|Pod.*NotFound|Terminated|Terminating' internal/controller/nodeclaim_controller.goRepository: InftyAI/Nebula Length of output: 32307 Release the NodeClaim when retaining a succeeded Job Pod.
Trigger 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| if !isControllerOwned(pod) { | ||
| return false, nil // bare Pod: leave it as a record | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: InftyAI/Nebula
Length of output: 3201
Check the controller API group before preserving the Pod.
GetControllerOfreturns the controller reference without restricting its API group. A succeeded Pod controlled by any resource withKind == "Job"can therefore bypass reaping. Check thatowner.APIVersionbelongs to the KubernetesbatchAPI group before returning.🤖 Prompt for AI Agents