integ/kubernetes/kubernetes-1.28.4/debian/deb_folder/patches/Affinity-of-guaranteed-pod-to-non-isolated-CPUs.patch
Saba Touheed Mujawar bc28897dc5 Add kubernetes 1.28.4 patches
This change ports the following kubernetes 1.28.4 patches which were
refactored slightly to allow for upstream changes

The following patches were applied cleanly:
kubelet-sort-isolcpus-allocation-when-SMT-enabled.patch
kubelet-cpumanager-disable-CFS-quota-throttling.patch
kubelet-cpumanager-keep-normal-containers-off-reserv.patch
kubelet-cpumanager-infra-pods-use-system-reserved-CP.patch
Affinity-of-guaranteed-pod-to-non-isolated-CPUs.patch
kubelet-CFS-quota-throttling-for-non-integer-cpulimit.patch

The following patches were refactored:
kubeadm-create-platform-pods-with-zero-CPU-resources.patch
kubernetes-make-isolcpus-allocation-SMT-aware.patch
kubelet-cpumanager-introduce-concept-of-isolated-CPU.patch
enable-support-for-kubernetes-to-ignore-isolcpus.patch

Note: Revert-use-subpath-for-coredns-only-for-default-repo.patch
      is removed as this change that updates the dns
      imageRepository is taken care in ansible playbook
      https://review.opendev.org/c/starlingx/ansible-playbooks/+/903499/1/playbookconfig/src/playbooks/roles/common/files/kubeadm.yaml.j2

Test Plan:
PASS: Kubernetes package 1.28.4 builds properly.
PASS: Run all Kubelet, kubeadm, kubectl make tests for affected code.
PASS: build-iso successful with multiple kubernetes versions
PASS: Install iso with k8s 1.28 default and test all patches.

Story: 2010878
Task: 49209

Change-Id: I7693ad2fcc93d146eeae882d44f83b60589565db
Signed-off-by: Saba Touheed Mujawar <sabatouheed.mujawar@windriver.com>
2023-12-18 01:38:21 -05:00

35 lines
1.5 KiB
Diff

From 904157cdf02bf9dd0d90af4372ceadd16717e806 Mon Sep 17 00:00:00 2001
From: Boovan Rajendran <boovan.rajendran@windriver.com>
Date: Mon, 6 Nov 2023 02:22:16 -0500
Subject: [PATCH] Affinity of guaranteed pod to non-isolated CPUs
This corrects kubelet cpumanager static cpuset tracking for isolcpus
for versions 1.26.1 and 1.27.5. This ensures that pods specified with
isolcpus + guaranteed QoS + integer cpu requests, are affined to
exclusive cpuset and tracked as non-isolated cpus.
Signed-off-by: Boovan Rajendran <boovan.rajendran@windriver.com>
---
pkg/kubelet/cm/cpumanager/policy_static.go | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pkg/kubelet/cm/cpumanager/policy_static.go b/pkg/kubelet/cm/cpumanager/policy_static.go
index e9a2defd848..c76a6edbc20 100644
--- a/pkg/kubelet/cm/cpumanager/policy_static.go
+++ b/pkg/kubelet/cm/cpumanager/policy_static.go
@@ -343,7 +343,10 @@ func (p *staticPolicy) Allocate(s state.State, pod *v1.Pod, container *v1.Contai
return nil
}
- if isolcpus := p.podIsolCPUs(pod, container); isolcpus.Size() > 0 {
+ cpuQuantity := container.Resources.Requests[v1.ResourceCPU]
+ fractionalCpuQuantity := cpuQuantity.MilliValue() % 1000
+ if isolcpus := p.podIsolCPUs(pod, container); isolcpus.Size() > 0 &&
+ v1qos.GetPodQOS(pod) != v1.PodQOSGuaranteed && fractionalCpuQuantity == 0{
// container has requested isolated CPUs
if set, ok := s.GetCPUSet(string(pod.UID), container.Name); ok {
if set.Equals(isolcpus) {
--
2.25.1