Tae Park 4f504c064c Fix KUBE_LATEST_VERSION to installed version
After updating the kubectl versions, we noticed that there is a mismatch
between version in the KUBE_LATEST_VERSION variable, and the actual
installed version. This change fixes the mismatch, and makes
KUBE_LATEST_VERSION point to the correct version.

Test Plan:
PASS Manual build of the image
PASS verify in docker history for correct version

Story: 2010930
Task: 49526

Change-Id: I5055fd204527c49cc47478d62d01e1afa18d3556
Signed-off-by: Tae Park <tae.park@windriver.com>
2024-02-07 15:13:29 -05:00

35 lines
1.3 KiB
Docker

from debian:stable-slim
# Support versions of kubernetes back two releases of starlingx
# Versions older than 1.26 can be listed from:
# https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.22.md
# Otherwise the latest minor releases are listed here:
# https://kubernetes.io/releases/
ENV KUBE_LATEST_VERSION="v1.28.6"
ENV KUBE_VERSIONS="v1.28.6 v1.27.10 v1.26.13 v1.25.16 v1.24.17"
ENV KUBECTL_DL_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_LATEST_VERSION}/bin/linux/amd64/kubectl"
ENV KUBECTL_INSTALL_PATH="/usr/local/bin"
RUN set -ex; \
PKG_LIST="mawk bash coreutils curl grep sed jq uuid-runtime"; \
apt-get update && apt-get install -y $PKG_LIST \
&& apt-get clean && rm -r /var/lib/apt/lists/*
# install all of the versions of kubectl
RUN set -ex; \
mkdir -p $KUBECTL_INSTALL_PATH; \
for ver in $KUBE_VERSIONS; do \
fpath=${KUBECTL_INSTALL_PATH}/kubectl.${ver%.*}; \
url="https://storage.googleapis.com/kubernetes-release/release/${ver}/bin/linux/amd64/kubectl"; \
curl -L "$url" -o ${fpath} \
&& chmod +x ${fpath}; \
done
# link the latest version as default
RUN set -ex; \
ln -s ${KUBECTL_INSTALL_PATH}/kubectl.${KUBE_LATEST_VERSION%.*} \
${KUBECTL_INSTALL_PATH}/kubectl
CMD ["bash"]