#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT_DIR" VERGABE_RELEASE="${VERGABE_RELEASE:-vergabe-teilnahme}" VERGABE_NAMESPACE="${VERGABE_NAMESPACE:-vergabe-teilnahme}" VERGABE_CHART="${VERGABE_CHART:-charts/vergabe-teilnahme}" VERGABE_VALUES="${VERGABE_VALUES:-helm/vergabe-teilnahme-values.yaml}" INTER_HUB_RELEASE="${INTER_HUB_RELEASE:-inter-hub}" INTER_HUB_NAMESPACE="${INTER_HUB_NAMESPACE:-inter-hub}" INTER_HUB_CHART="${INTER_HUB_CHART:-charts/inter-hub}" INTER_HUB_VALUES="${INTER_HUB_VALUES:-helm/inter-hub-values.yaml}" DRY_RUN_CREATE_NAMESPACES="${DRY_RUN_CREATE_NAMESPACES:-false}" for cmd in kubectl helm; do if ! command -v "$cmd" >/dev/null 2>&1; then echo "ERROR: missing required command: $cmd" >&2 exit 1 fi done echo "server dry-run: checking Kubernetes API discovery" if ! kubectl api-resources >/dev/null; then echo "ERROR: cannot reach a representative Kubernetes API server" >&2 echo "Check kubeconfig, runner placement, and cluster access prerequisites." >&2 echo "See docs/manifest-server-dry-run.md." >&2 exit 1 fi if [[ "$DRY_RUN_CREATE_NAMESPACES" == "true" ]]; then echo "server dry-run: ensuring namespace $VERGABE_NAMESPACE exists" kubectl create namespace "$VERGABE_NAMESPACE" --dry-run=client -o yaml | kubectl apply -f - echo "server dry-run: ensuring namespace $INTER_HUB_NAMESPACE exists" kubectl create namespace "$INTER_HUB_NAMESPACE" --dry-run=client -o yaml | kubectl apply -f - fi tmpdir="$(mktemp -d)" trap 'rm -rf "$tmpdir"' EXIT helm template "$VERGABE_RELEASE" "$VERGABE_CHART" \ --namespace "$VERGABE_NAMESPACE" \ -f "$VERGABE_VALUES" \ > "$tmpdir/vergabe-teilnahme.yaml" helm template "$INTER_HUB_RELEASE" "$INTER_HUB_CHART" \ --namespace "$INTER_HUB_NAMESPACE" \ -f "$INTER_HUB_VALUES" \ > "$tmpdir/inter-hub.yaml" echo "server dry-run: committed manifests" kubectl apply --dry-run=server -f manifests echo "server dry-run: rendered $VERGABE_RELEASE chart" kubectl apply --dry-run=server -n "$VERGABE_NAMESPACE" -f "$tmpdir/vergabe-teilnahme.yaml" echo "server dry-run: rendered $INTER_HUB_RELEASE chart" kubectl apply --dry-run=server -n "$INTER_HUB_NAMESPACE" -f "$tmpdir/inter-hub.yaml"