Create mirrorPod in runOnce to update API before syncPod

+ Fix #14992
+ "When deploying a pod using an on-disk kubelet manifest (a la /etc/kubernetes/manifests), it appears that the network plugin setUpPod is notified of the new pod before the apiserver."
This commit is contained in:
Alexander Hersh
2015-11-04 10:50:43 -08:00
parent 4711a87323
commit 0584f9ba7a
2 changed files with 32 additions and 19 deletions

View File

@@ -108,9 +108,15 @@ func (kl *Kubelet) runPod(pod *api.Pod, retryDelay time.Duration) error {
return nil
}
glog.Infof("pod %q containers not running: syncing", pod.Name)
// We don't create mirror pods in this mode; pass a dummy boolean value
// to sycnPod.
if err = kl.syncPod(pod, nil, p, kubetypes.SyncPodUpdate); err != nil {
podFullName := kubecontainer.GetPodFullName(pod)
glog.Infof("Creating a mirror pod for static pod %q", podFullName)
if err := kl.podManager.CreateMirrorPod(pod); err != nil {
glog.Errorf("Failed creating a mirror pod %q: %v", podFullName, err)
}
mirrorPod, _ := kl.podManager.GetMirrorPodByPod(pod)
if err = kl.syncPod(pod, mirrorPod, p, kubetypes.SyncPodUpdate); err != nil {
return fmt.Errorf("error syncing pod: %v", err)
}
if retry >= RunOnceMaxRetries {