mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #104268 from rphillips/fixes_terminating_pod_race
kubelet: fix sandbox creation error suppression when pods are quickly deleted
This commit is contained in:
commit
24a09c3ade
@ -67,6 +67,11 @@ func newFakePodStateProvider() *fakePodStateProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *fakePodStateProvider) IsPodTerminationRequested(uid types.UID) bool {
|
||||||
|
_, found := f.removed[uid]
|
||||||
|
return found
|
||||||
|
}
|
||||||
|
|
||||||
func (f *fakePodStateProvider) ShouldPodRuntimeBeRemoved(uid types.UID) bool {
|
func (f *fakePodStateProvider) ShouldPodRuntimeBeRemoved(uid types.UID) bool {
|
||||||
_, found := f.terminated[uid]
|
_, found := f.terminated[uid]
|
||||||
return found
|
return found
|
||||||
|
@ -78,6 +78,7 @@ var (
|
|||||||
// podStateProvider can determine if none of the elements are necessary to retain (pod content)
|
// podStateProvider can determine if none of the elements are necessary to retain (pod content)
|
||||||
// or if none of the runtime elements are necessary to retain (containers)
|
// or if none of the runtime elements are necessary to retain (containers)
|
||||||
type podStateProvider interface {
|
type podStateProvider interface {
|
||||||
|
IsPodTerminationRequested(kubetypes.UID) bool
|
||||||
ShouldPodContentBeRemoved(kubetypes.UID) bool
|
ShouldPodContentBeRemoved(kubetypes.UID) bool
|
||||||
ShouldPodRuntimeBeRemoved(kubetypes.UID) bool
|
ShouldPodRuntimeBeRemoved(kubetypes.UID) bool
|
||||||
}
|
}
|
||||||
@ -805,8 +806,10 @@ func (m *kubeGenericRuntimeManager) SyncPod(pod *v1.Pod, podStatus *kubecontaine
|
|||||||
// or CRI if the Pod has been deleted while the POD is
|
// or CRI if the Pod has been deleted while the POD is
|
||||||
// being created. If the pod has been deleted then it's
|
// being created. If the pod has been deleted then it's
|
||||||
// not a real error.
|
// not a real error.
|
||||||
// TODO: this is probably not needed now that termination is part of the sync loop
|
//
|
||||||
if m.podStateProvider.ShouldPodContentBeRemoved(pod.UID) {
|
// SyncPod can still be running when we get here, which
|
||||||
|
// means the PodWorker has not acked the deletion.
|
||||||
|
if m.podStateProvider.IsPodTerminationRequested(pod.UID) {
|
||||||
klog.V(4).InfoS("Pod was deleted and sandbox failed to be created", "pod", klog.KObj(pod), "podUID", pod.UID)
|
klog.V(4).InfoS("Pod was deleted and sandbox failed to be created", "pod", klog.KObj(pod), "podUID", pod.UID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user