- Move flat service manifests into structured subdirs (apps/, bootstrap-jobs/, repair-jobs/, migration-jobs/, validation-jobs/, node-ops/, networking/) - Retire oneoffs/ directories across services - Remove oceanus cluster and its host roles; add aether cluster + terraform scaffolding - Reorganize scripts/ into ops/, render/, sync/, manual-tests/ - Add Makefile with render/validate/test/flux targets and repo-structure tests - Update flux-system application CRs to the new paths - Add hermes-automated-triage-24h-plan knowledge doc (+ comms mirror) - Refresh knowledge catalogs, dashboards, vmalert rules, quality contract Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
88 lines
2.6 KiB
Bash
Executable File
88 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
usage() {
|
|
cat <<'USAGE'
|
|
Usage:
|
|
scripts/ops/cluster_power_console.sh [--repo-dir <path>] [--delegate-host <host>] <shutdown|startup> [recovery-script-options...]
|
|
|
|
Purpose:
|
|
Friendly manual entrypoint for running Ananke from a remote console.
|
|
Canonical control host is titan-db by default so bundle/state handling stays in one place.
|
|
|
|
Defaults:
|
|
--repo-dir $HOME/Development/ananke (fallback: $HOME/Development/titan-iac)
|
|
--delegate-host titan-db
|
|
|
|
Examples:
|
|
scripts/ops/cluster_power_console.sh shutdown --execute
|
|
scripts/ops/cluster_power_console.sh startup --execute --force-flux-branch main
|
|
scripts/ops/cluster_power_console.sh --delegate-host titan-24 shutdown --execute
|
|
USAGE
|
|
}
|
|
|
|
if [[ -d "${HOME}/Development/ananke" ]]; then
|
|
REPO_DIR="${HOME}/Development/ananke"
|
|
else
|
|
REPO_DIR="${HOME}/Development/titan-iac"
|
|
fi
|
|
DELEGATE_HOST="titan-db"
|
|
REMOTE_REPO_DIR="${ANANKE_REMOTE_REPO_DIR:-}"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--repo-dir)
|
|
REPO_DIR="${2:-}"
|
|
shift 2
|
|
;;
|
|
--delegate-host)
|
|
DELEGATE_HOST="${2:-}"
|
|
shift 2
|
|
;;
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
*)
|
|
break
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
SIBLING_SCRIPT="${SCRIPT_DIR}/cluster_power_recovery.sh"
|
|
REPO_SCRIPT="${REPO_DIR}/scripts/ops/cluster_power_recovery.sh"
|
|
LOCAL_SCRIPT=""
|
|
|
|
if [[ -x "${SIBLING_SCRIPT}" ]]; then
|
|
LOCAL_SCRIPT="${SIBLING_SCRIPT}"
|
|
elif [[ -x "${REPO_SCRIPT}" ]]; then
|
|
LOCAL_SCRIPT="${REPO_SCRIPT}"
|
|
fi
|
|
|
|
if [[ -n "${LOCAL_SCRIPT}" ]] && command -v kubectl >/dev/null 2>&1; then
|
|
exec "${LOCAL_SCRIPT}" "$@"
|
|
fi
|
|
|
|
if [[ -z "${DELEGATE_HOST}" ]]; then
|
|
echo "cluster-power-console: no usable local recovery script found and no delegate host configured" >&2
|
|
exit 1
|
|
fi
|
|
|
|
quoted_args="$(printf '%q ' "$@")"
|
|
quoted_repo_dir="$(printf '%q' "${REPO_DIR}")"
|
|
|
|
remote_cmd=""
|
|
if [[ -n "${REMOTE_REPO_DIR}" ]]; then
|
|
remote_cmd+="ANANKE_REPO_DIR=$(printf '%q' "${REMOTE_REPO_DIR}") "
|
|
fi
|
|
remote_cmd+="if [ -x ~/ananke-tools/cluster_power_recovery.sh ]; then ~/ananke-tools/cluster_power_recovery.sh ${quoted_args}; elif [ -x ${quoted_repo_dir}/scripts/ops/cluster_power_recovery.sh ]; then ${quoted_repo_dir}/scripts/ops/cluster_power_recovery.sh ${quoted_args}; elif [ -x ${quoted_repo_dir}/scripts/cluster_power_recovery.sh ]; then ${quoted_repo_dir}/scripts/cluster_power_recovery.sh ${quoted_args}; else echo 'cluster-power-console: remote recovery script not found' >&2; exit 1; fi"
|
|
|
|
exec ssh -o BatchMode=yes -o ConnectTimeout=8 "${DELEGATE_HOST}" "${remote_cmd}"
|