sanitized rig
This commit is contained in:
@@ -6,16 +6,49 @@
|
||||
# ./ctrl/cluster.sh down # delete it (drops every room's namespace)
|
||||
# ./ctrl/cluster.sh status # what's running on it
|
||||
#
|
||||
# One target, one script — the variants live here. The kind-*.sh files stay
|
||||
# exactly as they are and remain runnable on their own; this only dispatches.
|
||||
# spr depends on rig, never the other way round. Building and deleting a cluster
|
||||
# is rig's job, so up and down hand straight to rig/ctrl/cluster.sh, carrying the
|
||||
# four things that make this cluster spr's rather than rig's defaults:
|
||||
#
|
||||
# CLUSTER=spr rooms deploy into the kind-spr context
|
||||
# KIND_CONFIG spr's own shape, which maps the rooms' gateway NodePorts
|
||||
# REGISTRY_MODE=none rooms load images straight into the node
|
||||
# PROFILE=minimal pinned here, so a change to rig's own ctrl/.env can never
|
||||
# quietly add addons to spr's cluster
|
||||
#
|
||||
# status stays here: it answers a question about rooms, not about the cluster.
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
RIG_CTRL="$SCRIPT_DIR/../rig/ctrl"
|
||||
|
||||
rig() {
|
||||
CLUSTER=spr \
|
||||
KIND_CONFIG="$SCRIPT_DIR/k8s/kind-config.yaml" \
|
||||
REGISTRY_MODE=none \
|
||||
PROFILE=minimal \
|
||||
bash "$RIG_CTRL/cluster.sh" "$@"
|
||||
}
|
||||
|
||||
case "${1:-status}" in
|
||||
up) exec "$SCRIPT_DIR/kind-up.sh" ;;
|
||||
down) exec "$SCRIPT_DIR/kind-down.sh" ;;
|
||||
status) exec "$SCRIPT_DIR/kind-status.sh" ;;
|
||||
up)
|
||||
rig up
|
||||
echo
|
||||
echo "Per-room deploy:"
|
||||
echo " cd gen/<room> && ./ctrl/k8s-up.sh"
|
||||
;;
|
||||
down)
|
||||
rig down
|
||||
;;
|
||||
status)
|
||||
if ! kind get clusters 2>/dev/null | grep -qx spr; then
|
||||
echo "No 'spr' kind cluster — run: make cluster up"
|
||||
exit 0
|
||||
fi
|
||||
kubectl --context kind-spr get namespaces -l soleprint-room
|
||||
echo
|
||||
kubectl --context kind-spr get pods -A -l soleprint-room
|
||||
;;
|
||||
*)
|
||||
echo "Unknown subcommand: $1" >&2
|
||||
echo "Usage: cluster.sh [up|down|status]" >&2
|
||||
|
||||
@@ -3,9 +3,15 @@ apiVersion: kind.x-k8s.io/v1alpha4
|
||||
# Single shared cluster for all soleprint rooms.
|
||||
# Each room deploys into its own namespace; gateway Services pick a
|
||||
# NodePort from the 30080-30099 range mapped here.
|
||||
name: spr
|
||||
#
|
||||
# Built by rig, not by spr: ctrl/cluster.sh hands this file to
|
||||
# rig/ctrl/cluster.sh, which substitutes CLUSTER and NODE_IMAGE (named without
|
||||
# braces here so this comment survives the substitution). The shape is spr's —
|
||||
# what its cluster needs is spr's business. Building it is rig's.
|
||||
name: ${CLUSTER}
|
||||
nodes:
|
||||
- role: control-plane
|
||||
image: ${NODE_IMAGE}
|
||||
extraPortMappings:
|
||||
# Room gateway NodePorts (one per active room).
|
||||
- {containerPort: 30080, hostPort: 30080, protocol: TCP}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Delete the shared `spr` kind cluster (drops every room's namespace too).
|
||||
# Use `gen/<room>/ctrl/k8s-down.sh` instead if you only want to remove
|
||||
# a single room's namespace.
|
||||
set -e
|
||||
|
||||
if kind get clusters 2>/dev/null | grep -q '^spr$'; then
|
||||
echo "Deleting kind cluster 'spr'..."
|
||||
kind delete cluster --name spr
|
||||
else
|
||||
echo "No kind cluster 'spr' to delete."
|
||||
fi
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Show what's running on the shared `spr` cluster.
|
||||
set -e
|
||||
|
||||
if ! kind get clusters 2>/dev/null | grep -q '^spr$'; then
|
||||
echo "No 'spr' kind cluster — run ctrl/kind-up.sh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
kubectl --context kind-spr get namespaces -l soleprint-room
|
||||
echo
|
||||
kubectl --context kind-spr get pods -A -l soleprint-room
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Create (or no-op) the single shared `spr` kind cluster used by every
|
||||
# soleprint room. Per-room work happens inside namespaces — see
|
||||
# `gen/<room>/ctrl/k8s-up.sh`.
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
KIND_CONFIG="$SCRIPT_DIR/k8s/kind-config.yaml"
|
||||
|
||||
if kind get clusters 2>/dev/null | grep -q '^spr$'; then
|
||||
echo "Kind cluster 'spr' already exists."
|
||||
else
|
||||
echo "Creating kind cluster 'spr'..."
|
||||
kind create cluster --config "$KIND_CONFIG"
|
||||
fi
|
||||
|
||||
kubectl config use-context kind-spr >/dev/null
|
||||
|
||||
echo
|
||||
echo "Cluster ready. Per-room deploy:"
|
||||
echo " cd gen/<room> && ./ctrl/k8s-up.sh"
|
||||
Reference in New Issue
Block a user