fix: fix error checking in kl.killPod within SyncPod

This commit is contained in:
zhifei92 2024-04-17 10:42:37 +08:00
parent bf07ef3950
commit f6f07035a8

View File

@ -1863,11 +1863,11 @@ func (kl *Kubelet) SyncPod(ctx context.Context, updateType kubetypes.SyncPodType
if !pcm.Exists(pod) && !firstSync {
p := kubecontainer.ConvertPodStatusToRunningPod(kl.getRuntime().Type(), podStatus)
if err := kl.killPod(ctx, pod, p, nil); err == nil {
if wait.Interrupted(err) {
return false, err
}
podKilled = true
} else {
if wait.Interrupted(err) {
return false, nil
}
klog.ErrorS(err, "KillPod failed", "pod", klog.KObj(pod), "podStatus", podStatus)
}
}