mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Update pod_container_manager_linux.go (#114598)
* 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变量的位置
This commit is contained in:
parent
f769c66aa8
commit
a772691165
@ -70,7 +70,6 @@ func (m *podContainerManagerImpl) Exists(pod *v1.Pod) bool {
|
|||||||
// pod cgroup exists if qos cgroup hierarchy flag is enabled.
|
// pod cgroup exists if qos cgroup hierarchy flag is enabled.
|
||||||
// If the pod level container doesn't already exist it is created.
|
// If the pod level container doesn't already exist it is created.
|
||||||
func (m *podContainerManagerImpl) EnsureExists(pod *v1.Pod) error {
|
func (m *podContainerManagerImpl) EnsureExists(pod *v1.Pod) error {
|
||||||
podContainerName, _ := m.GetPodContainerName(pod)
|
|
||||||
// check if container already exist
|
// check if container already exist
|
||||||
alreadyExists := m.Exists(pod)
|
alreadyExists := m.Exists(pod)
|
||||||
if !alreadyExists {
|
if !alreadyExists {
|
||||||
@ -80,6 +79,7 @@ func (m *podContainerManagerImpl) EnsureExists(pod *v1.Pod) error {
|
|||||||
enforceMemoryQoS = true
|
enforceMemoryQoS = true
|
||||||
}
|
}
|
||||||
// Create the pod container
|
// Create the pod container
|
||||||
|
podContainerName, _ := m.GetPodContainerName(pod)
|
||||||
containerConfig := &CgroupConfig{
|
containerConfig := &CgroupConfig{
|
||||||
Name: podContainerName,
|
Name: podContainerName,
|
||||||
ResourceParameters: ResourceConfigForPod(pod, m.enforceCPULimits, m.cpuCFSQuotaPeriod, enforceMemoryQoS),
|
ResourceParameters: ResourceConfigForPod(pod, m.enforceCPULimits, m.cpuCFSQuotaPeriod, enforceMemoryQoS),
|
||||||
|
Loading…
Reference in New Issue
Block a user