Add integ/kubernetes for Trixie
Added packaging support for Trixie under 'debian/trixie/'. This change brings updates from the 'f/trixie' branch into 'master' to ensure consistent functionality and packaging structure across both branches. isolcpus-device-plugin kubernetes-unversioned Story: 2011360 Task: 53245 Change-Id: I40bdc1830cdd410f5f4ccc95090f8f0fa4171dd7 Signed-off-by: pmp1 <preetham.mp@windriver.com> Signed-off-by: Abhinav Ayyapasetti <ayyapasetti.abhinav@windriver.com>
This commit is contained in:
committed by
Abhinav Ayyapasetti
parent
82b99a06d6
commit
62e12202d9
@@ -0,0 +1,5 @@
|
||||
kubernetes-unversioned (1.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Mihnea Saracin <mihnea.saracin@opendev.org> Mon, 15 Nov 2021 16:09:12 +0000
|
||||
@@ -0,0 +1,16 @@
|
||||
Source: kubernetes-unversioned
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <StarlingX-discuss@lists.StarlingX.io>
|
||||
Build-Depends: debhelper-compat (= 13), libsystemd-dev
|
||||
Standards-Version: 4.4.1
|
||||
Homepage: https://www.starlingx.io
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: kubernetes-unversioned
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
systemd
|
||||
Description: Kubernetes unversioned common config and current version symlinks
|
||||
This package contains kubernetes config files and current version symlinks
|
||||
@@ -0,0 +1,22 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: kubernetes-unversioned
|
||||
Source: https://opendev.org/starlingx/integ/src/branch/master/kubernetes/kubernetes-unversioned
|
||||
|
||||
Files: *
|
||||
Copyright: (c) 2022 Wind River Systems, Inc
|
||||
(c) Others (See individual files for more details)
|
||||
License: Apache-2
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
On Debian-based systems the full text of the Apache version 2.0 license
|
||||
can be found in `/usr/share/common-licenses/Apache-2.0'.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Note: This dropin only works with kubeadm and kubelet v1.11+
|
||||
[Unit]
|
||||
ConditionPathExists=/etc/default/kubelet
|
||||
ConditionPathExists=/var/lib/kubelet/config.yaml
|
||||
[Service]
|
||||
Environment="KUBELET_KUBECONFIG_ARGS=--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
|
||||
Environment="KUBELET_CONFIG_ARGS=--config=/var/lib/kubelet/config.yaml"
|
||||
# This is a file that "kubeadm init" and "kubeadm join" generates at runtime, populating the KUBELET_KUBEADM_ARGS variable dynamically
|
||||
EnvironmentFile=-/var/lib/kubelet/kubeadm-flags.env
|
||||
# This is a file that the user can use for overrides of the kubelet args as a last resort. Preferably, the user should use
|
||||
# the .NodeRegistration.KubeletExtraArgs object in the configuration files instead. KUBELET_EXTRA_ARGS should be sourced from this file.
|
||||
EnvironmentFile=-/etc/default/kubelet
|
||||
ExecStart=
|
||||
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
|
||||
ExecStartPre=-/usr/local/sbin/sanitize_kubelet_reserved_cpus.sh /etc/default/kubelet
|
||||
ExecStartPre=-/usr/bin/kubelet-cgroup-setup.sh
|
||||
ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/kubelet.pid;'
|
||||
ExecStopPost=/bin/rm -f /var/run/kubelet.pid
|
||||
StartLimitInterval=0
|
||||
RestartSec=10
|
||||
@@ -0,0 +1,133 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2024 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# This script does minimal cgroup setup for kubelet. This creates k8s-infra
|
||||
# cgroup for a minimal set of resource controllers, and configures cpuset
|
||||
# attributes to span all online cpus and nodes. This will do nothing if
|
||||
# the k8s-infra cgroup already exists (i.e., assume already configured).
|
||||
# NOTE: The creation of directories under /sys/fs/cgroup is volatile, and
|
||||
# does not persist reboots. The cpuset.mems and cpuset.cpus is later updated
|
||||
# by puppet kubernetes.pp manifest.
|
||||
#
|
||||
|
||||
# Define minimal path
|
||||
PATH=/bin:/usr/bin:/usr/local/bin
|
||||
|
||||
# Log info message to /var/log/daemon.log
|
||||
function LOG {
|
||||
logger -p daemon.info "$0($$): $@"
|
||||
}
|
||||
|
||||
# Log error message to /var/log/daemon.log
|
||||
function ERROR {
|
||||
logger -s -p daemon.error "$0($$): ERROR: $@"
|
||||
}
|
||||
|
||||
# Create minimal cgroup directories and configure cpuset attributes if required
|
||||
function create_cgroup {
|
||||
local cg_name=$1
|
||||
local cg_nodeset=$2
|
||||
local cg_cpuset=$3
|
||||
|
||||
local CGROUP=/sys/fs/cgroup
|
||||
local CONTROLLERS_AUTO_DELETED=("pids" "hugetlb")
|
||||
local CONTROLLERS_PRESERVED=("cpuset" "memory" "cpu,cpuacct" "systemd")
|
||||
local cnt=''
|
||||
local CGDIR=''
|
||||
local RC=0
|
||||
|
||||
# Ensure that these cgroups are created every time as they are auto deleted
|
||||
for cnt in ${CONTROLLERS_AUTO_DELETED[@]}; do
|
||||
CGDIR=${CGROUP}/${cnt}/${cg_name}
|
||||
if [ -d ${CGDIR} ]; then
|
||||
LOG "Nothing to do, already configured: ${CGDIR}."
|
||||
continue
|
||||
fi
|
||||
LOG "Creating: ${CGDIR}"
|
||||
mkdir -p ${CGDIR}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Creating: ${CGDIR}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
done
|
||||
|
||||
# These cgroups are preserved so if any of these are encountered additional
|
||||
# cgroup setup is not required
|
||||
for cnt in ${CONTROLLERS_PRESERVED[@]}; do
|
||||
CGDIR=${CGROUP}/${cnt}/${cg_name}
|
||||
if [ -d ${CGDIR} ]; then
|
||||
LOG "Nothing to do, already configured: ${CGDIR}."
|
||||
return ${RC}
|
||||
fi
|
||||
LOG "Creating: ${CGDIR}"
|
||||
mkdir -p ${CGDIR}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Creating: ${CGDIR}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
done
|
||||
|
||||
# Customize cpuset attributes
|
||||
LOG "Configuring cgroup: ${cg_name}, nodeset: ${cg_nodeset}, cpuset: ${cg_cpuset}"
|
||||
CGDIR=${CGROUP}/cpuset/${cg_name}
|
||||
local CGMEMS=${CGDIR}/cpuset.mems
|
||||
local CGCPUS=${CGDIR}/cpuset.cpus
|
||||
local CGTASKS=${CGDIR}/tasks
|
||||
|
||||
# Assign cgroup memory nodeset
|
||||
LOG "Assign nodeset ${cg_nodeset} to ${CGMEMS}"
|
||||
echo ${cg_nodeset} > ${CGMEMS}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Unable to write to: ${CGMEMS}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
|
||||
# Assign cgroup cpus
|
||||
LOG "Assign cpuset ${cg_cpuset} to ${CGCPUS}"
|
||||
echo ${cg_cpuset} > ${CGCPUS}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Assigning: ${cg_cpuset} to ${CGCPUS}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
|
||||
# Set file ownership
|
||||
chown root:root ${CGMEMS} ${CGCPUS} ${CGTASKS}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Setting owner for: ${CGMEMS}, ${CGCPUS}, ${CGTASKS}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
|
||||
# Set file mode permissions
|
||||
chmod 644 ${CGMEMS} ${CGCPUS} ${CGTASKS}
|
||||
RC=$?
|
||||
if [ ${RC} -ne 0 ]; then
|
||||
ERROR "Setting mode for: ${CGMEMS}, ${CGCPUS}, ${CGTASKS}, rc=${RC}"
|
||||
exit ${RC}
|
||||
fi
|
||||
|
||||
return ${RC}
|
||||
}
|
||||
|
||||
if [ ${UID} -ne 0 ]; then
|
||||
ERROR "Require sudo/root."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Configure default kubepods cpuset to span all online cpus and nodes.
|
||||
ONLINE_NODESET=$(/bin/cat /sys/devices/system/node/online)
|
||||
ONLINE_CPUSET=$(/bin/cat /sys/devices/system/cpu/online)
|
||||
|
||||
# Configure kubelet cgroup to match cgroupRoot.
|
||||
create_cgroup 'k8s-infra' ${ONLINE_NODESET} ${ONLINE_CPUSET}
|
||||
create_cgroup 'k8s-infra-stx' ${ONLINE_NODESET} ${ONLINE_CPUSET}
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[Manager]
|
||||
DefaultCPUAccounting=yes
|
||||
DefaultMemoryAccounting=yes
|
||||
@@ -0,0 +1,5 @@
|
||||
etc/systemd/system/kubelet.service.d
|
||||
usr/share/bash-completion/completions
|
||||
var/lib/kubelet
|
||||
var/lib/kubernetes
|
||||
run/kubernetes
|
||||
@@ -0,0 +1,10 @@
|
||||
usr/lib/systemd/system/kubelet.service
|
||||
etc/kubernetes/config
|
||||
etc/kubernetes/kubelet
|
||||
etc/kubernetes/kubelet.kubeconfig
|
||||
etc/kubernetes/proxy
|
||||
etc/systemd/system/kubelet.service.d/kubeadm.conf
|
||||
etc/systemd/system.conf.d/kubernetes-accounting.conf
|
||||
usr/lib/tmpfiles.d/kubernetes.conf
|
||||
usr/bin/kubelet-cgroup-setup.sh
|
||||
usr/local/sbin/sanitize_kubelet_reserved_cpus.sh
|
||||
@@ -0,0 +1,4 @@
|
||||
/var/lib/kubernetes/stage1/usr/bin/kubeadm /usr/bin/kubeadm
|
||||
/var/lib/kubernetes/stage2/usr/bin/kubelet /usr/bin/kubelet
|
||||
/var/lib/kubernetes/stage1/usr/bin/kubectl /usr/bin/kubectl
|
||||
/var/lib/kubernetes/stage1/usr/share/bash-completion/completions/kubectl /usr/share/bash-completion/completions/kubectl
|
||||
@@ -0,0 +1,4 @@
|
||||
usr/bin/kubeadm
|
||||
usr/bin/kubelet
|
||||
usr/bin/kubectl
|
||||
usr/share/bash-completion/completions/kubectl
|
||||
@@ -0,0 +1,25 @@
|
||||
From c7f3a7c54c3fc5bbf8708e98e4cef145eaeb6983 Mon Sep 17 00:00:00 2001
|
||||
From: Ramesh Kumar Sivanandam <rameshkumar.sivanandam@windriver.com>
|
||||
Date: Fri, 2 Dec 2022 18:55:34 +0530
|
||||
Subject: [PATCH] Remove KUBE_ALLOW_PRIV from kubelet service
|
||||
|
||||
Signed-off-by: Ramesh Kumar Sivanandam <rameshkumar.sivanandam@windriver.com>
|
||||
---
|
||||
init/systemd/kubelet.service | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/init/systemd/kubelet.service b/init/systemd/kubelet.service
|
||||
index 1082bba..5808312 100644
|
||||
--- a/init/systemd/kubelet.service
|
||||
+++ b/init/systemd/kubelet.service
|
||||
@@ -15,7 +15,6 @@ ExecStart=/usr/bin/kubelet \
|
||||
$KUBELET_ADDRESS \
|
||||
$KUBELET_PORT \
|
||||
$KUBELET_HOSTNAME \
|
||||
- $KUBE_ALLOW_PRIV \
|
||||
$KUBELET_ARGS
|
||||
Restart=on-failure
|
||||
KillMode=process
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 44e59ca86c4d5f69a6f0505bfbe7f607c8dd1193 Mon Sep 17 00:00:00 2001
|
||||
From: Ramesh Kumar Sivanandam <rameshkumar.sivanandam@windriver.com>
|
||||
Date: Fri, 7 Jul 2023 13:22:27 +0530
|
||||
Subject: [PATCH] Update kubelet.kubeconfig environment variable
|
||||
|
||||
The incorrect specification of the KUBELET_KUBECONFIG environment
|
||||
variable made it so that default parameters were not present.
|
||||
|
||||
Update the KUBELET_KUBECONFIG environment variable as
|
||||
KUBELET_KUBECONFIG="--kubeconfig=/etc/kubernetes/kubelet.kubeconfig".
|
||||
So that kubelet have the correct default parameters.
|
||||
|
||||
Signed-off-by: Ramesh Kumar Sivanandam <rameshkumar.sivanandam@windriver.com>
|
||||
---
|
||||
init/systemd/environ/kubelet | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/init/systemd/environ/kubelet b/init/systemd/environ/kubelet
|
||||
index a623673..405aabf 100644
|
||||
--- a/init/systemd/environ/kubelet
|
||||
+++ b/init/systemd/environ/kubelet
|
||||
@@ -11,7 +11,7 @@ KUBELET_ADDRESS="--address=127.0.0.1"
|
||||
KUBELET_HOSTNAME="--hostname-override=127.0.0.1"
|
||||
|
||||
# Edit the kubelet.kubeconfig to have correct cluster server address
|
||||
-KUBELET_KUBECONFIG=/etc/kubernetes/kubelet.kubeconfig
|
||||
+KUBELET_KUBECONFIG="--kubeconfig=/etc/kubernetes/kubelet.kubeconfig"
|
||||
|
||||
# Add your own!
|
||||
KUBELET_ARGS="--cgroup-driver=systemd --fail-swap-on=false"
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/init/systemd/kubelet.service b/init/systemd/kubelet.service
|
||||
index 1082bba..1fae395 100644
|
||||
--- a/init/systemd/kubelet.service
|
||||
+++ b/init/systemd/kubelet.service
|
||||
@@ -1,8 +1,8 @@
|
||||
[Unit]
|
||||
Description=Kubernetes Kubelet Server
|
||||
Documentation=https://kubernetes.io/docs/concepts/overview/components/#kubelet https://kubernetes.io/docs/reference/generated/kubelet/
|
||||
-After=docker.service
|
||||
-Requires=docker.service
|
||||
+Wants=network-online.target
|
||||
+After=network-online.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/var/lib/kubelet
|
||||
@@ -0,0 +1,3 @@
|
||||
kubelet-service-remove-docker-dependency.patch
|
||||
Remove-KUBE_ALLOW_PRIV-from-kubelet-service.patch
|
||||
Update-kubelet-kube-config-environment-variable.patch
|
||||
70
kubernetes/kubernetes-unversioned/debian/trixie/deb_folder/rules
Executable file
70
kubernetes/kubernetes-unversioned/debian/trixie/deb_folder/rules
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/make -f
|
||||
# See debhelper(7) (uncomment to enable)
|
||||
# output every command that modifies files on the build system.
|
||||
#export DH_VERBOSE = 1
|
||||
|
||||
_k8s_name := kubernetes
|
||||
_bindir := /usr/bin
|
||||
_local_sbindir := /usr/local/sbin
|
||||
_symlinkdir := /var/lib/kubernetes
|
||||
|
||||
DEBIAN_DESTDIR := $(CURDIR)/debian/tmp
|
||||
|
||||
|
||||
stage_link = ln -v -sf ${1}${2}/${3} ${DEBIAN_DESTDIR}${2}/${3}
|
||||
|
||||
%:
|
||||
dh $@ --builddirectory=contrib
|
||||
|
||||
override_dh_auto_build:
|
||||
mkdir -pv contrib
|
||||
cp -rv init contrib
|
||||
|
||||
override_dh_install:
|
||||
# location for stage1 and state2 version symlinks
|
||||
install -v -m 755 -d ${DEBIAN_DESTDIR}${_symlinkdir}
|
||||
|
||||
# Symlink targets
|
||||
install -v -m 755 -d ${DEBIAN_DESTDIR}${_bindir}
|
||||
install -v -m 755 -d ${DEBIAN_DESTDIR}/etc/systemd/system/kubelet.service.d
|
||||
install -v -m 755 -d ${DEBIAN_DESTDIR}/usr/share/bash-completion/completions
|
||||
$(call stage_link,${_symlinkdir}/stage1,${_bindir},kubeadm)
|
||||
$(call stage_link,${_symlinkdir}/stage1,/usr/share/bash-completion/completions,kubectl)
|
||||
$(call stage_link,${_symlinkdir}/stage2,${_bindir},kubelet)
|
||||
$(call stage_link,${_symlinkdir}/stage1,${_bindir},kubectl)
|
||||
|
||||
# install environment files
|
||||
install -v -d -m 0755 ${DEBIAN_DESTDIR}/etc/${_k8s_name}
|
||||
install -v -m 644 -t ${DEBIAN_DESTDIR}/etc/${_k8s_name} contrib/init/systemd/environ/config
|
||||
install -v -m 644 -t ${DEBIAN_DESTDIR}/etc/${_k8s_name} contrib/init/systemd/environ/kubelet
|
||||
install -v -m 644 -t ${DEBIAN_DESTDIR}/etc/${_k8s_name} contrib/init/systemd/environ/kubelet.kubeconfig
|
||||
install -v -m 644 -t ${DEBIAN_DESTDIR}/etc/${_k8s_name} contrib/init/systemd/environ/proxy
|
||||
|
||||
# install config files
|
||||
install -v -p -m 0644 -t ${DEBIAN_DESTDIR}/etc/systemd/system/kubelet.service.d debian/kubeadm.conf
|
||||
install -v -d -m 0755 ${DEBIAN_DESTDIR}/usr/lib/tmpfiles.d
|
||||
install -v -p -m 0644 -t ${DEBIAN_DESTDIR}/usr/lib/tmpfiles.d contrib/init/systemd/tmpfiles.d/kubernetes.conf
|
||||
mkdir -p ${DEBIAN_DESTDIR}/run
|
||||
install -v -d -m 0755 ${DEBIAN_DESTDIR}/run/${_k8s_name}/
|
||||
|
||||
# install service files
|
||||
install -v -d -m 0755 ${DEBIAN_DESTDIR}/usr/lib/systemd/system
|
||||
install -v -m 0644 -t ${DEBIAN_DESTDIR}/usr/lib/systemd/system contrib/init/systemd/kubelet.service
|
||||
|
||||
# install the place the kubelet defaults to put volumes (/var/lib/kubelet)
|
||||
install -v -d ${DEBIAN_DESTDIR}/var/lib/kubelet
|
||||
|
||||
# enable CPU and Memory accounting
|
||||
install -v -d -m 0755 ${DEBIAN_DESTDIR}/etc/systemd/system.conf.d
|
||||
install -v -p -m 0644 -t ${DEBIAN_DESTDIR}/etc/systemd/system.conf.d debian/kubernetes-accounting.conf
|
||||
|
||||
# install scripts
|
||||
install -p -m 0700 -t ${DEBIAN_DESTDIR}${_bindir} debian/kubelet-cgroup-setup.sh
|
||||
install -v -m 0700 -d ${DEBIAN_DESTDIR}${_local_sbindir}
|
||||
install -v -m 0700 -t ${DEBIAN_DESTDIR}${_local_sbindir} debian/sanitize_kubelet_reserved_cpus.sh
|
||||
|
||||
dh_install
|
||||
|
||||
override_dh_usrlocal:
|
||||
|
||||
override_dh_auto_test:
|
||||
@@ -0,0 +1,98 @@
|
||||
#! /bin/bash
|
||||
# Copyright (c) 2022 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# The script will run everytime before the kubelet service is started.
|
||||
# (Runs as a "ExecStartPre" action)
|
||||
#
|
||||
# It reads the reserved-cpus list for the kubelet from the kubelet
|
||||
# environment file and sanitizes it on the basis of online CPUs.
|
||||
#
|
||||
# If none of the reserved cpus is online, it removes the --reserved-cpus flag
|
||||
# from the environment file which allows the kubelet to choose CPUs itself
|
||||
#
|
||||
|
||||
ENVIRONMENT_FILE=$1
|
||||
|
||||
# Log info message to /var/log/daemon.log
|
||||
function LOG {
|
||||
logger -p daemon.info "$0($$): $@"
|
||||
}
|
||||
|
||||
|
||||
# Log error message to /var/log/daemon.log
|
||||
function ERROR {
|
||||
logger -s -p daemon.error "$0($$): ERROR: $@"
|
||||
}
|
||||
|
||||
function sanitize_reserved_cpus {
|
||||
kubelet_extra_args=$(cat ${ENVIRONMENT_FILE} 2>/dev/null)
|
||||
RC=$?
|
||||
if [ ${RC} != "0" ]; then
|
||||
ERROR "Error reading kubelet extra arguments. Error code: [${RC}]"
|
||||
exit ${RC}
|
||||
fi
|
||||
|
||||
# Get reserved-cpus comma-separated-values string from environment file and strip double quotes
|
||||
# format of kubelet_extra_args is:
|
||||
# "KUBELET_EXTRA_ARGS=--cni-bin-dir=/usr/libexec/cni --node-ip=abcd:204::2
|
||||
# --system-reserved=memory=9000Mi --reserved-cpus="0-29" --pod-max-pids 10000"
|
||||
if [[ ${kubelet_extra_args} =~ --reserved-cpus=\"([0-9,-]+)\" ]]; then
|
||||
reserved_cpus=${BASH_REMATCH[1]}
|
||||
else
|
||||
reserved_cpus=""
|
||||
fi
|
||||
if test -z "${reserved_cpus}"; then
|
||||
LOG "No reserved-cpu list found for kubelet. Nothing to do."
|
||||
exit 0
|
||||
fi
|
||||
LOG "Current reserved-cpus for the kubelet service: ${reserved_cpus}"
|
||||
|
||||
cpus_online=$(cat /sys/devices/system/cpu/online)
|
||||
RC=$?
|
||||
if [ ${RC} != "0" ]; then
|
||||
ERROR "Error reading online CPU list. Error code: [${RC}]"
|
||||
exit ${RC}
|
||||
fi
|
||||
LOG "Online CPUs: ${cpus_online}"
|
||||
|
||||
# Possible formats for reserved_cpus could be
|
||||
# 0,2,4,6
|
||||
# 0-23,36-45
|
||||
# 0-4,6,9,13,23-34
|
||||
expanded_reserved_cpus=$(expand_sequence ${reserved_cpus})
|
||||
reserved_cpus_array=(${expanded_reserved_cpus//,/ })
|
||||
|
||||
sanitized_reserved_cpus=""
|
||||
for element in "${reserved_cpus_array[@]}"; do
|
||||
in_list ${element} ${cpus_online}
|
||||
if [[ "$?" == "0" ]] ; then
|
||||
sanitized_reserved_cpus+=",${element}"
|
||||
fi
|
||||
done
|
||||
# Remove the extra leading ','
|
||||
sanitized_reserved_cpus=${sanitized_reserved_cpus#","}
|
||||
LOG "Sanitized reserved-cpus list for the kubelet: ${sanitized_reserved_cpus}"
|
||||
|
||||
if test -z "${sanitized_reserved_cpus}"; then
|
||||
# Strip out --reserved-cpus option if no reserved-cpus are online
|
||||
sed -i "s/ --reserved-cpus=\"${reserved_cpus}\"//g" ${ENVIRONMENT_FILE}
|
||||
else
|
||||
# Replace existing reserved-cpus with sanitized list
|
||||
sed -i "s/--reserved-cpus=\"${reserved_cpus}\"/--reserved-cpus=\"${sanitized_reserved_cpus}\"/g" ${ENVIRONMENT_FILE}
|
||||
fi
|
||||
RC="$?"
|
||||
if [ ${RC} != "0" ]; then
|
||||
ERROR "Error updating reserved-cpus list for the kubelet. Error code: [${RC}]"
|
||||
exit ${RC}
|
||||
fi
|
||||
LOG "Successfully updated reserved-cpus list for the kubelet."
|
||||
|
||||
}
|
||||
|
||||
source /etc/init.d/cpumap_functions.sh
|
||||
|
||||
sanitize_reserved_cpus
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
debname: kubernetes-unversioned
|
||||
debver: 1.0-1
|
||||
dl_path:
|
||||
name: kubernetes-contrib-v1.18.1.tar.gz
|
||||
url: https://github.com/kubernetes-retired/contrib/tarball/89f6948e24578fed2a90a87871b2263729f90ac3
|
||||
md5sum: 9aa15af65ed89a7167b9520573bbdcd7
|
||||
sha256sum: 97206b6c1ea8dc7cb6201f909c2d14fc68cf40faa4e2641cdefb8411e9403274
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
GITREVCOUNT:
|
||||
BASE_SRCREV: e73a8b35d5c8942e7b60258bf48cefc6b41121ea
|
||||
SRC_DIR: ${MY_REPO}/stx/integ/kubernetes/kubernetes-unversioned
|
||||
@@ -0,0 +1,5 @@
|
||||
isolcpus-device-plugin (1.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Daniel Safta <daniel.safta@windriver.com> Tue, 20 Oct 2021 11:44:30 -0400
|
||||
@@ -0,0 +1,15 @@
|
||||
Source: isolcpus-device-plugin
|
||||
Section: admin
|
||||
Priority: optional
|
||||
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
|
||||
Build-Depends: debhelper-compat (= 13) ,
|
||||
dh-golang ,
|
||||
golang-any
|
||||
Standards-Version: 4.4.1
|
||||
Homepage: https://www.starlingx.io
|
||||
|
||||
Package: isolcpus-device-plugin
|
||||
Architecture: any
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Expose isolated CPUs to Kubernetes cluster.
|
||||
Expose isolated CPUs to Kubernetes as devices via the device plugin API.
|
||||
@@ -0,0 +1,24 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
|
||||
Upstream-Name: deviceplugin
|
||||
Upstream-Contact: https://github.com/intel/
|
||||
Source: https://github.com/intel/intel-device-plugins-for-kubernetes
|
||||
Files: *
|
||||
Copyright: (C) 2012-2018 https://github.com/intel/intel-device-plugins-for-kubernetes
|
||||
License: Apache-2
|
||||
|
||||
License: Apache-2
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
.
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
.
|
||||
On Debian-based systems the full text of the Apache version 2.0 license
|
||||
can be found in `/usr/share/common-licenses/Apache-2.0'.
|
||||
@@ -0,0 +1 @@
|
||||
usr/local/sbin
|
||||
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Copyright (c) 2019 Wind River Systems, Inc.
|
||||
;
|
||||
; SPDX-License-Identifier: Apache-2.0
|
||||
;
|
||||
[process]
|
||||
process = isolcpu_plugin
|
||||
service = isolcpu_plugin
|
||||
pidfile = /var/run/isolcpu_plugin.pid
|
||||
style = lsb ; lsb
|
||||
severity = major ; minor, major, critical
|
||||
restarts = 3 ; restarts before error assertion
|
||||
startuptime = 5 ; seconds to wait after process start
|
||||
interval = 5 ; number of seconds to wait between restarts
|
||||
debounce = 20 ; number of seconds to wait before degrade clear
|
||||
subfunction = worker ; pmon will start monitoring once worker config is complete
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Kubernetes Isolated CPU Plugin Daemon
|
||||
Documentation=https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/
|
||||
After=kubelet.service
|
||||
Requires=kubelet.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/sbin/isolcpu_plugin
|
||||
ExecStartPost=/bin/bash -c 'echo $MAINPID > /var/run/isolcpu_plugin.pid'
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,3 @@
|
||||
isolcpu_plugin.service /lib/systemd/system/
|
||||
isolcpu_plugin /usr/local/sbin/
|
||||
isolcpu_plugin.conf /usr/share/starlingx/pmon.d/
|
||||
@@ -0,0 +1,2 @@
|
||||
file-in-usr-local
|
||||
dir-in-usr-local
|
||||
16
kubernetes/plugins/isolcpus-device-plugin/debian/trixie/deb_folder/rules
Executable file
16
kubernetes/plugins/isolcpus-device-plugin/debian/trixie/deb_folder/rules
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
go build -mod=vendor -ldflags=-linkmode=external
|
||||
|
||||
override_dh_auto_test:
|
||||
echo "do nothing"
|
||||
|
||||
override_dh_usrlocal:
|
||||
echo "do nothing"
|
||||
|
||||
override_dh_dwz:
|
||||
echo "do nothing"
|
||||
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
debname: isolcpus-device-plugin
|
||||
debver: 1.0-1
|
||||
src_path: files
|
||||
revision:
|
||||
dist: $STX_DIST
|
||||
PKG_GITREVCOUNT: true
|
||||
SRC_GITREVCOUNT:
|
||||
SRC_BASE_SRCREV: d37fe03fed76399ee07a81c52d56e89d825d66f4
|
||||
Reference in New Issue
Block a user