a046a7a650
Here are the changes needed for adding k8s v1.22.5 in StarlingX alongside with the changes needed for the build environment to find and build the package. The package builds successfully. Deployed an iso with k8s 1.22.5 on AIO-SX and AIO-DX. The deployment phase works and the pods are up and running after the upgrade completes. Story: 2009789 Task: 44305 Signed-off-by: Daniel Safta <daniel.safta@windriver.com> Change-Id: Ibb9be075fa0b1491b9ab1854ebb1fddf4df53461
80 lines
3.0 KiB
Diff
80 lines
3.0 KiB
Diff
From 087dcfa1a84ec38541fa9870937d76b80a707e2c Mon Sep 17 00:00:00 2001
|
|
From: Chris Friesen <chris.friesen@windriver.com>
|
|
Date: Fri, 23 Oct 2020 17:46:10 -0600
|
|
Subject: [PATCH 6/7] enable support for kubernetes to ignore isolcpus
|
|
|
|
The normal mechanisms for allocating isolated CPUs do not allow
|
|
a mix of isolated and exclusive CPUs in the same container. In
|
|
order to allow this in *very* limited cases where the pod spec
|
|
is known in advance we will add the ability to disable the normal
|
|
isolcpus behaviour.
|
|
|
|
If the file "/etc/kubernetes/ignore_isolcpus" exists, then kubelet
|
|
will basically forget everything it knows about isolcpus and just
|
|
treat them like regular CPUs.
|
|
|
|
The admin user can then rely on the fact that CPU allocation is
|
|
deterministic to ensure that the isolcpus they configure end up being
|
|
allocated to the correct pods.
|
|
|
|
Signed-off-by: Daniel Safta <daniel.safta@windriver.com>
|
|
---
|
|
pkg/kubelet/cm/cpumanager/cpu_manager.go | 8 ++++++++
|
|
pkg/kubelet/cm/cpumanager/policy_static.go | 7 +++++++
|
|
2 files changed, 15 insertions(+)
|
|
|
|
diff --git a/pkg/kubelet/cm/cpumanager/cpu_manager.go b/pkg/kubelet/cm/cpumanager/cpu_manager.go
|
|
index 2f5b06dc..d9ec63bb 100644
|
|
--- a/pkg/kubelet/cm/cpumanager/cpu_manager.go
|
|
+++ b/pkg/kubelet/cm/cpumanager/cpu_manager.go
|
|
@@ -20,6 +20,7 @@ import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"math"
|
|
+ "os"
|
|
"strings"
|
|
"sync"
|
|
"time"
|
|
@@ -55,6 +56,13 @@ const cpuManagerStateFileName = "cpu_manager_state"
|
|
|
|
// get the system-level isolated CPUs
|
|
func getIsolcpus() cpuset.CPUSet {
|
|
+ // This is a gross hack to basically turn off awareness of isolcpus to enable
|
|
+ // isolated cpus to be allocated to pods the same way as non-isolated CPUs.
|
|
+ if _, err := os.Stat("/etc/kubernetes/ignore_isolcpus"); err == nil {
|
|
+ klog.Infof("[cpumanager] turning off isolcpus awareness")
|
|
+ return cpuset.NewCPUSet()
|
|
+ }
|
|
+
|
|
dat, err := ioutil.ReadFile("/sys/devices/system/cpu/isolated")
|
|
if err != nil {
|
|
klog.Errorf("[cpumanager] unable to read sysfs isolcpus subdir")
|
|
diff --git a/pkg/kubelet/cm/cpumanager/policy_static.go b/pkg/kubelet/cm/cpumanager/policy_static.go
|
|
index 72a99496..ee389a85 100644
|
|
--- a/pkg/kubelet/cm/cpumanager/policy_static.go
|
|
+++ b/pkg/kubelet/cm/cpumanager/policy_static.go
|
|
@@ -18,6 +18,7 @@ package cpumanager
|
|
|
|
import (
|
|
"fmt"
|
|
+ "os"
|
|
"strconv"
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
@@ -658,6 +659,12 @@ func isKubeInfra(pod *v1.Pod) bool {
|
|
|
|
// get the isolated CPUs (if any) from the devices associated with a specific container
|
|
func (p *staticPolicy) podIsolCPUs(pod *v1.Pod, container *v1.Container) cpuset.CPUSet {
|
|
+ // This is a gross hack to basically turn off awareness of isolcpus to enable
|
|
+ // isolated cpus to be allocated to pods the same way as non-isolated CPUs.
|
|
+ if _, err := os.Stat("/etc/kubernetes/ignore_isolcpus"); err == nil {
|
|
+ return cpuset.NewCPUSet()
|
|
+ }
|
|
+
|
|
// NOTE: This is required for TestStaticPolicyAdd() since makePod() does
|
|
// not create UID. We also need a way to properly stub devicemanager.
|
|
if len(string(pod.UID)) == 0 {
|
|
--
|
|
2.17.1
|
|
|