Upversion kubernetes to v1.18.1

Upgrade to kubernetes v1.18.1 and include a temporary patch for the
current StarlngX behavior related to hugepages.

Based on the current StarlingX configuration, container hugepages are
mounted with the following option that already contains an 'i' as a
suffix: pagesize=1Gi.

This temporary patch updates the logic associated with
https://github.com/kubernetes/kubernetes/commit/03ecc20 to avoid
appending an additional 'i' at the end of the size string. This extra
'i' is not handled by ParseQuantity() and results is a pod stuck
Terminating as the mount is not removed from the container.

The new multiple hugepage feature will be enabled an evaluated with the
intent of upstreaming this (or a comparable fix) OR adjusting StarlingX
hugepage behavior to align with the expected upstream behavior and
dropping this patch.

In addition:
- Update kubelet-cgroup-setup.sh, as now pids and hugetlb both appear to
  get auto-deleted on reboot so make sure these are recreated.
- Update spec to remove hyperkube dependencies as each component is now
  built independently and needs to be install individually.

Change-Id: I34263fa33c61c7a5bce1002a4f5edf5b850aa189
Story: 2006999
Task: 37770
Depends-On: https://review.opendev.org/#/c/718370/
Depends-On: https://review.opendev.org/#/c/718566/
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2020-03-23 20:56:32 -04:00
parent 5ac3a294a1
commit 23a2ba0cb6
5 changed files with 95 additions and 24 deletions

View File

@ -34,8 +34,8 @@ ixgbe-5.5.5.tar.gz#ixgbe-5.5.5#https://sourceforge.net/projects/e1000/files/ixgb
ixgbevf-4.5.3.tar.gz#ixgbevf-4.5.3#https://sourceforge.net/projects/e1000/files/ixgbevf%20stable/4.5.3/ixgbevf-4.5.3.tar.gz/download#http##
jerasure-96c76b89d661c163f65a014b8042c9354ccf7f31.tar.gz#jerasure#https://api.github.com/repos/ceph/jerasure/tarball/96c76b89d661c163f65a014b8042c9354ccf7f31#https##
keycodemapdb-16e5b07.tar.gz#keycodemapdb#https://github.com/CendioOssman/keycodemapdb/tarball/16e5b0787687d8904dad2c026107409eb9bfcb95#http##
kubernetes-contrib-v1.16.2.tar.gz#kubernetes-contrib-1.16.2#https://github.com/kubernetes-retired/contrib/tarball/89f6948e24578fed2a90a87871b2263729f90ac3#http##
kubernetes-v1.16.2.tar.gz#kubernetes-1.16.2#https://github.com/kubernetes/kubernetes/archive/v1.16.2.tar.gz#http##
kubernetes-contrib-v1.18.1.tar.gz#kubernetes-contrib-1.18.1#https://github.com/kubernetes-retired/contrib/tarball/89f6948e24578fed2a90a87871b2263729f90ac3#http##
kubernetes-v1.18.1.tar.gz#kubernetes-1.18.1#https://github.com/kubernetes/kubernetes/archive/7879fc12a63337efff607952a323df90cdc7a335.tar.gz#http##
kvm-unit-tests.git-4ea7633.tar.bz2#kvm-unit-tests#https://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git/snapshot/kvm-unit-tests-20171020.tar.gz#http##
ldapscripts-2.0.8.tgz#ldapscripts-2.0.8#https://sourceforge.net/projects/ldapscripts/files/ldapscripts/ldapscripts-2.0.8/ldapscripts-2.0.8.tgz/download#http##
libtpms-0.6.0-4f0d59d.tar.gz#libtpms-0.6.0#https://github.com/stefanberger/libtpms/tarball/c421ca0f4d00c0caceeda8d62c1efb2b7e47db04#http##

View File

@ -1,9 +1,9 @@
VERSION=1.16.2
CON_VERSION=1.16.2
VERSION=1.18.1
CON_VERSION=1.18.1
TAR_NAME=kubernetes
TAR="$TAR_NAME-v$VERSION.tar.gz"
CONTRIB="$TAR_NAME-contrib-v$CON_VERSION.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR ${CGCS_BASE}/downloads/$CONTRIB $FILES_BASE/*"
TIS_PATCH_VER=1
TIS_PATCH_VER=2

View File

