diff --git a/pkg/kubelet/status/manager.go b/pkg/kubelet/status/manager.go index d991f6f619e..9ad3ad84bc5 100644 --- a/pkg/kubelet/status/manager.go +++ b/pkg/kubelet/status/manager.go @@ -347,6 +347,11 @@ func (m *manager) syncBatch() { // syncPod syncs the given status with the API server. The caller must not hold the lock. func (m *manager) syncPod(uid types.UID, status versionedPodStatus) { + if !m.needsUpdate(uid, status) { + glog.V(1).Infof("Status for pod %q is up-to-date; skipping", uid) + return + } + // TODO: make me easier to express from client code pod, err := m.kubeClient.Core().Pods(status.podNamespace).Get(status.podName) if errors.IsNotFound(err) { @@ -362,10 +367,6 @@ func (m *manager) syncPod(uid types.UID, status versionedPodStatus) { m.deletePodStatus(uid) return } - if !m.needsUpdate(pod.UID, status) { - glog.V(1).Infof("Status for pod %q is up-to-date; skipping", format.Pod(pod)) - return - } pod.Status = status.status // TODO: handle conflict as a retry, make that easier too. pod, err = m.kubeClient.Core().Pods(pod.Namespace).UpdateStatus(pod)