Skip to content
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

fix(containerSet): mark container deleted when pod deleted. Fixes: #12210 #12756

Merged
merged 9 commits into from
Mar 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: containerset does not stop container when pod removed. Fixes: #1…
…2210

Signed-off-by: shuangkun <tsk2013uestc@163.com>
shuangkun committed Mar 19, 2024
commit a56cd09f29b083af554dd9cbeff6008e8780a9fa
2 changes: 1 addition & 1 deletion workflow/controller/controller_test.go
Original file line number Diff line number Diff line change
@@ -548,7 +548,7 @@ func makePodsPhase(ctx context.Context, woc *wfOperationCtx, phase apiv1.PodPhas
func deletePods(ctx context.Context, woc *wfOperationCtx) {
for _, obj := range woc.controller.podInformer.GetStore().List() {
pod := obj.(*apiv1.Pod)
err := woc.controller.kubeclientset.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{})
err := woc.controller.kubeclientset.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, metav1.DeleteOptions{GracePeriodSeconds: pointer.Int64Ptr(0)})
if err != nil {
panic(err)
}
11 changes: 11 additions & 0 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
@@ -1224,6 +1224,17 @@ func (woc *wfOperationCtx) podReconciliation(ctx context.Context) (error, bool)
woc.updated = true
}
woc.markNodePhase(node.Name, wfv1.NodeError, "pod deleted")
// Set pod's child(container) error if pod deleted
for _, childNodeID := range node.Children {
childNode, err := woc.wf.Status.Nodes.Get(childNodeID)
if err != nil {
woc.log.Errorf("was unable to obtain node for %s", childNodeID)
continue
}
if childNode.Type == wfv1.NodeTypeContainer {
woc.markNodeError(childNode.Name, errors.New("","container deleted"))
}
}
}
}
return nil, !taskResultIncomplete