mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
71 lines
1.6 KiB
Bash
Executable File
71 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
# init_common_core.sh
|
|
# Launch wrapper that runs all common core services (OpenBao, OpenTofu, Garage, ArgoCD)
|
|
# with a unified interface.
|
|
|
|
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$SCRIPT_DIR/common_core_lib.sh"
|
|
|
|
common_core_preparse_config "$@"
|
|
|
|
# shellcheck disable=SC1090
|
|
source "$SCRIPT_DIR/knoe_cfg.sh"
|
|
|
|
set -- "${COMMON_CORE_ARGS[@]}"
|
|
common_core_parse_args "$@"
|
|
|
|
if [[ "${COMMON_CORE_HELP:-0}" == 1 ]]; then
|
|
common_core_usage "$0"
|
|
exit 0
|
|
fi
|
|
|
|
if [[ -n "${COMMON_CORE_PARSE_ERROR:-}" ]]; then
|
|
echo "ERROR: ${COMMON_CORE_PARSE_ERROR}" >&2
|
|
common_core_usage "$0"
|
|
exit 2
|
|
fi
|
|
|
|
ACTION="$COMMON_CORE_ACTION"
|
|
|
|
TARGET_NAMESPACE="$(common_core_resolve_namespace "default")"
|
|
common_core_apply_namespace "$TARGET_NAMESPACE"
|
|
|
|
# Forwarded option bundles for child scripts
|
|
NS_ARGS=("-n" "$TARGET_NAMESPACE")
|
|
if [[ -n "${COMMON_CORE_NAMESPACE:-}" ]]; then
|
|
NS_ARGS=("-n" "$COMMON_CORE_NAMESPACE")
|
|
fi
|
|
MODE_ARGS=()
|
|
if [[ -n "${KNOE_MODE:-}" ]]; then
|
|
MODE_ARGS=("--mode" "$KNOE_MODE")
|
|
fi
|
|
CFG_ARGS=()
|
|
if [[ -n "${COMMON_CORE_CONFIG_PATH:-}" ]]; then
|
|
CFG_ARGS=("-c" "$COMMON_CORE_CONFIG_PATH")
|
|
fi
|
|
|
|
COMPONENTS=(
|
|
"openbao"
|
|
"opentofu"
|
|
"garage_store"
|
|
"argocd"
|
|
)
|
|
|
|
for comp in "${COMPONENTS[@]}"; do
|
|
script="$SCRIPT_DIR/init_${comp}.sh"
|
|
if [[ ! -x "$script" ]]; then
|
|
echo "WARN: missing script $script; skipping." >&2
|
|
continue
|
|
fi
|
|
echo ">>> init_${comp}.sh ${ACTION} (namespace=${NS_ARGS[1]})"
|
|
if ! "$script" "$ACTION" "${NS_ARGS[@]}" "${MODE_ARGS[@]}" "${CFG_ARGS[@]}"; then
|
|
echo "ERROR: init_${comp}.sh ${ACTION} failed" >&2
|
|
exit 1
|
|
fi
|
|
done
|