@ -0,0 +1,44 @@
From ee648637dde0394a9e487a47a2c6f33f2e238046 Mon Sep 17 00:00:00 2001
From: Robert Church <robert.church@windriver.com>
Date: Mon, 6 Apr 2020 20:59:53 -0400
Subject: [PATCH] Fix pagesize check to allow for options already ending in 'i'
Commit https://github.com/kubernetes/kubernetes/commit/03ecc20 adds a
pagesize mount option quantity check that appends an 'i' to the pagesize
value.
Based on the current StarlingX configuration the hugepages are mounted
with the following option that already contains an 'i' as a suffix:
pagesize=1Gi.
This temporary patch updates the logic to avoid appending an additional
'i' at the end of the size string. This extra 'i' is not handled by
ParseQuantity() and results is a pod stuck Terminating as the mount
is not removed from the container.
Signed-off-by: Robert Church <robert.church@windriver.com>
---
pkg/volume/emptydir/empty_dir_linux.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/pkg/volume/emptydir/empty_dir_linux.go b/pkg/volume/emptydir/empty_dir_linux.go
index 63a25dc4ed0..7343c5e510a 100644
--- a/pkg/volume/emptydir/empty_dir_linux.go
+++ b/pkg/volume/emptydir/empty_dir_linux.go
@@ -69,7 +69,12 @@ func getPageSize(path string, mounter mount.Interface) (*resource.Quantity, erro
// NOTE: Adding suffix 'i' as result should be comparable with a medium size.
// pagesize mount option is specified without a suffix,
// e.g. pagesize=2M or pagesize=1024M for x86 CPUs
- pageSize, err := resource.ParseQuantity(strings.TrimPrefix(opt, prefix) + "i")
+ opt_val := strings.TrimPrefix(opt, prefix)
+ val := opt_val
+ if !strings.HasSuffix(opt_val, "i") {
+ val = opt_val + "i"
+ }
+ pageSize, err := resource.ParseQuantity(val)
if err != nil {
return nil, fmt.Errorf("error getting page size from '%s' mount option: %v", opt, err)
}
--
2.16.6

View File

@ -26,21 +26,38 @@ function ERROR {
logger -s -p daemon.error "$0($$): ERROR: $@"
}
# Create minimal cgroup directories and configure cpuset attributes
# pids should be first in the list, since it appears to get auto deleted
# 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=("pids" "cpuset" "memory" "cpu,cpuacct" "systemd")
local CONTROLLERS_AUTO_DELETED=("pids" "hugetlb")
local CONTROLLERS_PRESERVED=("cpuset" "memory" "cpu,cpuacct" "systemd")
local cnt=''
local CGDIR=''
local RC=0
# Create the cgroup for required controllers
for cnt in ${CONTROLLERS[@]}; do
# 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}."

View File

@ -23,16 +23,16 @@
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path k8s.io/kubernetes
%global commit 1.16.2
%global commit 1.18.1
%global con_provider github
%global con_provider_tld com
%global con_project kubernetes
%global con_repo kubernetes-contrib
# https://github.com/kubernetes/contrib
%global con_commit 1.16.2
%global con_commit 1.18.1
%global kube_version 1.16.2
%global kube_version 1.18.1
%global kube_git_version v%{kube_version}
# Needed otherwise "version_ldflags=$(kube::version_ldflags)" doesn't work
@ -55,6 +55,8 @@ Source5: kubelet-cgroup-setup.sh
Source33: genmanpages.sh
Patch1: 0001-Fix-pagesize-check-to-allow-for-options-already-endi.patch
# It obsoletes cadvisor but needs its source code (literally integrated)
Obsoletes: cadvisor
@ -350,7 +352,6 @@ Provides: golang(%{import_path}/pkg/genericapiserver/options) = %{version}-%{rel
Provides: golang(%{import_path}/pkg/genericapiserver/validation) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/healthz) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/httplog) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/hyperkube) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/kubectl) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/kubectl/cmd) = %{version}-%{release}
Provides: golang(%{import_path}/pkg/kubectl/cmd/config) = %{version}-%{release}
@ -835,6 +836,7 @@ Kubernetes client tools like kubectl
%prep
%setup -q -n %{con_repo}-%{con_commit} -T -b 1
%setup -q -n %{repo}-%{commit}
%patch1 -p1
# copy contrib folder
mkdir contrib
@ -869,7 +871,7 @@ export KUBE_EXTRA_GOPATH=$(pwd)/Godeps/_workspace
%ifarch ppc64le
export GOLDFLAGS='-linkmode=external'
%endif
make WHAT="cmd/hyperkube cmd/kube-apiserver cmd/kubeadm"
make WHAT="cmd/kube-proxy cmd/kube-apiserver cmd/kube-controller-manager cmd/kubelet cmd/kubeadm cmd/kube-scheduler cmd/kubectl"
# convert md to man
./hack/generate-docs.sh || true
@ -896,9 +898,6 @@ output_path="${KUBE_OUTPUT_BINPATH}/$(kube::golang::host_platform)"
install -m 755 -d %{buildroot}%{_bindir}
echo "+++ INSTALLING hyperkube"
install -p -m 755 -t %{buildroot}%{_bindir} ${output_path}/hyperkube
echo "+++ INSTALLING kube-apiserver"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver
@ -910,11 +909,23 @@ install -p -m 0644 -t %{buildroot}/%{_sysconfdir}/systemd/system/kubelet.service
echo "+++ INSTALLING kubelet-cgroup-setup.sh"
install -p -m 0700 -t %{buildroot}/%{_bindir} %{SOURCE5}
binaries=(kube-controller-manager kube-scheduler kube-proxy kubelet kubectl)
for bin in "${binaries[@]}"; do
echo "+++ HARDLINKING ${bin} to hyperkube"
ln %{buildroot}%{_bindir}/hyperkube %{buildroot}%{_bindir}/${bin}
done
echo "+++ INSTALLING kube-apiserver"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-apiserver
echo "+++ INSTALLING kube-controller-manager"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-controller-manager
echo "+++ INSTALLING kube-scheduler"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-scheduler
echo "+++ INSTALLING kube-proxy"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kube-proxy
echo "+++ INSTALLING kubelet"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kubelet
echo "+++ INSTALLING kubectl"
install -p -m 754 -t %{buildroot}%{_bindir} ${output_path}/kubectl
# install the bash completion
install -d -m 0755 %{buildroot}%{_datadir}/bash-completion/completions/
@ -1064,7 +1075,6 @@ fi
%{_mandir}/man1/kubectl.1*
%{_mandir}/man1/kubectl-*
%{_bindir}/kubectl
%{_bindir}/hyperkube
%{_datadir}/bash-completion/completions/kubectl
##############################################