Skip to content

Commit

Permalink
fix: delete pending pod when workflow terminated
Browse files Browse the repository at this point in the history
Co-authored-by: shuangkun <tsk2013uestc@163.com>
Co-authored-by: zjgemi <liuxin_zijian@163.com>
Signed-off-by: shuangkun <tsk2013uestc@163.com>
  • Loading branch information
shuangkun and zjgemi committed Nov 21, 2023
1 parent feaed7a commit 7e5d4f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion workflow/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,10 @@ func (wfc *WorkflowController) processNextPodCleanupItem(ctx context.Context) bo
pods := wfc.kubeclientset.CoreV1().Pods(namespace)
switch action {
case terminateContainers:
if terminationGracePeriod, err := wfc.signalContainers(namespace, podName, syscall.SIGTERM); err != nil {
pod, err := wfc.getPod(namespace, podName)
if err == nil && pod != nil && pod.Status.Phase == "Pending" {
wfc.queuePodForCleanup(namespace, podName, deletePod)
} else if terminationGracePeriod, err := wfc.signalContainers(namespace, podName, syscall.SIGTERM); err != nil {
return err
} else if terminationGracePeriod > 0 {
wfc.queuePodForCleanupAfter(namespace, podName, killContainers, terminationGracePeriod)
Expand Down

0 comments on commit 7e5d4f6

Please sign in to comment.