Skip to content

Commit 209a673

Browse files
committed
feat: add Linux/WSL2 support + fix webhook timing races
- Support macOS and Linux (including WSL2) — autodetect via uname - Platform-aware disk check (df -g on macOS, df --block-size=1G on Linux) - Platform-aware install hints (brew on macOS, apt on Linux) - Fix MetalLB webhook race: retry loop for IPAddressPool/L2Advertisement - Fix cert-manager webhook race: dry-run probe before applying certs - Both webhook fixes affect macOS too on clean first-run installs Tested: full deploy on WSL2 (Ubuntu 24.04, Docker Engine, x86_64)
1 parent 84b2912 commit 209a673

2 files changed

Lines changed: 51 additions & 12 deletions

File tree

test/e2e/scripts/LOCAL-DEPLOY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MaaS Local Deployment Guide
22

3-
One-click local deployment of the full MaaS + BBR platform on Kind (Mac only).
3+
One-click local deployment of the full MaaS + BBR platform on Kind (macOS + Linux/WSL2).
44

55
## Quick Start
66

test/e2e/scripts/local-deploy.sh

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Deploy MaaS platform locally on a Kind cluster (Mac only).
2+
# Deploy MaaS platform locally on a Kind cluster (macOS + Linux/WSL2).
33
#
44
# One-click deployment of: Kind + Istio + Gateway API + cert-manager +
55
# Kuadrant (auth/rate-limiting) + PostgreSQL + MaaS controller + MaaS API.
@@ -95,7 +95,7 @@ while [[ $# -gt 0 ]]; do
9595
--help|-h)
9696
echo "Usage: $0 [--teardown | --status | --validate | --rebuild <component> | --help]"
9797
echo ""
98-
echo "Deploy MaaS platform on a local Kind cluster (Mac only)."
98+
echo "Deploy MaaS platform on a local Kind cluster (macOS + Linux/WSL2)."
9999
echo ""
100100
echo "Flags:"
101101
echo " --teardown Delete the Kind cluster and all resources"
@@ -382,16 +382,17 @@ fi
382382

383383
step "Checking prerequisites"
384384

385-
# Mac only
386-
if [[ "$(uname -s)" != "Darwin" ]]; then
387-
fail "This script only supports macOS. Detected: $(uname -s)"
385+
# Supported platforms: macOS and Linux (including WSL2)
386+
OS="$(uname -s)"
387+
if [[ "$OS" != "Darwin" && "$OS" != "Linux" ]]; then
388+
fail "This script supports macOS and Linux. Detected: $OS"
388389
exit 1
389390
fi
390-
ok "macOS detected ($ARCH)"
391+
ok "$OS detected ($ARCH)"
391392

392-
# Docker Desktop
393+
# Docker
393394
if ! docker info &>/dev/null; then
394-
fail "Docker is not running. Start Docker Desktop and try again."
395+
fail "Docker is not running. Start Docker (Desktop or daemon) and try again."
395396
exit 1
396397
fi
397398

@@ -412,7 +413,11 @@ else
412413
fi
413414

414415
# Check disk space
415-
DISK_FREE_GB=$(df -g / | tail -1 | awk '{print $4}')
416+
if [[ "$OS" == "Darwin" ]]; then
417+
DISK_FREE_GB=$(df -g / | tail -1 | awk '{print $4}')
418+
else
419+
DISK_FREE_GB=$(df --block-size=1G / | tail -1 | awk '{print $4}')
420+
fi
416421
if [[ "$DISK_FREE_GB" -lt 10 ]]; then
417422
warn "Only ${DISK_FREE_GB}GB free disk space. Recommend 10+ GB."
418423
else
@@ -429,7 +434,11 @@ done
429434

430435
if [[ ${#MISSING[@]} -gt 0 ]]; then
431436
fail "Missing required tools: ${MISSING[*]}"
432-
echo " Install with: brew install ${MISSING[*]}"
437+
if [[ "$OS" == "Darwin" ]]; then
438+
echo " Install with: brew install ${MISSING[*]}"
439+
else
440+
echo " Install with your package manager (e.g., apt install ${MISSING[*]})"
441+
fi
433442
exit 1
434443
fi
435444
ok "Tools: kind, kubectl, kustomize, helm, jq"
@@ -512,10 +521,15 @@ else
512521
fi
513522
kubectl wait --for=condition=Available deployment/controller -n metallb-system --timeout=120s
514523

524+
# Wait for webhook pod to be ready before applying config (avoids race condition)
525+
kubectl wait --for=condition=Ready pod -l component=controller -n metallb-system --timeout=120s 2>/dev/null || true
526+
515527
# Configure IP pool from Kind's docker network (extract IPv4 subnet)
516528
KIND_SUBNET=$(docker network inspect kind -f '{{range .IPAM.Config}}{{.Subnet}} {{end}}' | tr ' ' '\n' | grep '\.')
517529
LB_BASE=$(echo "$KIND_SUBNET" | cut -d'.' -f1-3)
518-
kubectl apply -f - <<EOF
530+
_metallb_retries=0
531+
while [[ $_metallb_retries -lt 6 ]]; do
532+
if kubectl apply -f - <<EOF 2>/dev/null
519533
apiVersion: metallb.io/v1beta1
520534
kind: IPAddressPool
521535
metadata:
@@ -531,6 +545,13 @@ metadata:
531545
name: kind-l2
532546
namespace: metallb-system
533547
EOF
548+
then
549+
break
550+
fi
551+
echo " MetalLB webhook not ready, retrying in 10s..."
552+
sleep 10
553+
_metallb_retries=$((_metallb_retries + 1))
554+
done
534555
ok "MetalLB installed (LB range: ${LB_BASE}.200-250)"
535556
fi
536557

@@ -544,6 +565,24 @@ else
544565
kubectl apply -f "https://github.com/cert-manager/cert-manager/releases/download/v${CERTMANAGER_VERSION}/cert-manager.yaml"
545566
kubectl wait --for=condition=Available deployment/cert-manager -n cert-manager --timeout=120s
546567
kubectl wait --for=condition=Available deployment/cert-manager-webhook -n cert-manager --timeout=120s
568+
# Wait for webhook to actually serve (deployment Available != TLS endpoint ready)
569+
echo " Waiting for cert-manager webhook to serve..."
570+
_cm_retries=0
571+
while [[ $_cm_retries -lt 12 ]]; do
572+
if kubectl apply --dry-run=server -f - <<CMEOF 2>/dev/null
573+
apiVersion: cert-manager.io/v1
574+
kind: ClusterIssuer
575+
metadata:
576+
name: cert-manager-webhook-test
577+
spec:
578+
selfSigned: {}
579+
CMEOF
580+
then
581+
break
582+
fi
583+
sleep 5
584+
_cm_retries=$((_cm_retries + 1))
585+
done
547586
ok "cert-manager v${CERTMANAGER_VERSION} installed"
548587
fi
549588

0 commit comments

Comments
 (0)