Update K8S packaging move kubectl to stage1 symlink

This updates kubernetes packaging to move the kubectl
binary and associated bash-completions to stage1 symlink.

This change supports Kubernetes version skew policy
upgrade optimizations. This ensures that the kubectl binary
remains compatible with the control-plane version.

Test Plan:
PASS: build-pkgs, build-image

PASS: Install ISO on AIO-SX for each K8S version
      (i.e., 1.29.2, 1.30.6, 1.31.5, 1.32.2):
      - Verify kubectl commands work, including bash-completion.
      - Verify binaries located under stage1 directory, e.g.,
        find /usr/local/kubernetes -name kubectl
        /usr/local/kubernetes/1.29.2/stage1/usr/share/bash-completion/completions/kubectl
        /usr/local/kubernetes/1.29.2/stage1/usr/bin/kubectl
        ..
      - Verify the binary is symlinked to stage1, e.g.,
        ls -l /usr/bin/kubectl
        /usr/bin/kubectl -> /var/lib/kubernetes/stage1/usr/bin/kubectl

Story:2011415
Task: 51998

Depends-On: https://review.opendev.org/c/starlingx/integ/+/947756

Change-Id: Ifc68cdbd0163e52027e2c9f51de4860c9b797be9
Signed-off-by: Jim Gauld <James.Gauld@windriver.com>
This commit is contained in:
Jim Gauld 2025-04-22 14:48:24 -04:00
parent 3a0d58472f
commit 4e57f638bd
10 changed files with 28 additions and 28 deletions

View File

@ -1,2 +1,2 @@
usr/local/kubernetes/1.29.2/stage2/usr/bin/kubectl
usr/local/kubernetes/1.29.2/stage2/usr/share/bash-completion/completions/kubectl
usr/local/kubernetes/1.29.2/stage1/usr/bin/kubectl
usr/local/kubernetes/1.29.2/stage1/usr/share/bash-completion/completions/kubectl

View File

@ -62,16 +62,16 @@ 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
install -p -m 755 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubectl
# bash completions
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/
${DEBIAN_DESTDIR}${_stage1}${_bindir}/kubectl completion bash > ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/kubectl
# 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 750 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubelet
install -p -m 755 -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}

View File

@ -1,2 +1,2 @@
usr/local/kubernetes/1.30.6/stage2/usr/bin/kubectl
usr/local/kubernetes/1.30.6/stage2/usr/share/bash-completion/completions/kubectl
usr/local/kubernetes/1.30.6/stage1/usr/bin/kubectl
usr/local/kubernetes/1.30.6/stage1/usr/share/bash-completion/completions/kubectl

View File

@ -62,16 +62,16 @@ override_dh_install:
# kube_version stage1
install -m 755 -d ${DEBIAN_DESTDIR}${_stage1}${_bindir}
install -p -m 750 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubeadm
install -p -m 755 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubectl
# bash completions
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/
${DEBIAN_DESTDIR}${_stage1}${_bindir}/kubectl completion bash > ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/kubectl
# 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 750 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubelet
install -p -m 755 -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
# specific cluster addons for optional use
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons

View File

@ -1,2 +1,2 @@
usr/local/kubernetes/1.31.5/stage2/usr/bin/kubectl
usr/local/kubernetes/1.31.5/stage2/usr/share/bash-completion/completions/kubectl
usr/local/kubernetes/1.31.5/stage1/usr/bin/kubectl
usr/local/kubernetes/1.31.5/stage1/usr/share/bash-completion/completions/kubectl

View File

@ -62,16 +62,16 @@ override_dh_install:
# kube_version stage1
install -m 755 -d ${DEBIAN_DESTDIR}${_stage1}${_bindir}
install -p -m 750 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubeadm
install -p -m 755 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubectl
# bash completions
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/
${DEBIAN_DESTDIR}${_stage1}${_bindir}/kubectl completion bash > ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/kubectl
# 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 750 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubelet
install -p -m 755 -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
# specific cluster addons for optional use
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons

View File

@ -1,2 +1,2 @@
usr/local/kubernetes/1.32.2/stage2/usr/bin/kubectl
usr/local/kubernetes/1.32.2/stage2/usr/share/bash-completion/completions/kubectl
usr/local/kubernetes/1.32.2/stage1/usr/bin/kubectl
usr/local/kubernetes/1.32.2/stage1/usr/share/bash-completion/completions/kubectl

View File

@ -62,16 +62,16 @@ override_dh_install:
# kube_version stage1
install -m 755 -d ${DEBIAN_DESTDIR}${_stage1}${_bindir}
install -p -m 750 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubeadm
install -p -m 755 -t ${DEBIAN_DESTDIR}${_stage1}${_bindir} ${output_bindir}/kubectl
# bash completions
install -d -m 0755 ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/
${DEBIAN_DESTDIR}${_stage1}${_bindir}/kubectl completion bash > ${DEBIAN_DESTDIR}${_stage1}/usr/share/bash-completion/completions/kubectl
# 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 750 -t ${DEBIAN_DESTDIR}${_stage2}${_bindir} ${output_bindir}/kubelet
install -p -m 755 -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
# specific cluster addons for optional use
install -d -m 0755 ${DEBIAN_DESTDIR}/etc/${name}/addons

View File

@ -1,5 +1,5 @@
/var/lib/kubernetes/stage1/usr/bin/kubeadm /usr/bin/kubeadm
/var/lib/kubernetes/stage2/usr/bin/kubelet /usr/bin/kubelet
/var/lib/kubernetes/stage2/usr/bin/kubectl /usr/bin/kubectl
/var/lib/kubernetes/stage1/usr/bin/kubectl /usr/bin/kubectl
/var/lib/kubernetes/stage2/etc/systemd/system/kubelet.service.d/kubeadm.conf /etc/systemd/system/kubelet.service.d/kubeadm.conf
/var/lib/kubernetes/stage2/usr/share/bash-completion/completions/kubectl /usr/share/bash-completion/completions/kubectl
/var/lib/kubernetes/stage1/usr/share/bash-completion/completions/kubectl /usr/share/bash-completion/completions/kubectl

View File

@ -30,9 +30,9 @@ override_dh_install:
install -v -m 755 -d ${DEBIAN_DESTDIR}/usr/share/bash-completion/completions
$(call stage_link,${_symlinkdir}/stage1,${_bindir},kubeadm)
$(call stage_link,${_symlinkdir}/stage2,/etc/systemd/system/kubelet.service.d,kubeadm.conf)
$(call stage_link,${_symlinkdir}/stage2,/usr/share/bash-completion/completions,kubectl)
$(call stage_link,${_symlinkdir}/stage1,/usr/share/bash-completion/completions,kubectl)
$(call stage_link,${_symlinkdir}/stage2,${_bindir},kubelet)
$(call stage_link,${_symlinkdir}/stage2,${_bindir},kubectl)
$(call stage_link,${_symlinkdir}/stage1,${_bindir},kubectl)
# install environment files
install -v -d -m 0755 ${DEBIAN_DESTDIR}/etc/${_k8s_name}