From fb6bf6844d35c2a785b1498fed01ad7572a3870c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Verstraeten?= Date: Tue, 20 May 2025 11:27:38 +0000 Subject: [PATCH] Enhance deployment workflows and Dockerfile - Add Docker feature for running Docker outside of Docker in devcontainer.json - Update pod status checks in k3d, kind, and microk8s workflows to target 'hub-frontend' instead of 'kerberos-hub' - Improve Dockerfile to install 'kind' based on architecture --- .devcontainer/devcontainer.json | 3 +++ .github/workflows/k3d.yaml | 2 +- .github/workflows/kind.yaml | 2 +- .github/workflows/microk8s.yaml | 2 +- Dockerfile | 19 +++++++++++++++---- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9a3a83b..9c95bcf 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,6 +2,9 @@ "name": "go:1.24-bookworm", "dockerFile": "Dockerfile", "runArgs": ["--privileged"], + "features": { + "ghcr.io/devcontainers/features/docker-outside-of-docker:1": {} + }, "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/k3d.yaml b/.github/workflows/k3d.yaml index 0f07c0f..e2aabec 100644 --- a/.github/workflows/k3d.yaml +++ b/.github/workflows/k3d.yaml @@ -118,4 +118,4 @@ jobs: helm install hub kerberos/hub --values ./base/hub/kerberos-hub-values.yaml -n kerberos-hub --create-namespace echo "Sleeping for 300 seconds, give time for the helm chart to create the pods" && sleep 300 kubectl get pods -A -o wide - kubectl get pods -A -o wide | grep kerberos-hub | awk '{print $3}' | grep -q '1/1' && echo "kerberos-hub pod is running with status 1/1" || (echo "kerberos-hub pod is not running with status 1/1" && exit 1) + kubectl get pods -A -o wide | grep hub-frontend- | awk '{print $3}' | grep -q '1/1' && echo "hub-frontend pod is running with status 1/1" || (echo "hub-frontend pod is not running with status 1/1" && exit 1) diff --git a/.github/workflows/kind.yaml b/.github/workflows/kind.yaml index 8528c37..d4b423d 100644 --- a/.github/workflows/kind.yaml +++ b/.github/workflows/kind.yaml @@ -116,4 +116,4 @@ jobs: helm install hub kerberos/hub --values ./base/hub/kerberos-hub-values.yaml -n kerberos-hub --create-namespace echo "Sleeping for 300 seconds, give time for the helm chart to create the pods" && sleep 300 kubectl get pods -A -o wide - kubectl get pods -A -o wide | grep kerberos-hub | awk '{print $3}' | grep -q '1/1' && echo "kerberos-hub pod is running with status 1/1" || (echo "kerberos-hub pod is not running with status 1/1" && exit 1) + kubectl get pods -A -o wide | grep hub-frontend- | awk '{print $3}' | grep -q '1/1' && echo "hub-frontend pod is running with status 1/1" || (echo "hub-frontend pod is not running with status 1/1" && exit 1) diff --git a/.github/workflows/microk8s.yaml b/.github/workflows/microk8s.yaml index 32c187f..f48493f 100644 --- a/.github/workflows/microk8s.yaml +++ b/.github/workflows/microk8s.yaml @@ -108,4 +108,4 @@ jobs: helm install hub kerberos/hub --values ./base/hub/kerberos-hub-values.yaml -n kerberos-hub --create-namespace echo "Sleeping for 300 seconds, give time for the helm chart to create the pods" && sleep 300 kubectl get pods -A -o wide - kubectl get pods -A -o wide | grep kerberos-hub | awk '{print $3}' | grep -q '1/1' && echo "kerberos-hub pod is running with status 1/1" || (echo "kerberos-hub pod is not running with status 1/1" && exit 1) + kubectl get pods -A -o wide | grep hub-frontend- | awk '{print $3}' | grep -q '1/1' && echo "hub-frontend pod is running with status 1/1" || (echo "hub-frontend pod is not running with status 1/1" && exit 1) diff --git a/Dockerfile b/Dockerfile index 323d032..b970dee 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,19 @@ FROM ubuntu:latest LABEL maintainer="Cedric Verstraeten" -# Install dependencies -RUN apt-get update && apt-get install snapd snap-confine -y +# Install curl +RUN apt-get update && apt-get install -y curl -# Install microk8s -RUN snap install microk8s --classic --channel=1.32/stable \ No newline at end of file +# Install kind (detect architecture) +RUN ARCH=$(uname -m) && \ + if [ "$ARCH" = "x86_64" ]; then \ + curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/v0.28.0/kind-linux-amd64; \ + elif [ "$ARCH" = "aarch64" ]; then \ + curl -Lo /usr/local/bin/kind https://kind.sigs.k8s.io/dl/v0.28.0/kind-linux-arm64; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + chmod +x /usr/local/bin/kind + +# Create a cluster using kind +RUN kind create cluster \ No newline at end of file