Skip to content

Commit 6c33cbb

Browse files
authored
fix: Mark Pending pod nodes as Failed when shutting down. Fixes argoproj#13210 (argoproj#13214)
Signed-off-by: oninowang <oninowang@tencent.com> Co-authored-by: jswxstw <jswxstw@gmail.com>
1 parent b49faaf commit 6c33cbb

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

workflow/controller/controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ spec:
724724
})
725725
expectWorkflow(ctx, controller, "my-wf-2", func(wf *wfv1.Workflow) {
726726
if assert.NotNil(t, wf) {
727-
assert.Equal(t, wfv1.WorkflowSucceeded, wf.Status.Phase)
727+
assert.Equal(t, wfv1.WorkflowFailed, wf.Status.Phase)
728728
}
729729
})
730730
})
@@ -1194,9 +1194,9 @@ func TestPendingPodWhenTerminate(t *testing.T) {
11941194

11951195
woc := newWorkflowOperationCtx(wf, controller)
11961196
woc.operate(ctx)
1197-
assert.Equal(t, wfv1.WorkflowSucceeded, woc.wf.Status.Phase)
1197+
assert.Equal(t, wfv1.WorkflowFailed, woc.wf.Status.Phase)
11981198
for _, node := range woc.wf.Status.Nodes {
1199-
assert.Equal(t, wfv1.NodeSkipped, node.Phase)
1199+
assert.Equal(t, wfv1.NodeFailed, node.Phase)
12001200
}
12011201
}
12021202

workflow/controller/operator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7816,7 +7816,7 @@ func TestNoPodsWhenShutdown(t *testing.T) {
78167816

78177817
node := woc.wf.Status.Nodes.FindByDisplayName("hello-world")
78187818
if assert.NotNil(t, node) {
7819-
assert.Equal(t, wfv1.NodeSkipped, node.Phase)
7819+
assert.Equal(t, wfv1.NodeFailed, node.Phase)
78207820
assert.Contains(t, node.Message, "workflow shutdown with strategy: Stop")
78217821
}
78227822
}

workflow/controller/workflowpod.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin
9696

9797
if !woc.GetShutdownStrategy().ShouldExecute(opts.onExitPod) {
9898
// Do not create pods if we are shutting down
99-
woc.markNodePhase(nodeName, wfv1.NodeSkipped, fmt.Sprintf("workflow shutdown with strategy: %s", woc.GetShutdownStrategy()))
99+
woc.markNodePhase(nodeName, wfv1.NodeFailed, fmt.Sprintf("workflow shutdown with strategy: %s", woc.GetShutdownStrategy()))
100100
return nil, nil
101101
}
102102

0 commit comments

Comments
 (0)