diff --git a/Makefile b/Makefile index caa0ea9..93a4588 100644 --- a/Makefile +++ b/Makefile @@ -21,8 +21,9 @@ clean: ## clean up project. test: test-build ## test the build against all target platforms. $(MAKE) image-build IMAGE=$(IMAGE) \ - KUBECTL_VERSION=$(KUBECTL_VERSION) HELM_VERSION=$(HELM_VERSION) \ - KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) K9S_VERSION=$(K9S_VERSION) \ + HELM_VERSION=$(HELM_VERSION) \ + KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) \ + K9S_VERSION=$(K9S_VERSION) \ ./hack/test test-build: diff --git a/README.md b/README.md index 11dd97d..0aa30db 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,21 @@ This is the current branch strategy for `rancher/shell`, it may change in the fu This branch supports Rancher 2.9 and spans supporting k8s 1.27 through 1.30. Here are the current component versions and their k8s support: +| Component | Version | Supported K8s | +|-------------|-----------------------------------------|-----------------------------------------------| +| `kuberlr` | `v0.4.5` | n/a | +| `kubectl` | `v1.27.x`,`v1.28.x`,`v1.29.x`,`v1.30.x` | `1.26`-`1.31` | +| `kustomize` | `v5.4.x` | n/a | +| `helm` | `v3.15.1-rancher2` | `1.27`-`1.30` (based on upstream helm policy) | +| `k9s` | `v0.32.4` | Uses `client-go` v0.29.3 | + + +#### Pre-Kuberlr +> These docs are preserved during the transition to kuberlr. + +This branch supports Rancher 2.9 and spans supporting k8s 1.27 through 1.30. +Here are the current component versions and their k8s support: + | Component | Version | Supported K8s | |-------------|--------------------|----------------------------| | `kubectl` | `v1.28.x` | `1.27`,`1.28`,`1.29` | diff --git a/hack/make/deps.mk b/hack/make/deps.mk index 29f0de0..d45d5e2 100644 --- a/hack/make/deps.mk +++ b/hack/make/deps.mk @@ -1,11 +1,6 @@ # renovate: datasource=github-release-attachments depName=rancher/helm HELM_VERSION := v3.15.1-rancher2 -KUBECTL_VERSION := v1.28.11 -KUBECTL_SUM_arm64 ?= $(shell curl -L "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/arm64/kubectl.sha256") -KUBECTL_SUM_amd64 ?= $(shell curl -L "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/amd64/kubectl.sha256") -KUBECTL_SUM_s390x ?= $(shell curl -L "https://dl.k8s.io/release/$(KUBECTL_VERSION)/bin/linux/s390x/kubectl.sha256") - # renovate: datasource=github-release-attachments depName=kubernetes-sigs/kustomize extractVersion=kustomize/v(?\d+\.\d+\.\d+) KUSTOMIZE_VERSION := v5.4.2 # renovate: datasource=github-release-attachments depName=kubernetes-sigs/kustomize versioning=regex:^kustomize/v(?\d+)\.(?\d+)\.(?\d+)$ digestVersion=kustomize/v5.4.1 @@ -26,6 +21,5 @@ K9S_SUM_s390x := 8aea75262492a699c150833cafc65465541c74becc1b0236b4a7e368f5bd512 # Reduces the code duplication on Makefile by keeping all args into a single variable. IMAGE_ARGS := --build-arg HELM_VERSION=$(HELM_VERSION) \ - --build-arg KUBECTL_VERSION=$(KUBECTL_VERSION) --build-arg KUBECTL_SUM_arm64=$(KUBECTL_SUM_arm64) --build-arg KUBECTL_SUM_amd64=$(KUBECTL_SUM_amd64) --build-arg KUBECTL_SUM_s390x=$(KUBECTL_SUM_s390x) \ --build-arg KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) --build-arg KUSTOMIZE_SUM_arm64=$(KUSTOMIZE_SUM_arm64) --build-arg KUSTOMIZE_SUM_amd64=$(KUSTOMIZE_SUM_amd64) --build-arg KUSTOMIZE_SUM_s390x=$(KUSTOMIZE_SUM_s390x) \ --build-arg K9S_VERSION=$(K9S_VERSION) --build-arg K9S_SUM_arm64=$(K9S_SUM_arm64) --build-arg K9S_SUM_amd64=$(K9S_SUM_amd64) --build-arg K9S_SUM_s390x=$(K9S_SUM_s390x) diff --git a/hack/test b/hack/test index fc40c58..6af2ccf 100755 --- a/hack/test +++ b/hack/test @@ -34,7 +34,8 @@ function check_files(){ expected_file "/usr/local/bin/helm" "0:0" "755" expected_file "/usr/local/bin/helm-cmd" "0:0" "755" expected_file "/usr/local/bin/k9s" "0:0" "755" - expected_file "/usr/local/bin/kubectl" "0:0" "755" + expected_file "/bin/kuberlr" "0:0" "755" + expected_file "/bin/kubectl" "0:0" "777" expected_file "/usr/local/bin/kustomize" "0:0" "755" expected_file "/usr/local/bin/welcome" "0:0" "755" expected_file "/home/shell/kustomize.sh" "1000:1000" "755" @@ -64,9 +65,6 @@ function check_versions(){ expected_version "helm" "${HELM_VERSION}" expected_version "kustomize" "${KUSTOMIZE_VERSION}" expected_version "k9s" "${K9S_VERSION}" - # --client=true is used so that it does not fail trying to - # identify the server version. - expected_version "kubectl --client=true" "${KUBECTL_VERSION}" } function main(){ diff --git a/package/Dockerfile b/package/Dockerfile index a665abc..4f2f9f4 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -1,10 +1,11 @@ ARG BCI_VERSION=15.6 -FROM registry.suse.com/bci/bci-busybox:${BCI_VERSION} as final +FROM --platform=$BUILDPLATFORM mallardduck/rancher-kuberlr-kubectl:v2.0.0-beta.2 AS kuberlr +FROM registry.suse.com/bci/bci-busybox:${BCI_VERSION} AS final # Image that provides cross compilation tooling. -FROM --platform=$BUILDPLATFORM rancher/mirrored-tonistiigi-xx:1.3.0 as xx +FROM --platform=$BUILDPLATFORM rancher/mirrored-tonistiigi-xx:1.3.0 AS xx -FROM --platform=$BUILDPLATFORM registry.suse.com/bci/golang:1.22 as helm +FROM --platform=$BUILDPLATFORM registry.suse.com/bci/golang:1.22 AS helm # Clone repository once, and reuse it for target archs. ARG HELM_VERSION @@ -24,20 +25,11 @@ FROM --platform=$BUILDPLATFORM registry.suse.com/bci/bci-base:${BCI_VERSION} AS RUN zypper -n install curl gzip tar # Define build arguments -ARG KUBECTL_VERSION KUBECTL_SUM_arm64 KUBECTL_SUM_amd64 KUBECTL_SUM_s390x \ - KUSTOMIZE_VERSION KUSTOMIZE_SUM_arm64 KUSTOMIZE_SUM_amd64 KUSTOMIZE_SUM_s390x \ +ARG KUBECTL_VERSION KUSTOMIZE_VERSION KUSTOMIZE_SUM_arm64 KUSTOMIZE_SUM_amd64 KUSTOMIZE_SUM_s390x \ K9S_VERSION K9S_SUM_arm64 K9S_SUM_amd64 K9S_SUM_s390x ARG TARGETARCH -# Stage kubectl into build -ADD --chown=root:root --chmod=0755 \ - "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETARCH}/kubectl" \ - /kubectl - -ENV KUBECTL_SUM="KUBECTL_SUM_${TARGETARCH}" -RUN echo "${!KUBECTL_SUM} /kubectl" | sha256sum -c - - -# Stage kubectl into build +# Stage kustomize into build ENV KUSTOMIZE_SUM="KUSTOMIZE_SUM_${TARGETARCH}" RUN curl --output /tmp/kustomize.tar.gz -sLf "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_${TARGETARCH}.tar.gz" && \ echo "${!KUSTOMIZE_SUM} /tmp/kustomize.tar.gz" | sha256sum -c - && \ @@ -49,7 +41,7 @@ RUN curl --output /tmp/k9s.tar.gz -sLf "https://github.com/derailed/k9s/releases echo "${!K9S_SUM} /tmp/k9s.tar.gz" | sha256sum -c - && \ tar -xvzf /tmp/k9s.tar.gz -C / k9s -FROM registry.suse.com/bci/bci-base:${BCI_VERSION} as zypper +FROM registry.suse.com/bci/bci-base:${BCI_VERSION} AS zypper # Creates the based dir for the target image, and hydrades it with the # original contents of the final image. @@ -77,6 +69,11 @@ RUN echo 'shell:x:1000:1000:shell,,,:/home/shell:/bin/bash' > /chroot/etc/passwd echo 'LANG=en_US.UTF-8' >> /chroot/home/shell/.bashrc && \ echo 'PS1="> "' >> /chroot/home/shell/.bashrc && \ mkdir /chroot/home/shell/.kube && \ + mkdir /chroot/home/shell/.kuberlr && \ + touch /chroot/home/shell/.kuberlr/kuberlr.conf && \ + echo "AllowDownload = false" >> /chroot/home/shell/.kuberlr/kuberlr.conf && \ + echo 'SystemPath = "/usr/local/bin"' >> /chroot/home/shell/.kuberlr/kuberlr.conf && \ + echo "Timeout = 6" >> /chroot/home/shell/.kuberlr/kuberlr.conf && \ chown -R 1000:1000 /chroot/home/shell && \ chmod 700 /chroot/run @@ -84,7 +81,10 @@ FROM scratch COPY --from=zypper /chroot / COPY --chown=root:root --chmod=0755 --from=helm /helm/bin/helm /usr/local/bin/ -COPY --chown=root:root --chmod=0755 --from=build /kubectl /k9s /kustomize* /usr/local/bin/ +COPY --chown=root:root --chmod=0755 --from=build /k9s /kustomize* /usr/local/bin/ +COPY --chown=root:root --chmod=0755 --from=kuberlr /usr/bin/kubectl* /usr/local/bin/ +COPY --chown=root:root --chmod=0755 --from=kuberlr /bin/kuberlr /bin/ +RUN ln -s /bin/kuberlr /bin/kubectl COPY --chown=root:root --chmod=0755 package/helm-cmd package/welcome /usr/local/bin/ COPY --chown=1000:1000 --chmod=0755 package/kustomize.sh /home/shell/