#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ENV_FILE="${1:-$ROOT/k8s/regional/regions.env}"
OUT="${2:-$ROOT/k8s/regional/rendered}"
"$ROOT/scripts/render-regional-k8s.sh" "$ENV_FILE" "$OUT"
for f in "$OUT"/*.yaml; do
  echo "== validating $(basename "$f") =="
  kubectl apply --dry-run=client -f "$f" >/dev/null
  echo OK
done
