From cb2e37a8d11c7a987090b97853e34c52973104d4 Mon Sep 17 00:00:00 2001 From: Nianyu Shen Date: Mon, 2 Sep 2024 22:31:41 -0700 Subject: [PATCH] define k8s version json Signed-off-by: Nianyu Shen --- Earthfile | 166 ++++++++--------------------------------------- k8s_version.json | 94 +++++++++++++++++++++++++++ 2 files changed, 121 insertions(+), 139 deletions(-) create mode 100644 k8s_version.json diff --git a/Earthfile b/Earthfile index 131381d..0f181bc 100644 --- a/Earthfile +++ b/Earthfile @@ -4,12 +4,13 @@ ARG TARGETARCH # Default image repositories used in the builds. ARG SPECTRO_PUB_REPO=gcr.io/spectro-images-public -ARG ALPINE_IMG=$SPECTRO_PUB_REPO/alpine:3.20.2 ARG SPECTRO_LUET_REPO=gcr.io/spectro-dev-public ARG KAIROS_BASE_IMAGE_URL=gcr.io/spectro-images-public ARG ETCD_REPO=https://github.com/etcd-io ARG LUET_PROJECT=luet-repo -FROM $SPECTRO_PUB_REPO/canvos/alpine-cert:v1.0.0 +ARG ALPINE_TAG=3.20 +ARG ALPINE_IMG=$SPECTRO_PUB_REPO/canvos/alpine:$ALPINE_TAG +FROM $ALPINE_IMG # Spectro Cloud and Kairos tags. ARG PE_VERSION=v4.4.8 @@ -118,6 +119,16 @@ END ARG IMAGE_PATH=$IMAGE_REGISTRY/$IMAGE_REPO:$K8S_DISTRIBUTION-$K8S_VERSION-$IMAGE_TAG ARG CMDLINE="stylus.registration" +alpine-all: + BUILD --platform=linux/amd64 --platform=linux/arm64 +alpine + +alpine: + FROM alpine:$ALPINE_TAG + RUN apk add --no-cache bash curl jq ca-certificates upx + RUN update-ca-certificates + + SAVE IMAGE --push gcr.io/spectro-dev-public/canvos/alpine:$ALPINE_TAG + build-all-images: IF $FIPS_ENABLED BUILD +build-provider-images-fips @@ -133,152 +144,29 @@ build-all-images: END build-provider-images: + FROM $ALPINE_IMG + IF [ "$IS_UKI" = "true" ] ARG TARGET=uki-provider-image ELSE ARG TARGET=provider-image END - IF [ "$K8S_VERSION" = "" ] - IF [ "$K8S_DISTRIBUTION" = "kubeadm" ] - BUILD +$TARGET --K8S_VERSION=1.24.6 - BUILD +$TARGET --K8S_VERSION=1.25.2 - BUILD +$TARGET --K8S_VERSION=1.25.13 - BUILD +$TARGET --K8S_VERSION=1.25.15 - BUILD +$TARGET --K8S_VERSION=1.26.4 - BUILD +$TARGET --K8S_VERSION=1.26.8 - BUILD +$TARGET --K8S_VERSION=1.26.10 - BUILD +$TARGET --K8S_VERSION=1.26.12 - BUILD +$TARGET --K8S_VERSION=1.26.15 - BUILD +$TARGET --K8S_VERSION=1.27.2 - BUILD +$TARGET --K8S_VERSION=1.27.5 - BUILD +$TARGET --K8S_VERSION=1.27.7 - BUILD +$TARGET --K8S_VERSION=1.27.9 - BUILD +$TARGET --K8S_VERSION=1.27.11 - BUILD +$TARGET --K8S_VERSION=1.27.15 - BUILD +$TARGET --K8S_VERSION=1.27.16 - BUILD +$TARGET --K8S_VERSION=1.28.2 - BUILD +$TARGET --K8S_VERSION=1.28.5 - BUILD +$TARGET --K8S_VERSION=1.28.9 - BUILD +$TARGET --K8S_VERSION=1.28.11 - BUILD +$TARGET --K8S_VERSION=1.28.12 - BUILD +$TARGET --K8S_VERSION=1.29.0 - BUILD +$TARGET --K8S_VERSION=1.29.6 - BUILD +$TARGET --K8S_VERSION=1.29.7 - ELSE IF [ "$K8S_DISTRIBUTION" = "rke2" ] - BUILD +$TARGET --K8S_VERSION=1.24.6 - BUILD +$TARGET --K8S_VERSION=1.25.2 - BUILD +$TARGET --K8S_VERSION=1.25.13 - BUILD +$TARGET --K8S_VERSION=1.25.15 - BUILD +$TARGET --K8S_VERSION=1.26.4 - BUILD +$TARGET --K8S_VERSION=1.26.8 - BUILD +$TARGET --K8S_VERSION=1.26.10 - BUILD +$TARGET --K8S_VERSION=1.26.12 - BUILD +$TARGET --K8S_VERSION=1.26.14 - BUILD +$TARGET --K8S_VERSION=1.26.15 - BUILD +$TARGET --K8S_VERSION=1.27.2 - BUILD +$TARGET --K8S_VERSION=1.27.5 - BUILD +$TARGET --K8S_VERSION=1.27.7 - BUILD +$TARGET --K8S_VERSION=1.27.9 - BUILD +$TARGET --K8S_VERSION=1.27.11 - BUILD +$TARGET --K8S_VERSION=1.27.13 - BUILD +$TARGET --K8S_VERSION=1.27.14 - BUILD +$TARGET --K8S_VERSION=1.27.15 - BUILD +$TARGET --K8S_VERSION=1.28.2 - BUILD +$TARGET --K8S_VERSION=1.28.5 - BUILD +$TARGET --K8S_VERSION=1.28.7 - BUILD +$TARGET --K8S_VERSION=1.28.9 - BUILD +$TARGET --K8S_VERSION=1.28.10 - BUILD +$TARGET --K8S_VERSION=1.28.11 - BUILD +$TARGET --K8S_VERSION=1.29.3 - BUILD +$TARGET --K8S_VERSION=1.29.4 - BUILD +$TARGET --K8S_VERSION=1.29.5 - BUILD +$TARGET --K8S_VERSION=1.29.6 - ELSE IF [ "$K8S_DISTRIBUTION" = "k3s" ] - BUILD +$TARGET --K8S_VERSION=1.24.6 - BUILD +$TARGET --K8S_VERSION=1.25.2 - BUILD +$TARGET --K8S_VERSION=1.25.13 - BUILD +$TARGET --K8S_VERSION=1.25.15 - BUILD +$TARGET --K8S_VERSION=1.26.4 - BUILD +$TARGET --K8S_VERSION=1.26.8 - BUILD +$TARGET --K8S_VERSION=1.26.10 - BUILD +$TARGET --K8S_VERSION=1.26.14 - BUILD +$TARGET --K8S_VERSION=1.27.2 - BUILD +$TARGET --K8S_VERSION=1.27.5 - BUILD +$TARGET --K8S_VERSION=1.27.7 - BUILD +$TARGET --K8S_VERSION=1.27.11 - BUILD +$TARGET --K8S_VERSION=1.27.15 - BUILD +$TARGET --K8S_VERSION=1.28.2 - BUILD +$TARGET --K8S_VERSION=1.28.7 - BUILD +$TARGET --K8S_VERSION=1.28.11 - BUILD +$TARGET --K8S_VERSION=1.29.2 - BUILD +$TARGET --K8S_VERSION=1.29.6 - END - ELSE - BUILD +$TARGET --K8S_VERSION="$K8S_VERSION" - END -build-provider-images-fips: IF [ "$K8S_VERSION" = "" ] - IF [ "$K8S_DISTRIBUTION" = "kubeadm-fips" ] - BUILD +provider-image --K8S_VERSION=1.24.13 - BUILD +provider-image --K8S_VERSION=1.25.9 - BUILD +provider-image --K8S_VERSION=1.26.4 - BUILD +provider-image --K8S_VERSION=1.26.12 - BUILD +provider-image --K8S_VERSION=1.26.15 - BUILD +provider-image --K8S_VERSION=1.27.2 - BUILD +provider-image --K8S_VERSION=1.27.9 - BUILD +provider-image --K8S_VERSION=1.27.14 - BUILD +provider-image --K8S_VERSION=1.27.15 - BUILD +provider-image --K8S_VERSION=1.27.16 - BUILD +provider-image --K8S_VERSION=1.28.5 - BUILD +provider-image --K8S_VERSION=1.28.10 - BUILD +provider-image --K8S_VERSION=1.28.11 - BUILD +provider-image --K8S_VERSION=1.28.12 - BUILD +provider-image --K8S_VERSION=1.29.0 - BUILD +provider-image --K8S_VERSION=1.29.5 - BUILD +provider-image --K8S_VERSION=1.29.6 - BUILD +provider-image --K8S_VERSION=1.29.7 - ELSE IF [ "$K8S_DISTRIBUTION" = "rke2" ] - BUILD +provider-image --K8S_VERSION=1.24.6 - BUILD +provider-image --K8S_VERSION=1.25.0 - BUILD +provider-image --K8S_VERSION=1.25.2 - BUILD +provider-image --K8S_VERSION=1.26.4 - BUILD +provider-image --K8S_VERSION=1.26.12 - BUILD +provider-image --K8S_VERSION=1.26.14 - BUILD +provider-image --K8S_VERSION=1.27.2 - BUILD +provider-image --K8S_VERSION=1.27.9 - BUILD +provider-image --K8S_VERSION=1.27.11 - BUILD +provider-image --K8S_VERSION=1.27.14 - BUILD +provider-image --K8S_VERSION=1.27.15 - BUILD +provider-image --K8S_VERSION=1.28.5 - BUILD +provider-image --K8S_VERSION=1.28.7 - BUILD +provider-image --K8S_VERSION=1.28.10 - BUILD +provider-image --K8S_VERSION=1.28.11 - BUILD +provider-image --K8S_VERSION=1.29.0 - BUILD +provider-image --K8S_VERSION=1.29.3 - BUILD +provider-image --K8S_VERSION=1.29.5 - BUILD +provider-image --K8S_VERSION=1.29.6 - ELSE - BUILD +provider-image --K8S_VERSION=1.24.6 - BUILD +provider-image --K8S_VERSION=1.25.2 - BUILD +provider-image --K8S_VERSION=1.26.4 - BUILD +provider-image --K8S_VERSION=1.26.12 - BUILD +provider-image --K8S_VERSION=1.26.14 - BUILD +provider-image --K8S_VERSION=1.27.2 - BUILD +provider-image --K8S_VERSION=1.27.9 - BUILD +provider-image --K8S_VERSION=1.27.11 - BUILD +provider-image --K8S_VERSION=1.27.15 - BUILD +provider-image --K8S_VERSION=1.28.5 - BUILD +provider-image --K8S_VERSION=1.28.7 - BUILD +provider-image --K8S_VERSION=1.28.11 - BUILD +provider-image --K8S_VERSION=1.29.0 - BUILD +provider-image --K8S_VERSION=1.29.2 - BUILD +provider-image --K8S_VERSION=1.29.6 + WORKDIR /workdir + COPY k8s_version.json k8s_version.json + ENV K8S_DISTRIBUTION=$K8S_DISTRIBUTION + RUN jq -r ".$K8S_DISTRIBUTION[]" k8s_version.json > k8s_version.txt + FOR version IN $(cat k8s_version.txt) + BUILD +$TARGET --K8S_VERSION=$version END ELSE - BUILD +provider-image --K8S_VERSION="$K8S_VERSION" + BUILD +$TARGET --K8S_VERSION=$K8S_VERSION END +build-provider-images-fips: + BUILD +build-provider-images + BASE_ALPINE: COMMAND IF [ ! -z $PROXY_CERT_PATH ] @@ -516,6 +404,7 @@ uki-genkey: END download-sbctl: + FROM $ALPINE_IMG DO +BASE_ALPINE RUN curl -Ls https://github.com/Foxboron/sbctl/releases/download/0.13/sbctl-0.13-linux-amd64.tar.gz | tar -xvzf - && mv sbctl/sbctl /usr/bin/sbctl SAVE ARTIFACT /usr/bin/sbctl @@ -990,9 +879,8 @@ download-third-party: SAVE ARTIFACT /binaries/${binary}/latest/$BIN_TYPE/$TARGETARCH/${binary}.version ${binary}.version third-party: - DO +BASE_ALPINE + FROM $ALPINE_IMG ARG binary - RUN apk add upx WORKDIR /WORKDIR COPY (+download-third-party/${binary} --binary=${binary}) /WORKDIR/${binary} diff --git a/k8s_version.json b/k8s_version.json new file mode 100644 index 0000000..00d20e2 --- /dev/null +++ b/k8s_version.json @@ -0,0 +1,94 @@ +{ + "k3s": [ + "1.24.6", + "1.25.2", + "1.26.4", + "1.26.12", + "1.26.14", + "1.27.2", + "1.27.9", + "1.27.11", + "1.27.15", + "1.28.5", + "1.28.7", + "1.28.11", + "1.29.0", + "1.29.2", + "1.29.6" + ], + "kubeadm": [ + "1.24.6", + "1.25.2", + "1.25.13", + "1.25.15", + "1.26.4", + "1.26.8", + "1.26.10", + "1.26.12", + "1.26.15", + "1.27.2", + "1.27.5", + "1.27.7", + "1.27.9", + "1.27.11", + "1.27.15", + "1.27.16", + "1.28.2", + "1.28.5", + "1.28.9", + "1.28.11", + "1.28.12", + "1.29.0", + "1.29.6", + "1.29.7" + ], + "rke2": [ + "1.24.6", + "1.25.2", + "1.25.13", + "1.26.4", + "1.26.8", + "1.26.10", + "1.26.12", + "1.26.14", + "1.26.15", + "1.27.2", + "1.27.5", + "1.27.7", + "1.27.9", + "1.27.11", + "1.27.13", + "1.27.14", + "1.27.15", + "1.28.2", + "1.28.5", + "1.28.7", + "1.28.9", + "1.28.10", + "1.28.11", + "1.29.3", + "1.29.4", + "1.29.5", + "1.29.6" + ], + "kubeadm-fips": [ + "1.24.13", + "1.25.9", + "1.26.4", + "1.26.12", + "1.26.15", + "1.27.2", + "1.27.9", + "1.27.14", + "1.27.15", + "1.27.16", + "1.28.5", + "1.28.10", + "1.28.11", + "1.28.12", + "1.29.0", + "1.29.5", + "1.29.6", + "1.29.7" + ] +}