mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Merge pull request #56105 from balajismaniam/enable-cpuman-only-when-not-skipped
Automatic merge from submit-queue (batch tested with PRs 55340, 55329, 56168, 56170, 56105). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Enable cpu manager only if the node e2e test is not skipped. **What this PR does / why we need it**: This PR enables cpu manager in Kubelet only if the node e2e tests are not skipped. This change fixes the failures seen in https://k8s-testgrid.appspot.com/sig-node-kubelet#kubelet-serial-gce-e2e. Fixes #56144
This commit is contained in:
commit
754017bef4
@ -156,6 +156,10 @@ func enableCPUManagerInKubelet(f *framework.Framework) (oldCfg *kubeletconfig.Ku
|
|||||||
// The Kubelet panics if either kube-reserved or system-reserved is not set
|
// The Kubelet panics if either kube-reserved or system-reserved is not set
|
||||||
// when CPU Manager is enabled. Set cpu in kube-reserved > 0 so that
|
// when CPU Manager is enabled. Set cpu in kube-reserved > 0 so that
|
||||||
// kubelet doesn't panic.
|
// kubelet doesn't panic.
|
||||||
|
if newCfg.KubeReserved == nil {
|
||||||
|
newCfg.KubeReserved = map[string]string{}
|
||||||
|
}
|
||||||
|
|
||||||
if _, ok := newCfg.KubeReserved["cpu"]; !ok {
|
if _, ok := newCfg.KubeReserved["cpu"]; !ok {
|
||||||
newCfg.KubeReserved["cpu"] = "200m"
|
newCfg.KubeReserved["cpu"] = "200m"
|
||||||
}
|
}
|
||||||
@ -183,15 +187,16 @@ func runCPUManagerTests(f *framework.Framework) {
|
|||||||
var pod, pod1, pod2 *v1.Pod
|
var pod, pod1, pod2 *v1.Pod
|
||||||
|
|
||||||
It("should assign CPUs as expected based on the Pod spec", func() {
|
It("should assign CPUs as expected based on the Pod spec", func() {
|
||||||
oldCfg = enableCPUManagerInKubelet(f)
|
|
||||||
|
|
||||||
cpuCap, cpuAlloc, cpuRes = getLocalNodeCPUDetails(f)
|
cpuCap, cpuAlloc, cpuRes = getLocalNodeCPUDetails(f)
|
||||||
|
|
||||||
// Skip CPU Manager tests if the number of allocatable CPUs < 1.
|
// Skip CPU Manager tests altogether if the CPU capacity < 2.
|
||||||
if cpuAlloc < 1 {
|
if cpuCap < 2 {
|
||||||
framework.Skipf("Skipping CPU Manager tests since the number of allocatable CPUs < 1")
|
framework.Skipf("Skipping CPU Manager tests since the CPU capacity < 2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable CPU Manager in the kubelet.
|
||||||
|
oldCfg = enableCPUManagerInKubelet(f)
|
||||||
|
|
||||||
By("running a non-Gu pod")
|
By("running a non-Gu pod")
|
||||||
ctnAttrs = []ctnAttribute{
|
ctnAttrs = []ctnAttribute{
|
||||||
{
|
{
|
||||||
@ -286,9 +291,9 @@ func runCPUManagerTests(f *framework.Framework) {
|
|||||||
waitForContainerRemoval(fmt.Sprintf("%s_%s", pod1.Spec.Containers[0].Name, pod1.Name))
|
waitForContainerRemoval(fmt.Sprintf("%s_%s", pod1.Spec.Containers[0].Name, pod1.Name))
|
||||||
waitForContainerRemoval(fmt.Sprintf("%s_%s", pod2.Spec.Containers[0].Name, pod2.Name))
|
waitForContainerRemoval(fmt.Sprintf("%s_%s", pod2.Spec.Containers[0].Name, pod2.Name))
|
||||||
|
|
||||||
// Skip rest of the tests if the number of allocatable CPUs < 2.
|
// Skip rest of the tests if CPU capacity < 3.
|
||||||
if cpuAlloc < 2 {
|
if cpuCap < 3 {
|
||||||
framework.Skipf("Skipping rest of the CPU Manager tests since the number of allocatable CPUs < 2")
|
framework.Skipf("Skipping rest of the CPU Manager tests since CPU capacity < 3")
|
||||||
}
|
}
|
||||||
|
|
||||||
By("running a Gu pod requesting multiple CPUs")
|
By("running a Gu pod requesting multiple CPUs")
|
||||||
|
Loading…
Reference in New Issue
Block a user