integ/kubernetes/kubernetes-1.24.4/debian/deb_folder/rules
Jim Gauld 6d85d048d0 Debian: Add kubernetes 1.24.4 package
This adds kubernetes 1.24.4 package for Debian, this is built
using golang-1.18.5.

The debian/rules has been updated to align more closely with Debian
Source Package: kubernetes (1.20.5+really1.20.2-1.1), the debian/* files
from this tarball: kubernetes_1.20.5+really1.20.2-1.1.debian.tar.xz .
Reference: https://packages.debian.org/source/bookworm/kubernetes

This has customizations to debian/* overrides (e.g. rules, control,
and kubernetes-x.*. This enables support of kubernetes upgrades with
multiple build versions of kubernetes, and has specific binaries/config
files isolated in stages, with -master, -misc, and -unit-test packages
built but not required in production. Each kubernetes version is built
with a corresponding golang compiler version.

The following patches were cleanly applied and included:
kubeadm-create-platform-pods-with-zero-CPU-resources.patch
Revert-use-subpath-for-coredns-only-for-default-repo.patch
kubernetes-make-isolcpus-allocation-SMT-aware.patch
kubelet-sort-isolcpus-allocation-when-SMT-enabled.patch

The following patches did not apply cleanly. These will be included
in a subsequent commit after porting them to kubernetes 1.24.4.
kubelet-cpumanager-disable-CFS-quota-throttling-for-.patch
kubelet-cpumanager-keep-normal-containers-off-reserv.patch
kubelet-cpumanager-infra-pods-use-system-reserved-CP.patch
kubelet-cpumanager-introduce-concept-of-isolated-CPU.patch
enable-support-for-kubernetes-to-ignore-isolcpus.patch

Test Plan: Debian
PASS: kubernetes-1.24.4 package builds successfully
PASS: all packages build successfully
PASS: build-iso successful with multiple kubernetes versions

Story: 2010301
Task: 46312

Depends-On: https://review.opendev.org/c/starlingx/compile/+/857971

Signed-off-by: Jim Gauld <james.gauld@windriver.com>
Change-Id: I154dcb4087631c5f0d921b008917ae5485b83b15
2022-09-26 12:56:20 -07:00

118 lines
4.8 KiB
Makefile
Executable File

#!/usr/bin/make -f
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# This debian/rules file is based on:
# https://packages.debian.org/source/bookworm/kubernetes
# http://deb.debian.org/debian/pool/main/k/kubernetes/kubernetes_1.20.5+really1.20.2-1.1.debian.tar.xz
# Customizations support kubernetes upgrades:
# - specific directory locations with kubernetes version, upgrades stage,
# and version specific golang compiler
# - build output not required on the production host is moved to
# kubernetes-misc package
kube_version := 1.24.4
kube_git_version := v${kube_version}
name := kubernetes-${kube_version}
go_version := 1.18.5
_stage1 := /usr/local/kubernetes/${kube_version}/stage1
_stage2 := /usr/local/kubernetes/${kube_version}/stage2
_bindir := /usr/bin
kube_dir := src/k8s.io/kubernetes
output_dir := ${kube_dir}/_output
output_bindir := ${output_dir}/bin
output_mandir := ${output_dir}/man
DEBIAN_DESTDIR := $(CURDIR)/debian/tmp
export DH_VERBOSE = 1
export PATH := /usr/lib/go-1.18/bin:$(PATH)
export KUBE_GIT_TREE_STATE="clean"
export KUBE_GIT_COMMIT=${kube_version}
export KUBE_GIT_VERSION=${kube_git_version}
export KUBE_EXTRA_GOPATH=$(pwd)/Godeps/_workspace
export PBR_VERSION=${kube_git_version}
bins = kube-proxy kube-apiserver kube-controller-manager kubelet kubeadm kube-scheduler kubectl
%:
dh $@ --with=bash-completion --builddirectory=src --without=build-stamp
override_dh_auto_build:
# we support multiple go compilers; indicate the version we are using
go version
which go
mkdir -pv ${kube_dir}
mv -v $$(ls | grep -v "^src$$" | grep -v "^debian$$") ${kube_dir}/.
cd ${kube_dir} && make WHAT="$(addprefix cmd/,$(bins) genman)"
# manpages
mkdir -p ${output_mandir}
echo $(bins) | xargs --max-args=1 ${output_bindir}/genman ${output_mandir}
# NOTICE files
find ${kube_dir}/vendor -name '*NOTICE*' -print0 | xargs -0 head -n1000 > ${output_dir}/NOTICE
override_dh_install:
# kube_version stage1
install -m 755 -d ${DEBIAN_DESTDIR}${_stage1}${_bindir}
install -p -m 755 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubeadm
# kube_version stage2
install -m 755 -d ${DEBIAN_DESTDIR}${_stage2}${_bindir}
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage2}/etc/systemd/system/kubelet.service.d
install -p -m 0644 -t ${DEBIAN_DESTDIR}${_stage2}/etc/systemd/system/kubelet.service.d debian/kubeadm.conf
install -p -m 0700 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} debian/kubelet-cgroup-setup.sh
install -p -m 754 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubelet
install -p -m 754 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubectl
# bash completions
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage2}/usr/share/bash-completion/completions/
${DEBIAN_DESTDIR}${_stage2}${_bindir}/kubectl completion bash > ${DEBIAN_DESTDIR}${_stage2}/usr/share/bash-completion/completions/kubectl
# remaining are not kube_version staged, i.e., kubernetes-master, kubernetes-misc
install -m 755 -d ${DEBIAN_DESTDIR}${_bindir}
install -p -m 754 -t ${DEBIAN_DESTDIR}${_bindir} ${output_bindir}/kube-apiserver
install -p -m 754 -t ${DEBIAN_DESTDIR}${_bindir} ${output_bindir}/kube-controller-manager
install -p -m 754 -t ${DEBIAN_DESTDIR}${_bindir} ${output_bindir}/kube-scheduler
install -p -m 754 -t ${DEBIAN_DESTDIR}${_bindir} ${output_bindir}/kube-proxy
# specific cluster addons for optional use
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons
# Addon: volumesnapshots
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons/volumesnapshots
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons/volumesnapshots/crd
install -m 0644 -t ${DEBIAN_DESTDIR}/etc/${name}/addons/volumesnapshots/crd ${kube_dir}/cluster/addons/volumesnapshots/crd/*
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons/volumesnapshots/volume-snapshot-controller
install -m 0644 -t ${DEBIAN_DESTDIR}/etc/${name}/addons/volumesnapshots/volume-snapshot-controller ${kube_dir}/cluster/addons/volumesnapshots/volume-snapshot-controller/*
# unit-test
# - everything from the root directory is needed
# - unit-tests needs source code
# - integration tests needs docs and other files
# - test-cmd.sh atm needs cluster, examples and other
install -d -m 0755 ${DEBIAN_DESTDIR}/var/lib/kubernetes-unit-test/
cp -a src ${DEBIAN_DESTDIR}/var/lib/kubernetes-unit-test/
# remove generated output, i.e., binaries, go cache, man pages, violations report
rm -rf ${DEBIAN_DESTDIR}/var/lib/kubernetes-unit-test/${output_dir}
dh_install
override_dh_auto_test:
${kube_dir}/hack/test-cmd.sh
${kube_dir}/hack/benchmark-go.sh
${kube_dir}/hack/test-go.sh
${kube_dir}/hack/test-integration.sh --use_go_build
override_dh_fixperms:
dh_fixperms -Xkube-apiserver -Xkubeadm -Xkubeadm.conf \
-Xkubelet-cgroup-setup.sh -Xkube-apiserver \
-Xkube-controller-manager -Xkube-scheduler \
-Xkube-proxy -Xkubelet -Xkubectl
override_dh_usrlocal: