Skip to content

Commit 825aacf

Browse files
authored
fix: Only cleanup agent pod if exists. Fixes argoproj#12659 (argoproj#13294)
Signed-off-by: oninowang <oninowang@tencent.com> Signed-off-by: jswxstw <jswxstw@gmail.com> Co-authored-by: jswxstw <jswxstw@gmail.com>
1 parent 3f9b992 commit 825aacf

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

workflow/controller/controller_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,6 @@ spec:
11411141

11421142
woc.operate(ctx)
11431143
assert.True(t, controller.processNextPodCleanupItem(ctx))
1144-
assert.True(t, controller.processNextPodCleanupItem(ctx))
11451144
assert.Equal(t, wfv1.WorkflowSucceeded, woc.wf.Status.Phase)
11461145
podCleanupKey := "test/my-wf/labelPodCompleted"
11471146
assert.Equal(t, 0, controller.podCleanupQueue.NumRequeues(podCleanupKey))
@@ -1174,7 +1173,6 @@ spec:
11741173
assert.True(t, controller.processNextPodCleanupItem(ctx))
11751174
assert.True(t, controller.processNextPodCleanupItem(ctx))
11761175
assert.True(t, controller.processNextPodCleanupItem(ctx))
1177-
assert.True(t, controller.processNextPodCleanupItem(ctx))
11781176
assert.Equal(t, wfv1.WorkflowFailed, woc.wf.Status.Phase)
11791177
pods, err := listPods(woc)
11801178
assert.NoError(t, err)
@@ -1215,7 +1213,6 @@ func TestWorkflowReferItselfFromExpression(t *testing.T) {
12151213

12161214
woc.operate(ctx)
12171215
assert.True(t, controller.processNextPodCleanupItem(ctx))
1218-
assert.True(t, controller.processNextPodCleanupItem(ctx))
12191216
assert.Equal(t, wfv1.WorkflowSucceeded, woc.wf.Status.Phase)
12201217
}
12211218

@@ -1253,6 +1250,5 @@ func TestWorkflowWithLongArguments(t *testing.T) {
12531250

12541251
woc.operate(ctx)
12551252
assert.True(t, controller.processNextPodCleanupItem(ctx))
1256-
assert.True(t, controller.processNextPodCleanupItem(ctx))
12571253
assert.Equal(t, wfv1.WorkflowSucceeded, woc.wf.Status.Phase)
12581254
}

workflow/controller/operator.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,9 @@ func (woc *wfOperationCtx) markWorkflowPhase(ctx context.Context, phase wfv1.Wor
23992399
}
24002400
}
24012401
woc.updated = true
2402-
woc.controller.queuePodForCleanup(woc.wf.Namespace, woc.getAgentPodName(), deletePod)
2402+
if woc.hasTaskSetNodes() {
2403+
woc.controller.queuePodForCleanup(woc.wf.Namespace, woc.getAgentPodName(), deletePod)
2404+
}
24032405
}
24042406
}
24052407

0 commit comments

Comments
 (0)