mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #23141 from yujuhong/fix_race
Auto commit by PR queue bot
This commit is contained in:
commit
61b9a21cfd
@ -238,16 +238,7 @@ func (s *podStorage) merge(source string, change interface{}) (adds, updates, de
|
||||
}
|
||||
recordFirstSeenTime(ref)
|
||||
pods[name] = ref
|
||||
// If a pod is not found in the cache, and it's also not in the
|
||||
// pending phase, it implies that kubelet may have restarted.
|
||||
// Treat this pod as update so that kubelet wouldn't reject the
|
||||
// pod in the admission process.
|
||||
if ref.Status.Phase != api.PodPending {
|
||||
updatePods = append(updatePods, ref)
|
||||
} else {
|
||||
// this is an add
|
||||
addPods = append(addPods, ref)
|
||||
}
|
||||
addPods = append(addPods, ref)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,9 +74,6 @@ func CreateValidPod(name, namespace string) *api.Pod {
|
||||
},
|
||||
},
|
||||
},
|
||||
Status: api.PodStatus{
|
||||
Phase: api.PodPending,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2386,6 +2386,10 @@ func (kl *Kubelet) syncLoopIteration(updates <-chan kubetypes.PodUpdate, handler
|
||||
switch u.Op {
|
||||
case kubetypes.ADD:
|
||||
glog.V(2).Infof("SyncLoop (ADD, %q): %q", u.Source, format.Pods(u.Pods))
|
||||
// After restarting, kubelet will get all existing pods through
|
||||
// ADD as if they are new pods. These pods will then go through the
|
||||
// admission process and *may* be rejcted. This can be resolved
|
||||
// once we have checkpointing.
|
||||
handler.HandlePodAdditions(u.Pods)
|
||||
case kubetypes.UPDATE:
|
||||
glog.V(2).Infof("SyncLoop (UPDATE, %q): %q", u.Source, format.Pods(u.Pods))
|
||||
|
Loading…
Reference in New Issue
Block a user