kubernetes: uprev to 1.18.1 for stx 5.0

* uprev to 1.18.1

* inherit stx-metadata to help apply patches and
  install updated files from stx 'integ' repo.

* remove the local copy of stx files.

* fetch the updated kubernetes-contrib files from
  github tarball and remove the local copy.

* update the do_install according to updated
  spec file.

Story: 2008952
Task: 42576

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: I303e649f4a9a63ef8049ada1c8ce18fb23493d5e
This commit is contained in:
Jackie Huang 2021-06-23 14:55:10 +08:00
parent a347c0d434
commit da6f4e40c5
18 changed files with 61 additions and 368 deletions

View File

@ -1,2 +0,0 @@
This is originally copied from kubernetes-contrib-v1.16.2.tar.gz in https://github.com/kubernetes/contrib,
which is EOL now and we can't get it directly from github.

View File

@ -1,26 +0,0 @@
###
# kubernetes system config
#
# The following values are used to configure the kube-apiserver
#
# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=127.0.0.1"
# The port on the local server to listen on.
# KUBE_API_PORT="--port=8080"
# Port minions listen on
# KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379,http://127.0.0.1:4001"
# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# default admission control policies
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
# Add your own!
KUBE_API_ARGS=""

View File

@ -1,22 +0,0 @@
###
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
# kube-apiserver.service
# kube-controller-manager.service
# kube-scheduler.service
# kubelet.service
# kube-proxy.service
# logging to stderr means we get it in the systemd journal
KUBE_LOGTOSTDERR="--logtostderr=true"
# journal message level, 0 is debug
KUBE_LOG_LEVEL="--v=0"
# Should this cluster be allowed to run privileged docker containers
KUBE_ALLOW_PRIV="--allow-privileged=false"
# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://127.0.0.1:8080"

View File

@ -1,7 +0,0 @@
###
# The following values are used to configure the kubernetes controller-manager
# defaults from config and apiserver should be adequate
# Add your own!
KUBE_CONTROLLER_MANAGER_ARGS=""

View File

@ -1,17 +0,0 @@
###
# kubernetes kubelet (minion) config
# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=127.0.0.1"
# The port for the info server to serve on
# KUBELET_PORT="--port=10250"
# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=127.0.0.1"
# Edit the kubelet.kubeconfig to have correct cluster server address
KUBELET_KUBECONFIG=/etc/kubernetes/kubelet.kubeconfig
# Add your own!
KUBELET_ARGS="--cgroup-driver=systemd --fail-swap-on=false"

View File

@ -1,12 +0,0 @@
apiVersion: v1
kind: Config
clusters:
- cluster:
server: http://127.0.0.1:8080/
name: local
contexts:
- context:
cluster: local
name: local
current-context: local

View File

@ -1,7 +0,0 @@
###
# kubernetes proxy config
# default config should be adequate
# Add your own!
KUBE_PROXY_ARGS=""

View File

@ -1,7 +0,0 @@
###
# kubernetes scheduler config
# default config should be adequate
# Add your own!
KUBE_SCHEDULER_ARGS=""

View File

@ -1,27 +0,0 @@
[Unit]
Description=Kubernetes API Server
Documentation=https://kubernetes.io/docs/concepts/overview/components/#kube-apiserver https://kubernetes.io/docs/reference/generated/kube-apiserver/
After=network.target
After=etcd.service
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/apiserver
User=kube
ExecStart=/usr/bin/kube-apiserver \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_ETCD_SERVERS \
$KUBE_API_ADDRESS \
$KUBE_API_PORT \
$KUBELET_PORT \
$KUBE_ALLOW_PRIV \
$KUBE_SERVICE_ADDRESSES \
$KUBE_ADMISSION_CONTROL \
$KUBE_API_ARGS
Restart=on-failure
Type=notify
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

View File

