Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

koordlet: skip the container which is not running in cpuBurst applyCFSQuotaBurst #2055

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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