#!/usr/bin/env bash # In-cluster acceptance test for one forgeway instance. # # The "forge unavailable" case is produced by a throwaway Deployment pointed at # a dead upstream. Ollama on forge is never stopped. # # ./scripts/verify-cluster.sh ~/.kube/rocinante-admin.yaml lounge set -uo pipefail KUBECONFIG_PATH="${1:?usage: verify-cluster.sh }" SITE="${2:?usage: verify-cluster.sh }" export KUBECONFIG="$KUBECONFIG_PATH" NS=forgeway ROOT="$(cd "$(dirname "$0")/.." && pwd)" IMAGE="$(kubectl -n "$NS" get deploy forgeway -o jsonpath='{.spec.template.spec.containers[0].image}')" echo "### $SITE — image $IMAGE" cleanup() { kubectl -n "$NS" delete deploy forgeway-badtest --ignore-not-found --wait=false >/dev/null 2>&1 kubectl -n "$NS" delete svc forgeway-badtest --ignore-not-found >/dev/null 2>&1 kubectl -n "$NS" delete cm forgeway-checks --ignore-not-found >/dev/null 2>&1 kubectl -n "$NS" delete pod forgeway-verify --ignore-not-found --wait=false >/dev/null 2>&1 } cleanup trap cleanup EXIT kubectl -n "$NS" create configmap forgeway-checks --from-file=checks.sh="$ROOT/scripts/checks.sh" >/dev/null kubectl -n "$NS" apply -f - >/dev/null </dev/null || echo "WARN: badtest rollout slow" kubectl -n "$NS" apply -f - >/dev/null </dev/null)" [ "$phase" = "Succeeded" ] || [ "$phase" = "Failed" ] && break sleep 5 done echo kubectl -n "$NS" logs forgeway-verify