integ/kubernetes/kubernetes-unversioned/debian/deb_folder/rules
Jim Gauld 188a92fe0e Debian: Add kubernetes 1.23.1 upgrade script to kubernetes-unversioned
Add two files to Debian package kubernetes-unversioned to support
kubernetes upgrades.  We need to remove undesired feature gates from the
kubeadm configmap before the upgrade to 1.24.

The following two files are both required by puppet class:
platform::kubernetes::upgrade_first_control_plane,
* upgrade_k8s_config.sh - upgrade script to update apiserver/kubelet
  configmap
* kubelet_override.yaml - empty / non-customized override file. This
  file is being referenced, we keep override functionality even though
  we do not currently require kubelet overrides.

Test Plan:
TODO: Kubernetes upgrade from k8s 1.23 to 1.24
TODO: Platform upgrade from k8s 1.23, followed by kubernetes upgrade
      from k8s 1.23 to 1.24

Story: 2010301
Task: 46692

Signed-off-by: Jim Gauld <james.gauld@windriver.com>
Change-Id: Ibb2438c79b2983d2bc6beeaec287795f3c6c124f
2022-10-31 12:25:42 -04:00

75 lines
3.0 KiB
Makefile
Executable File

#!/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
_curr_stage1 := /usr/local/kubernetes/current/stage1
_curr_stage2 := /usr/local/kubernetes/current/stage2
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:
# Current staged directories
install -v -m 755 -d ${DEBIAN_DESTDIR}${_curr_stage1}
install -v -m 755 -d ${DEBIAN_DESTDIR}${_curr_stage2}
# 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,${_curr_stage1},${_bindir},kubeadm)
$(call stage_link,${_curr_stage2},/etc/systemd/system/kubelet.service.d,kubeadm.conf)
$(call stage_link,${_curr_stage2},/usr/share/bash-completion/completions,kubectl)
$(call stage_link,${_curr_stage2},${_bindir},kubelet-cgroup-setup.sh)
$(call stage_link,${_curr_stage2},${_bindir},kubelet)
$(call stage_link,${_curr_stage2},${_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 -v -m 644 -t ${DEBIAN_DESTDIR}/etc/${_k8s_name} debian/kubelet_override.yaml
# install config files
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 -v -m 0700 -d ${DEBIAN_DESTDIR}${_local_sbindir}
install -v -m 0700 -t ${DEBIAN_DESTDIR}${_local_sbindir} debian/sanitize_kubelet_reserved_cpus.sh
install -v -m 0700 -t ${DEBIAN_DESTDIR}${_local_sbindir} debian/upgrade_k8s_config.sh
dh_install
override_dh_usrlocal:
override_dh_auto_test: