Skip to content

Commit

Permalink
koordlet: skip the container which is not running in cpuBurst applyC…
Browse files Browse the repository at this point in the history
…FSQuotaBurst (#2055)

Signed-off-by: yangfeiyu <yangfeiyu20102011@163.com>
  • Loading branch information
yangfeiyu20102011 committed May 22, 2024
1 parent eed98fa commit e6ae456
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ func (b *cpuBurst) applyCFSQuotaBurst(burstCfg *slov1alpha1.CPUBurstConfig, podM
continue
}

if containerStat.State.Running == nil {
klog.V(6).Infof("skip container %s/%s/%s, because it is not running", pod.Namespace, pod.Name, containerStat.Name)
continue
}

containerBaseCFS := koordletutil.GetContainerBaseCFSQuota(container)
if containerBaseCFS <= 0 {
continue
Expand Down
2 changes: 2 additions & 0 deletions pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func newTestPodWithQOS(name string, qos apiext.QoSClass, cpuMilli, memoryBytes i
{
Name: containerName,
ContainerID: genTestContainerIDByName(containerName),
State: corev1.ContainerState{Running: &corev1.ContainerStateRunning{}},
},
},
Phase: corev1.PodRunning,
Expand Down Expand Up @@ -233,6 +234,7 @@ func createPodMetaByResource(podName string, containersRes map[string]corev1.Res
containerStat := corev1.ContainerStatus{
Name: containerName,
ContainerID: genTestContainerIDByName(containerName),
State: corev1.ContainerState{Running: &corev1.ContainerStateRunning{}},
}
pod.Spec.Containers = append(pod.Spec.Containers, container)
pod.Status.ContainerStatuses = append(pod.Status.ContainerStatuses, containerStat)
Expand Down

0 comments on commit e6ae456

Please sign in to comment.