From a772691165313bf320fb0c198476132ea65befde Mon Sep 17 00:00:00 2001 From: kunkunhaohao <35520250+kunkunhaohao@users.noreply.github.com> Date: Wed, 15 Mar 2023 00:38:36 +0800 Subject: [PATCH] Update pod_container_manager_linux.go (#114598) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update pod_container_manager_linux.go This is a simple optimization to reduce repeated invoking of the GetPodContainerName function. * Update pod_container_manager_linux.go 将podContainerName, _ := m.GetPodContainerName(pod)更靠近使用podcontainerName变量的位置 --- pkg/kubelet/cm/pod_container_manager_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/kubelet/cm/pod_container_manager_linux.go b/pkg/kubelet/cm/pod_container_manager_linux.go index 2d4adffd1e2..dae7f8bd3d4 100644 --- a/pkg/kubelet/cm/pod_container_manager_linux.go +++ b/pkg/kubelet/cm/pod_container_manager_linux.go @@ -70,7 +70,6 @@ func (m *podContainerManagerImpl) Exists(pod *v1.Pod) bool { // pod cgroup exists if qos cgroup hierarchy flag is enabled. // If the pod level container doesn't already exist it is created. func (m *podContainerManagerImpl) EnsureExists(pod *v1.Pod) error { - podContainerName, _ := m.GetPodContainerName(pod) // check if container already exist alreadyExists := m.Exists(pod) if !alreadyExists { @@ -80,6 +79,7 @@ func (m *podContainerManagerImpl) EnsureExists(pod *v1.Pod) error { enforceMemoryQoS = true } // Create the pod container + podContainerName, _ := m.GetPodContainerName(pod) containerConfig := &CgroupConfig{ Name: podContainerName, ResourceParameters: ResourceConfigForPod(pod, m.enforceCPULimits, m.cpuCFSQuotaPeriod, enforceMemoryQoS),