Add sysinv support for kubernetes to ignore isolcpus

Based on the kube-ignore-isol-cpus host label which will generate
/etc/kubernetes/ignore_isolcpus, also adjust the k8s_all_reserved_cpuset
passed to puppet if the label exists.

Basically if the label is set, we want to pass the isolated CPUs to
kubernetes as though they were regular application CPUs.

Story: 2008760
Task: 42167
Change-Id: I065ca40fbd3395bf86a02a7822c1f9d46ee3fe06
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2020-10-27 17:12:56 -04:00 committed by Chris Friesen
parent 7ce5367d57
commit bb6e8db569
2 changed files with 16 additions and 3 deletions

View File

@ -1701,6 +1701,7 @@ SRIOV_LABEL = 'sriov=enabled'
SRIOVDP_LABEL = 'sriovdp=enabled'
KUBE_TOPOLOGY_MANAGER_LABEL = 'kube-topology-mgr-policy'
KUBE_CPU_MANAGER_LABEL = 'kube-cpu-mgr-policy'
KUBE_IGNORE_ISOL_CPU_LABEL = 'kube-ignore-isol-cpus'
# Accepted label values
KUBE_TOPOLOGY_MANAGER_VALUES = [

View File

@ -322,9 +322,21 @@ class KubernetesPuppet(base.BasePuppet):
# determine reserved sets of logical cpus in a string range set format
# to pass as options to kubelet
k8s_platform_cpuset = utils.format_range_set(platform_cpuset)
k8s_all_reserved_cpuset = utils.format_range_set(platform_cpuset |
vswitch_cpuset |
isol_cpuset)
# determine whether to reserve isolated CPUs
reserve_isolcpus = True
labels = self.dbapi.label_get_by_host(host.uuid)
for label in labels:
if label.label_key == constants.KUBE_IGNORE_ISOL_CPU_LABEL:
reserve_isolcpus = False
break
if reserve_isolcpus:
k8s_all_reserved_cpuset = utils.format_range_set(platform_cpuset |
vswitch_cpuset |
isol_cpuset)
else:
k8s_all_reserved_cpuset = utils.format_range_set(platform_cpuset |
vswitch_cpuset)
# determine platform reserved memory
k8s_reserved_mem = 0