![Sachin Gopala Krishna](/assets/img/avatar_default.png)
This ports the remaining kubernetes 1.24.4 patches. The following patches were refactored slightly to allow for upstream changes: kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch kubelet-cpumanager-keep-normal-containers-off-reserv.patch The following patch was added to get tests working again: cpumanager-policy-static-test-refactor.patch Test-plan: 1. Revert-use-subpath-for-coredns-only-for-default-repo: Kubeadm commands worked as expected 2. enable-support-for-kubernetes-to-ignore-isolcpus: Set kube-cpu-mgr-policy as static and allocated some isolcpus. i. Deployed a pod with dedicated CPU and verified that it is not affined to isolcpus. ii. kube-ignore-isol-cpus is set to enabled, deployed a pod with dedicated CPU and verified that is allocated to isolated CPU. 3. kubeadm-create-platform-pods-with-zero-CPU-resources: Verified the usage of CPUs is 0 in coredns, kube-controller-manager, kube-scheduler, and kube-apiserver pods of kube-system namespace. 4. kubelet-cpumanager-disable-CFS-quota-throttling-for- : Verified that pods that in the "Guaranteed" QoS class, on hosts that have "kube-cpu-mgr-policy=static" have cpu.cfs_quota_us set to -1. 5. kubelet-cpumanager-infra-pods-use-system-reserved-CP: Verified that platform pods are affined to platform CPUs 6. kubelet-cpumanager-introduce-concept-of-isolated-CPU: Verified pods can allocate isolated CPUs and are affined to them. Verified pods allocating application CPUs don't get isolated CPUs. Verified that pods allocating dedicated and isolated CPUs are affined to the dedicated CPUs. Verified that pods allocating non-dedicated and isolated CPUs are affined to the isolated CPUs. 7. kubelet-cpumanager-keep-normal-containers-off-reserv: Verified the pod which is not in platform namespace are affined to application or application isolated CPUs 8. kubelet-sort-isolcpus-allocation-when-SMT-enabled: Verified after enabling SMT multithreading that isolated CPUs are allocated as lowest-numbered SMT siblings first and then higher-numbered SMT siblings, then any single thread. 9. kubernetes-make-isolcpus-allocation-SMT-aware: Verified after enabling SMT multithreading that isolated CPUs are allocated as pairs of SMT siblings first, then already-existing single SMT siblings, then we allocate one of a pair of SMT siblings as a last resort. Story: 2010301 Task: 46315 Signed-off-by: Sachin Gopala Krishna <saching.krishna@windriver.com> Signed-off-by: Chris Friesen <chris.friesen@windriver.com> Change-Id: Ic8f3d53f58f09ae13f9c299fb31e5f91a0a5bc9f
86 lines
3.5 KiB
Diff
86 lines
3.5 KiB
Diff
From 9ede7db445ff799d78fae4c20d9558962573ede7 Mon Sep 17 00:00:00 2001
|
|
From: Sachin Gopala Krishna <saching.krishna@windriver.com>
|
|
Date: Tue, 11 Oct 2022 09:09:00 -0400
|
|
Subject: [PATCH] cpumanager policy static test refactor
|
|
|
|
This refactors the tests which were breaking due to changes in isolated
|
|
CPUs and reserved CPUs.
|
|
|
|
Signed-off-by: Sachin Gopala Krishna <saching.krishna@windriver.com>
|
|
|
|
---
|
|
pkg/kubelet/cm/cpumanager/cpu_manager_test.go | 11 ++++++++---
|
|
pkg/kubelet/cm/cpumanager/policy_static_test.go | 5 +++--
|
|
2 files changed, 11 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/pkg/kubelet/cm/cpumanager/cpu_manager_test.go b/pkg/kubelet/cm/cpumanager/cpu_manager_test.go
|
|
index 31e4d0585fb..87c4ae036ca 100644
|
|
--- a/pkg/kubelet/cm/cpumanager/cpu_manager_test.go
|
|
+++ b/pkg/kubelet/cm/cpumanager/cpu_manager_test.go
|
|
@@ -715,6 +715,8 @@ func TestCPUManagerRemove(t *testing.T) {
|
|
}
|
|
|
|
func TestReconcileState(t *testing.T) {
|
|
+ testExcl := false
|
|
+ testDM, _ := devicemanager.NewManagerStub()
|
|
testPolicy, _ := NewStaticPolicy(
|
|
&topology.CPUTopology{
|
|
NumCPUs: 8,
|
|
@@ -733,8 +735,11 @@ func TestReconcileState(t *testing.T) {
|
|
},
|
|
0,
|
|
cpuset.NewCPUSet(),
|
|
+ cpuset.NewCPUSet(),
|
|
topologymanager.NewFakeManager(),
|
|
- nil)
|
|
+ nil,
|
|
+ testDM,
|
|
+ testExcl)
|
|
|
|
testCases := []struct {
|
|
description string
|
|
@@ -1369,8 +1374,8 @@ func TestCPUManagerHandlePolicyOptions(t *testing.T) {
|
|
t.Errorf("cannot create state file: %s", err.Error())
|
|
}
|
|
defer os.RemoveAll(sDir)
|
|
-
|
|
- _, err = NewManager(testCase.cpuPolicyName, testCase.cpuPolicyOptions, 5*time.Second, machineInfo, cpuset.NewCPUSet(), nodeAllocatableReservation, sDir, topologymanager.NewFakeManager())
|
|
+ testDM, err := devicemanager.NewManagerStub()
|
|
+ _, err = NewManager(testCase.cpuPolicyName, testCase.cpuPolicyOptions, 5*time.Second, machineInfo, cpuset.NewCPUSet(), nodeAllocatableReservation, sDir, topologymanager.NewFakeManager(), testDM)
|
|
if err == nil {
|
|
t.Errorf("Expected error, but NewManager succeeded")
|
|
}
|
|
diff --git a/pkg/kubelet/cm/cpumanager/policy_static_test.go b/pkg/kubelet/cm/cpumanager/policy_static_test.go
|
|
index 39aaaf95b28..d0308556c6d 100644
|
|
--- a/pkg/kubelet/cm/cpumanager/policy_static_test.go
|
|
+++ b/pkg/kubelet/cm/cpumanager/policy_static_test.go
|
|
@@ -202,7 +202,6 @@ func TestStaticPolicyAdd(t *testing.T) {
|
|
largeTopoCPUSet := largeTopoBuilder.Result()
|
|
largeTopoSock0CPUSet := largeTopoSock0Builder.Result()
|
|
largeTopoSock1CPUSet := largeTopoSock1Builder.Result()
|
|
- testDM, _ := devicemanager.NewManagerStub()
|
|
// these are the cases which must behave the same regardless the policy options.
|
|
// So we will permutate the options to ensure this holds true.
|
|
optionsInsensitiveTestCases := []staticPolicyTest{
|
|
@@ -576,6 +575,8 @@ func runStaticPolicyTestCase(t *testing.T, testCase staticPolicyTest) {
|
|
}
|
|
|
|
func TestStaticPolicyReuseCPUs(t *testing.T) {
|
|
+ excludeReserved := false
|
|
+ testDM, _ := devicemanager.NewManagerStub()
|
|
testCases := []struct {
|
|
staticPolicyTest
|
|
expCSetAfterAlloc cpuset.CPUSet
|
|
@@ -692,7 +693,7 @@ func TestStaticPolicyRemove(t *testing.T) {
|
|
}
|
|
|
|
for _, testCase := range testCases {
|
|
- policy, _ := NewStaticPolicy(testCase.topo, testCase.numReservedCPUs, cpuset.NewCPUSet(), topologymanager.NewFakeManager(), nil)
|
|
+ policy, _ := NewStaticPolicy(testCase.topo, testCase.numReservedCPUs, cpuset.NewCPUSet(), cpuset.NewCPUSet(), topologymanager.NewFakeManager(), nil, testDM, excludeReserved)
|
|
|
|
st := &mockState{
|
|
assignments: testCase.stAssignments,
|
|
--
|
|
2.25.1
|
|
|