From 58d44be6564cdb9aec991bf62fb1dd4f95adfce7 Mon Sep 17 00:00:00 2001 From: Nishan Date: Mon, 7 Apr 2025 19:41:22 +0530 Subject: [PATCH] FIX: startup issue --- kind-cluster/Dockerfile | 23 ++++++++++++++++++++--- kind-cluster/scripts/env-setup | 7 +++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/kind-cluster/Dockerfile b/kind-cluster/Dockerfile index d672ab0..abbc85c 100644 --- a/kind-cluster/Dockerfile +++ b/kind-cluster/Dockerfile @@ -1,8 +1,25 @@ FROM earthly/dind -RUN wget https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64 -RUN chmod +x kind-linux-amd64 -RUN mv kind-linux-amd64 /usr/local/bin/kind +# Accept build-time architecture argument +ARG TARGETARCH + +# install kind for x86_64 architecture +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + wget https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64 && \ + chmod +x kind-linux-amd64 && \ + mv kind-linux-amd64 /usr/local/bin/kind && \ + echo "Building for x86_64 platform"; \ + touch /amd64-ready; \ + fi + +# install kind for ARM64 architecture +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + wget https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-arm64 && \ + chmod +x kind-linux-arm64 && \ + mv kind-linux-arm64 /usr/local/bin/kind && \ + echo "Building for ARM64 platform"; \ + touch /arm64-ready; \ + fi # use our own to start kind cluster COPY entrypoint.sh /usr/local/bin/entrypoint.sh diff --git a/kind-cluster/scripts/env-setup b/kind-cluster/scripts/env-setup index 1604e19..9f1d9a6 100755 --- a/kind-cluster/scripts/env-setup +++ b/kind-cluster/scripts/env-setup @@ -15,6 +15,13 @@ if [ -f "kind-config.yaml" ]; then rm -f kind-config.yaml fi +# Wait until kindest/node:$KIND_DEFAULT_VERSION is present +while ! docker images kindest/node | grep -q kindest/node; do + echo "Waiting for kindest/node to be available..." + sleep 5 +done +echo "kindest/node is now available" + cat < /tmp/kind-config.yaml kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4