From eb56d46b745666f1aafb876572ad0f1f234c1ed0 Mon Sep 17 00:00:00 2001 From: Random-Liu Date: Mon, 18 Jan 2016 00:23:48 -0800 Subject: [PATCH] Minor clean up in kubelet syncPod() --- pkg/kubelet/dockertools/manager.go | 1 - pkg/kubelet/kubelet.go | 13 ++----------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/kubelet/dockertools/manager.go b/pkg/kubelet/dockertools/manager.go index 2f64966ed70..75cdf712b6b 100644 --- a/pkg/kubelet/dockertools/manager.go +++ b/pkg/kubelet/dockertools/manager.go @@ -440,7 +440,6 @@ func (dm *DockerManager) ConvertPodStatusToAPIPodStatus(pod *api.Pod, podStatus } containerDone := sets.NewString() - // NOTE(random-liu): The Pod IP is generated in kubelet.generatePodStatus(), we have no podStatus.IP now apiPodStatus.PodIP = podStatus.IP for _, containerStatus := range podStatus.ContainerStatuses { cName := containerStatus.Name diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 1931f6e57d1..f44a1897b5d 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -1719,17 +1719,8 @@ func (kl *Kubelet) syncPod(pod *api.Pod, mirrorPod *api.Pod, runningPod kubecont if podUsesHostNetwork(pod) { kl.recorder.Event(pod, api.EventTypeWarning, kubecontainer.HostNetworkNotSupported, "Bandwidth shaping is not currently supported on the host network") } else if kl.shaper != nil { - status, found := kl.statusManager.GetPodStatus(pod.UID) - if !found { - statusPtr, err := kl.containerRuntime.GetAPIPodStatus(pod) - if err != nil { - glog.Errorf("Error getting pod for bandwidth shaping") - return err - } - status = *statusPtr - } - if len(status.PodIP) > 0 { - err = kl.shaper.ReconcileCIDR(fmt.Sprintf("%s/32", status.PodIP), egress, ingress) + if len(apiPodStatus.PodIP) > 0 { + err = kl.shaper.ReconcileCIDR(fmt.Sprintf("%s/32", apiPodStatus.PodIP), egress, ingress) } } else { kl.recorder.Event(pod, api.EventTypeWarning, kubecontainer.UndefinedShaper, "Pod requests bandwidth shaping, but the shaper is undefined")