Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PE-4942 define k8s version json #266

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 31 additions & 139 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -133,152 +144,33 @@ build-all-images:
END

build-provider-images:
FROM $ALPINE_IMG

IF [ !-n "$K8S_DISTRIBUTION"]
RUN echo "K8S_DISTRIBUTION is not set. Please set K8S_DISTRIBUTION to kubeadm, kubeadm-fips, k3s, or rke2." && exit 1
END

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
nianyush marked this conversation as resolved.
Show resolved Hide resolved
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 ]
Expand Down Expand Up @@ -516,6 +408,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
Expand Down Expand Up @@ -990,9 +883,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}
Expand Down
94 changes: 94 additions & 0 deletions k8s_version.json
Original file line number Diff line number Diff line change
@@ -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"
]
}