@ -1,18 +0,0 @@
[Unit]
Description=Kubernetes Controller Manager
Documentation=https://kubernetes.io/docs/concepts/overview/components/#kube-controller-manager https://kubernetes.io/docs/reference/generated/kube-controller-manager/
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/controller-manager
User=kube
ExecStart=/usr/bin/kube-controller-manager \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_MASTER \
$KUBE_CONTROLLER_MANAGER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

View File

@ -1,18 +0,0 @@
[Unit]
Description=Kubernetes Kube-Proxy Server
Documentation=https://kubernetes.io/docs/concepts/overview/components/#kube-proxy https://kubernetes.io/docs/reference/generated/kube-proxy/
After=network.target
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/proxy
ExecStart=/usr/bin/kube-proxy \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_MASTER \
$KUBE_PROXY_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

View File

@ -1,18 +0,0 @@
[Unit]
Description=Kubernetes Scheduler Plugin
Documentation=https://kubernetes.io/docs/concepts/overview/components/#kube-scheduler https://kubernetes.io/docs/reference/generated/kube-scheduler/
[Service]
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/scheduler
User=kube
ExecStart=/usr/bin/kube-scheduler \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBE_MASTER \
$KUBE_SCHEDULER_ARGS
Restart=on-failure
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target

View File

@ -1,24 +0,0 @@
[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
[Service]
WorkingDirectory=/var/lib/kubelet
EnvironmentFile=-/etc/kubernetes/config
EnvironmentFile=-/etc/kubernetes/kubelet
ExecStart=/usr/bin/kubelet \
$KUBE_LOGTOSTDERR \
$KUBE_LOG_LEVEL \
$KUBELET_KUBECONFIG \
$KUBELET_ADDRESS \
$KUBELET_PORT \
$KUBELET_HOSTNAME \
$KUBE_ALLOW_PRIV \
$KUBELET_ARGS
Restart=on-failure
KillMode=process
[Install]
WantedBy=multi-user.target

View File

@ -1,2 +0,0 @@
d /var/run/kubernetes 0755 kube kube -

View File

@ -1,18 +0,0 @@
# Note: This dropin only works with kubeadm and kubelet v1.11+
[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/sysconfig/kubelet
ExecStart=
ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS
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
Restart=always
StartLimitInterval=0
RestartSec=10

View File

@ -1,115 +0,0 @@
#!/bin/bash
#
# Copyright (c) 2019 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
# pids should be first in the list, since it appears to get auto deleted
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 cnt=''
local CGDIR=''
local RC=0
# Create the cgroup for required controllers
for cnt in ${CONTROLLERS[@]}; do
CGDIR=${CGROUP}/${cnt}/${cg_name}
if [ -d ${CGDIR} ]; then
LOG "Nothing to do, already configured: ${CGDIR}."
exit ${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}"
/bin/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}"
/bin/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}
exit $?

View File

@ -1,5 +0,0 @@
[Manager]
DefaultCPUAccounting=yes
DefaultMemoryAccounting=yes

View File

