Skip to content

Commit b082cf9

Browse files
committed
Fix to requeue for trying this deletion again later
1 parent 3fbfc49 commit b082cf9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/controller/launcher-populator/populator.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ func (ctl *controller) reconcileLaunchersOnSingleNode(ctx context.Context, nodeN
405405

406406
// Execute Phase 1: Delete all marked pods FIRST (across all configs on this node)
407407
deletedCount := 0
408+
var conflictErrors []string
408409
for _, del := range allDeletions {
409410
if err := ctl.coreclient.Pods(del.pod.Namespace).Delete(ctx, del.pod.Name, metav1.DeleteOptions{
410411
Preconditions: &metav1.Preconditions{
@@ -419,6 +420,7 @@ func (ctl *controller) reconcileLaunchersOnSingleNode(ctx context.Context, nodeN
419420
if apierrors.IsConflict(err) {
420421
logger.Info("Launcher pod version conflict, skipping deletion",
421422
"pod", del.pod.Name, "error", err)
423+
conflictErrors = append(conflictErrors, del.pod.Name)
422424
continue
423425
}
424426
return fmt.Errorf("failed to delete launcher pod %s: %w", del.pod.Name, err)
@@ -431,6 +433,11 @@ func (ctl *controller) reconcileLaunchersOnSingleNode(ctx context.Context, nodeN
431433
deletedCount++
432434
}
433435

436+
if len(conflictErrors) > 0 {
437+
return fmt.Errorf("encountered %d version conflicts during deletion (pods: %v), will retry",
438+
len(conflictErrors), conflictErrors)
439+
}
440+
434441
if deletedCount < len(allDeletions) {
435442
logger.Info("Fewer pods deleted than planned",
436443
"planned", len(allDeletions),

0 commit comments

Comments
 (0)