From ed5f839747befa86be76c62f3eb5a4f2aefaa6ad Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Mon, 18 Nov 2024 12:54:04 -0500 Subject: [PATCH 01/10] Switch k9s source from GitHub to use openSUSE --- hack/make/deps.mk | 12 +----------- package/Dockerfile | 15 +++++++-------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/hack/make/deps.mk b/hack/make/deps.mk index 1480a36..b837f87 100644 --- a/hack/make/deps.mk +++ b/hack/make/deps.mk @@ -15,17 +15,7 @@ KUSTOMIZE_SUM_amd64 := 6703a3a70a0c47cf0b37694030b54f1175a9dfeb17b3818b623ed58b9 # renovate: datasource=github-release-attachments depName=kubernetes-sigs/kustomize versioning=regex:^kustomize/v(?\d+)\.(?\d+)\.(?\d+)$ digestVersion=kustomize/v5.5.0 KUSTOMIZE_SUM_s390x := 37dcd2429ef93886319b39671071b2e1c5307993cdb6a5c097cfefc97177d296 -# renovate: datasource=github-release-attachments depName=derailed/k9s -K9S_VERSION := v0.32.6 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_arm64 := dfe0bb78e17a4b72ff151e18e548467b6073608e1af4e2efb30a884eed772ea0 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_amd64 := 3f5fa5b3563cf2962ecd78381df59a72a01d824d87f3c70493f7748807243755 -# renovate: datasource=github-release-attachments depName=derailed/k9s digestVersion=v0.32.6 -K9S_SUM_s390x := 261074c92d1d2e9b181700b2cf8d7166acff30d2bb425437c9f5027815de44b6 - # 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) + --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) \ No newline at end of file diff --git a/package/Dockerfile b/package/Dockerfile index 4a0993a..720b8bf 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -43,12 +43,6 @@ RUN curl --output /tmp/kustomize.tar.gz -sLf "https://github.com/kubernetes-sigs echo "${!KUSTOMIZE_SUM} /tmp/kustomize.tar.gz" | sha256sum -c - && \ tar -xvzf /tmp/kustomize.tar.gz -C / kustomize -# Stage k9s into build -ENV K9S_SUM="K9S_SUM_${TARGETARCH}" -RUN curl --output /tmp/k9s.tar.gz -sLf "https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_${TARGETARCH}.tar.gz" && \ - 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 # Creates the based dir for the target image, and hydrates it with the @@ -56,12 +50,17 @@ FROM registry.suse.com/bci/bci-base:${BCI_VERSION} AS zypper RUN mkdir /chroot COPY --from=final / /chroot/ +# Setup repo needed to install k9s package +RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ + && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ + && zypper --non-interactive --gpg-auto-import-keys refresh + # The final image does not contain zypper, --installroot is used to # install all artefacts within a dir (/chroot) that can then be copied # over to a scratch image. RUN zypper --non-interactive refresh && \ zypper --installroot /chroot -n rm busybox-vi busybox-links && \ - zypper --installroot /chroot -n in bash-completion jq vim curl && \ + zypper --installroot /chroot -n in bash-completion jq vim curl k9s && \ zypper --installroot /chroot clean -a && \ rm -rf /chroot/var/cache/zypp/* /chroot/var/log/zypp/* /chroot/etc/zypp/ @@ -84,7 +83,7 @@ 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 /kubectl /kustomize* /usr/local/bin/ 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/ From 61ea3b8ba227f57bbc756024413832951e8e84ff Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Mon, 18 Nov 2024 13:05:12 -0500 Subject: [PATCH 02/10] Add repo for IBM zed --- package/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/package/Dockerfile b/package/Dockerfile index 720b8bf..08395de 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -53,6 +53,7 @@ COPY --from=final / /chroot/ # Setup repo needed to install k9s package RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ + && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ && zypper --non-interactive --gpg-auto-import-keys refresh # The final image does not contain zypper, --installroot is used to From c922ed6ed70a79bd31669dbf3a2ec2d87ffbe08c Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Mon, 18 Nov 2024 13:05:27 -0500 Subject: [PATCH 03/10] Correct image unit test --- Makefile | 2 +- hack/test | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cfafdbb..0fab058 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ test: test-build ## test the build against all target platforms. $(MAKE) build-image IMAGE=$(IMAGE) \ KUBECTL_VERSION=$(KUBECTL_VERSION) HELM_VERSION=$(HELM_VERSION) \ - KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) K9S_VERSION=$(K9S_VERSION) \ + KUSTOMIZE_VERSION=$(KUSTOMIZE_VERSION) \ ./hack/test test-build: diff --git a/hack/test b/hack/test index fc40c58..0c43917 100755 --- a/hack/test +++ b/hack/test @@ -31,9 +31,9 @@ function expected_file(){ function check_files(){ echo "checking expected binaries:" + expected_file "/usr/bin/k9s" "0:0" "755" 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 "/usr/local/bin/kustomize" "0:0" "755" expected_file "/usr/local/bin/welcome" "0:0" "755" @@ -63,7 +63,6 @@ function check_versions(){ echo "checking command 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}" From 264a3965c640ea9760787646f7a3e7e8a178b5f7 Mon Sep 17 00:00:00 2001 From: "Dan P." Date: Mon, 18 Nov 2024 15:36:19 -0500 Subject: [PATCH 04/10] Update hack/make/deps.mk Co-authored-by: Paulo Gomes --- hack/make/deps.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hack/make/deps.mk b/hack/make/deps.mk index b837f87..0e8d613 100644 --- a/hack/make/deps.mk +++ b/hack/make/deps.mk @@ -18,4 +18,4 @@ KUSTOMIZE_SUM_s390x := 37dcd2429ef93886319b39671071b2e1c5307993cdb6a5c097cfefc97 # 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) \ No newline at end of file + --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) From 83cf709dc4825cd2450facda4bd31a891cf9e88c Mon Sep 17 00:00:00 2001 From: "Dan P." Date: Mon, 18 Nov 2024 15:36:30 -0500 Subject: [PATCH 05/10] Update package/Dockerfile Co-authored-by: Paulo Gomes --- package/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/Dockerfile b/package/Dockerfile index 08395de..86e7363 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -54,7 +54,8 @@ COPY --from=final / /chroot/ RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ - && zypper --non-interactive --gpg-auto-import-keys refresh +rpm --import https://download.opensuse.org/repositories/devel:/kubic/15.6/repodata/repomd.xml.key && \ + && zypper --non-interactive refresh # The final image does not contain zypper, --installroot is used to # install all artefacts within a dir (/chroot) that can then be copied From 71fda9ce2f477eb0b5f91a75f8066dc7a3db0038 Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Mon, 18 Nov 2024 17:31:23 -0500 Subject: [PATCH 06/10] add keys for ARM and IBM z repos --- package/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/Dockerfile b/package/Dockerfile index 86e7363..55d181c 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -54,7 +54,9 @@ COPY --from=final / /chroot/ RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ -rpm --import https://download.opensuse.org/repositories/devel:/kubic/15.6/repodata/repomd.xml.key && \ + && rpm --import https://download.opensuse.org/repositories/devel:/kubic/15.6/repodata/repomd.xml.key \ + --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/repodata/repomd.xml.key \ + --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/repodata/repomd.xml.key \ && zypper --non-interactive refresh # The final image does not contain zypper, --installroot is used to From a5f5a314a44652cf574e2b5f0a9190e9c61c6a41 Mon Sep 17 00:00:00 2001 From: "Dan P." Date: Wed, 20 Nov 2024 09:58:22 -0500 Subject: [PATCH 07/10] Update package/Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Dan Čermák --- package/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package/Dockerfile b/package/Dockerfile index 55d181c..b64e0db 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -64,9 +64,7 @@ RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel # over to a scratch image. RUN zypper --non-interactive refresh && \ zypper --installroot /chroot -n rm busybox-vi busybox-links && \ - zypper --installroot /chroot -n in bash-completion jq vim curl k9s && \ - zypper --installroot /chroot clean -a && \ - rm -rf /chroot/var/cache/zypp/* /chroot/var/log/zypp/* /chroot/etc/zypp/ + zypper --installroot /chroot -n in bash-completion jq vim curl k9s RUN echo 'shell:x:1000:1000:shell,,,:/home/shell:/bin/bash' > /chroot/etc/passwd && \ From 07db657654a128479aa99712f902d097b33908b1 Mon Sep 17 00:00:00 2001 From: "Dan P." Date: Wed, 20 Nov 2024 10:06:02 -0500 Subject: [PATCH 08/10] Update package/Dockerfile Co-authored-by: Guilherme Macedo --- package/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Dockerfile b/package/Dockerfile index b64e0db..c482d0e 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -54,7 +54,7 @@ COPY --from=final / /chroot/ RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ - && rpm --import https://download.opensuse.org/repositories/devel:/kubic/15.6/repodata/repomd.xml.key \ + && rpm --import https://download.opensuse.org/repositories/devel:/kubic/${BCI_VERSION}/repodata/repomd.xml.key \ --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/repodata/repomd.xml.key \ --import https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/repodata/repomd.xml.key \ && zypper --non-interactive refresh From 8dd4830f946f78ca09ebf7115bb1409132614d38 Mon Sep 17 00:00:00 2001 From: "Dan P." Date: Wed, 20 Nov 2024 10:06:10 -0500 Subject: [PATCH 09/10] Update package/Dockerfile Co-authored-by: Guilherme Macedo --- package/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Dockerfile b/package/Dockerfile index c482d0e..450b656 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -51,7 +51,7 @@ RUN mkdir /chroot COPY --from=final / /chroot/ # Setup repo needed to install k9s package -RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/15.6/devel:kubic.repo \ +RUN zypper --non-interactive ar https://download.opensuse.org/repositories/devel:kubic/${BCI_VERSION}/devel:kubic.repo \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_ARM/ devel_kubic_arm \ && zypper --non-interactive ar https://download.opensuse.org/repositories/devel:/kubic/openSUSE_Factory_zSystems/ devel_kubic_zed \ && rpm --import https://download.opensuse.org/repositories/devel:/kubic/${BCI_VERSION}/repodata/repomd.xml.key \ From c8fa6c4d48348e1813ec15190b16b24b9e3b405d Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Wed, 20 Nov 2024 10:32:16 -0500 Subject: [PATCH 10/10] ensure BCI var in proper scope --- package/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package/Dockerfile b/package/Dockerfile index 450b656..35ced8c 100644 --- a/package/Dockerfile +++ b/package/Dockerfile @@ -45,6 +45,9 @@ RUN curl --output /tmp/kustomize.tar.gz -sLf "https://github.com/kubernetes-sigs FROM registry.suse.com/bci/bci-base:${BCI_VERSION} AS zypper +ARG BCI_VERSION=15.6 +ENV BCI_VERSION=${BCI_VERSION} + # Creates the based dir for the target image, and hydrates it with the # original contents of the final image. RUN mkdir /chroot