@ -1,46 +1,71 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
PV = "1.16.2+git${SRCREV_kubernetes}"
SRCREV_kubernetes = "c97fe5036ef3df2967d086711e6c0c405941e14b"
K8S_BASE_VER = "1.18"
K8S_VER = "${K8S_BASE_VER}.1"
PV = "${K8S_VER}+git${SRCREV_kubernetes}"
SRCREV_kubernetes = "7879fc12a63337efff607952a323df90cdc7a335"
SRC_SUBDIR = "src/${GO_IMPORT}"
LICENSE += "(Apache-2.0&MIT)&(Apache-2.0|CC-BY-4.0)"
LIC_FILES_CHKSUM_append = " \
file://src/import/logo/LICENSE;md5=b431638b9986506145774a9da0d0ad85 \
file://src/import/vendor/github.com/morikuni/aec/LICENSE;md5=86852eb2df591157c788f3ba889c8aec \
file://src/import/staging/src/k8s.io/sample-controller/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
file://src/import/test/images/kitten/Dockerfile;beginline=1;endline=13;md5=78cb21f802c15df77b75bd56f9417ccf \
file://src/import/test/images/nautilus/Dockerfile;beginline=1;endline=13;md5=78cb21f802c15df77b75bd56f9417ccf \
file://src/import/staging/src/k8s.io/kubectl/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e \
file://src/import/vendor/github.com/grpc-ecosystem/go-grpc-middleware/LICENSE;md5=7ab5c73bb7e4679b16dd7c11b3559acf \
file://${SRC_SUBDIR}/logo/LICENSE;md5=b431638b9986506145774a9da0d0ad85 \
file://${SRC_SUBDIR}/vendor/github.com/morikuni/aec/LICENSE;md5=86852eb2df591157c788f3ba889c8aec \
file://${SRC_SUBDIR}/staging/src/k8s.io/sample-controller/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57 \
file://${SRC_SUBDIR}/test/images/kitten/Dockerfile;beginline=1;endline=13;md5=78cb21f802c15df77b75bd56f9417ccf \
file://${SRC_SUBDIR}/test/images/nautilus/Dockerfile;beginline=1;endline=13;md5=78cb21f802c15df77b75bd56f9417ccf \
file://${SRC_SUBDIR}/staging/src/k8s.io/kubectl/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e \
file://${SRC_SUBDIR}/vendor/github.com/grpc-ecosystem/go-grpc-middleware/LICENSE;md5=7ab5c73bb7e4679b16dd7c11b3559acf \
"
inherit stx-metadata
STX_REPO = "integ"
STX_SUBPATH = "kubernetes/kubernetes/centos/files"
SRC_URI_STX = "\
file://0001-Fix-pagesize-check-to-allow-for-options-already-endi.patch;patchdir=${SRC_SUBDIR} \
file://fix_http2_erringroundtripper_handling.patch;patchdir=${SRC_SUBDIR} \
file://kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch;patchdir=${SRC_SUBDIR} \
file://kubelet-cpumanager-keep-normal-containers-off-reserv.patch;patchdir=${SRC_SUBDIR} \
file://kubelet-cpumanager-infrastructure-pods-use-system-re.patch;patchdir=${SRC_SUBDIR} \
file://kubelet-cpumanager-introduce-concept-of-isolated-CPU.patch;patchdir=${SRC_SUBDIR} \
file://Fix-exclusive-CPU-allocations-being-deleted-at-conta.patch;patchdir=${SRC_SUBDIR} \
file://kubeadm-create-platform-pods-with-zero-CPU-resources.patch;patchdir=${SRC_SUBDIR} \
file://add-option-to-disable-isolcpu-awareness.patch;patchdir=${SRC_SUBDIR} \
\
file://kubelet-service-remove-docker-dependency.patch;patchdir=${CONTRIB_DIR};striplevel=2 \
"
SRC_URI = "git://github.com/kubernetes/kubernetes.git;branch=release-1.16;name=kubernetes \
CONTRIB_URI = "https://github.com/kubernetes-retired/contrib/tarball/89f6948e24578fed2a90a87871b2263729f90ac3"
CONTRIB_DIR = "${WORKDIR}/kubernetes-retired-contrib-89f6948"
SRC_URI = "\
git://github.com/kubernetes/kubernetes.git;branch=release-${K8S_BASE_VER};name=kubernetes \
${CONTRIB_URI};downloadfilename=kubernetes-contrib-v${K8S_VER}.tar.gz;name=contrib \
file://0001-hack-lib-golang.sh-use-CC-from-environment.patch \
file://0001-cross-don-t-build-tests-by-default.patch \
file://kubernetes-accounting.conf \
file://kubeadm.conf \
file://kubelet-cgroup-setup.sh \
file://contrib/* \
"
SRC_URI[contrib.md5sum] = "fc05d9dc693dd71e3afb98fa51419879"
SRC_URI[contrib.sha256sum] = "0e1c6f70fc167d4ff1f268bbb72a8a91fab9bdeb17cec95bd3bb7fe4f56ebdcb"
INSANE_SKIP_${PN} += "textrel"
INSANE_SKIP_${PN}-misc += "textrel"
INSANE_SKIP_kubelet += "textrel"
do_install () {
install -d ${D}${bindir}
install -d ${D}${systemd_system_unitdir}/
# Install binaries
install -m 755 -D ${S}/src/import/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir}
install -m 754 -D ${S}/${SRC_SUBDIR}/_output/local/bin/${TARGET_GOOS}/${TARGET_GOARCH}/* ${D}/${bindir}
# kubeadm:
install -d -m 0755 ${D}/${sysconfdir}/systemd/system/kubelet.service.d
install -m 0644 ${WORKDIR}/kubeadm.conf ${D}/${sysconfdir}/systemd/system/kubelet.service.d
install -m 0644 ${STX_METADATA_PATH}/kubeadm.conf ${D}/${sysconfdir}/systemd/system/kubelet.service.d
# kubelete-cgroup-setup.sh
install -m 0700 ${WORKDIR}/kubelet-cgroup-setup.sh ${D}/${bindir}
install -m 0700 ${STX_METADATA_PATH}/kubelet-cgroup-setup.sh ${D}/${bindir}
# install the bash completion
install -d -m 0755 ${D}${datadir}/bash-completion/completions/
@ -48,22 +73,34 @@ do_install () {
# install config files
install -d -m 0755 ${D}${sysconfdir}/${BPN}
install -m 644 -t ${D}${sysconfdir}/${BPN} ${WORKDIR}/contrib/init/systemd/environ/*
install -m 644 -t ${D}${sysconfdir}/${BPN} ${CONTRIB_DIR}/init/systemd/environ/*
# install service files
install -d -m 0755 ${D}${systemd_system_unitdir}
install -m 0644 -t ${D}${systemd_system_unitdir} ${WORKDIR}/contrib/init/systemd/*.service
install -m 0644 -t ${D}${systemd_system_unitdir} ${CONTRIB_DIR}/init/systemd/*.service
# install the place the kubelet defaults to put volumes
install -d ${D}${localstatedir}/lib/kubelet
# install systemd tmpfiles
install -d -m 0755 ${D}${sysconfdir}/tmpfiles.d
install -p -m 0644 -t ${D}${sysconfdir}/tmpfiles.d ${WORKDIR}/contrib/init/systemd/tmpfiles.d/kubernetes.conf
install -p -m 0644 -t ${D}${sysconfdir}/tmpfiles.d ${CONTRIB_DIR}/init/systemd/tmpfiles.d/kubernetes.conf
# enable CPU and Memory accounting
install -d -m 0755 ${D}/${sysconfdir}/systemd/system.conf.d
install -m 0644 ${WORKDIR}/kubernetes-accounting.conf ${D}/${sysconfdir}//systemd/system.conf.d/
install -m 0644 ${STX_METADATA_PATH}/kubernetes-accounting.conf ${D}/${sysconfdir}//systemd/system.conf.d/
# install specific cluster addons for optional use
install -d -m 0755 ${D}${sysconfdir}/${BPN}/addons
# Addon: volumesnapshots
install -d -m 0755 ${D}${sysconfdir}/${BPN}/addons/volumesnapshots
install -d -m 0755 ${D}${sysconfdir}/${BPN}/addons/volumesnapshots/crd
install -m 0644 -t ${D}${sysconfdir}/${BPN}/addons/volumesnapshots/crd \
${S}/${SRC_SUBDIR}/cluster/addons/volumesnapshots/crd/*
install -d -m 0755 ${D}${sysconfdir}/${BPN}/addons/volumesnapshots/volume-snapshot-controller
install -m 0644 -t ${D}${sysconfdir}/${BPN}/addons/volumesnapshots/volume-snapshot-controller \
${S}/${SRC_SUBDIR}/cluster/addons/volumesnapshots/volume-snapshot-controller/*
}
SYSTEMD_PACKAGES += "${PN} kube-proxy"
@ -102,5 +139,6 @@ FILES_${PN}-misc = "\
RDEPENDS_${PN} += "\
bash \
conntrack-tools \
kube-proxy \
"