diff --git a/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst.go b/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst.go index b7e7b124f..67fc78f38 100644 --- a/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst.go +++ b/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst.go @@ -355,6 +355,11 @@ func (b *cpuBurst) applyCFSQuotaBurst(burstCfg *slov1alpha1.CPUBurstConfig, podM continue } + if containerStat.State.Running == nil { + klog.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 diff --git a/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst_test.go b/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst_test.go index 545445189..ef53f3e19 100644 --- a/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst_test.go +++ b/pkg/koordlet/qosmanager/plugins/cpuburst/cpu_burst_test.go @@ -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, @@ -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)