mirror of
https://github.com/dredx/prole.git
synced 2026-09-23 12:03:59 +00:00
Summary: Removed the prole-db-manager microservice and simplified deployment to use prole-authority as the internal management and authorization point. Fixed two blocking bugs that prevented silent install from completing on knoe-dev-cluster. Removed: prole-db-manager - Deleted db-manager-deployment.yaml and db-manager-service.yaml from opentofu manifests - Deleted src/db-manager/ (Dockerfile, server.js, package.json, tests) - Removed prole-db-manager port-forward mapping from installer/core/env.py - Removed init_db_manager.sh from Initialization Scripts (milestones.py, actions.py) - Removed init_certmgr.sh and init_db_manager.sh tabs from services screen (services.py) - Removed live k8s Deployment/Service from knoe-dev-cluster Fixed: PostgreSQL version downgrade error (pg17 -> pg18) - Created conf/postgresql/.version with value 18 - Updated k8s/prole/prole-db.yaml and prole-db-recovery.yaml.tpl imageName to prole-db:18-089 - Fixed _init_database_options_state() to restore saved version_type from prole.cfg so db_version_type defaults to v18 (pg18) instead of silently reverting to pg17 - Added database_options.* keys to _collect_input_snapshot() in cfg.py so distribution, version_type, and all extension toggles persist to prole.cfg Fixed: Cluster name inconsistency - Removed stale prole-dev-cluster references; all scripts now use knoe-dev-cluster - Added knoe-dev-cluster to mode-detection case in etc/prole_cfg.sh Config: conf/prole.cfg - Set kerberos_config.enabled = False, KERBEROS_AUTO_ENABLED = False - Added database_options.distribution = percona, version_type = v18 - Added all 13 extension flags set to True (postgis, pgvector, pgcrypto, pgaudit, pg_repack, pg_stat_statements, pg_buffercache, pg_freespacemap, pgrowlocks, postgres_fdw, dblink, pg_stat_monitor, pgbadger) Verification: ./install.py -s -l -v -c conf/prole.cfg completed successfully. CNPG deployed prole-db:18-089 to knoe-dev-cluster; all milestones passed. Co-authored-by: Junie <junie@jetbrains.com>
133 lines
3.6 KiB
Bash
133 lines
3.6 KiB
Bash
#!/usr/bin/env bash
|
|
# Shared helpers for common core init scripts (ArgoCD, OpenBao, OpenTofu, Garage).
|
|
# Responsibilities:
|
|
# - handle [-c|--config] early so prole_cfg.sh loads the right prole.cfg
|
|
# - parse standard actions/options
|
|
# - resolve and apply namespaces consistently
|
|
|
|
# Actions supported by all common core scripts
|
|
COMMON_CORE_ACTIONS="start|stop|status|restart|initialize|update|reload"
|
|
|
|
# Parse -c/--config before loading prole_cfg.sh so PROLE_CONF is set in time.
|
|
# Sets:
|
|
# COMMON_CORE_CONFIG_PATH - path to prole.cfg (if provided)
|
|
# COMMON_CORE_ARGS - original arguments minus -c/--config
|
|
common_core_preparse_config() {
|
|
COMMON_CORE_CONFIG_PATH=""
|
|
COMMON_CORE_ARGS=()
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-c|--config)
|
|
shift
|
|
if [[ -z "${1:-}" ]]; then
|
|
echo "ERROR: -c/--config requires a file path" >&2
|
|
exit 2
|
|
fi
|
|
COMMON_CORE_CONFIG_PATH="$1"
|
|
;;
|
|
-c=*|--config=*)
|
|
COMMON_CORE_CONFIG_PATH="${1#*=}"
|
|
;;
|
|
*)
|
|
COMMON_CORE_ARGS+=("$1")
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ -n "$COMMON_CORE_CONFIG_PATH" ]]; then
|
|
if [[ ! -f "$COMMON_CORE_CONFIG_PATH" ]]; then
|
|
echo "ERROR: config file not found: $COMMON_CORE_CONFIG_PATH" >&2
|
|
exit 2
|
|
fi
|
|
local cfg_dir
|
|
cfg_dir=$(cd "$(dirname "$COMMON_CORE_CONFIG_PATH")" && pwd)
|
|
PROLE_CONF="$cfg_dir"
|
|
export PROLE_CONF
|
|
fi
|
|
}
|
|
|
|
# Parse standard options and action.
|
|
# Sets (always):
|
|
# COMMON_CORE_ACTION
|
|
# COMMON_CORE_NAMESPACE
|
|
# COMMON_CORE_HELP (0/1)
|
|
# COMMON_CORE_PARSE_ERROR (empty or message)
|
|
common_core_parse_args() {
|
|
COMMON_CORE_ACTION=""
|
|
COMMON_CORE_NAMESPACE=""
|
|
COMMON_CORE_HELP=0
|
|
COMMON_CORE_PARSE_ERROR=""
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
-m|--mode)
|
|
shift
|
|
prole_set_mode "${1:-}"
|
|
;;
|
|
-m=*|--mode=*)
|
|
prole_set_mode "${1#*=}"
|
|
;;
|
|
-n|--namespace)
|
|
shift
|
|
if [[ -z "${1:-}" ]]; then
|
|
COMMON_CORE_PARSE_ERROR="--namespace requires a value"
|
|
break
|
|
fi
|
|
COMMON_CORE_NAMESPACE="$1"
|
|
;;
|
|
-n=*|--namespace=*)
|
|
COMMON_CORE_NAMESPACE="${1#*=}"
|
|
;;
|
|
start|stop|status|restart|initialize|update|reload)
|
|
COMMON_CORE_ACTION="$1"
|
|
;;
|
|
-h|--help)
|
|
COMMON_CORE_HELP=1
|
|
;;
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
*)
|
|
if [[ -z "$COMMON_CORE_ACTION" && "$1" != -* ]]; then
|
|
COMMON_CORE_ACTION="$1"
|
|
else
|
|
COMMON_CORE_PARSE_ERROR="Unknown argument: $1"
|
|
break
|
|
fi
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ -z "$COMMON_CORE_ACTION" && "$COMMON_CORE_HELP" -eq 0 && -z "$COMMON_CORE_PARSE_ERROR" ]]; then
|
|
COMMON_CORE_PARSE_ERROR="Action is required (${COMMON_CORE_ACTIONS//|/, })"
|
|
fi
|
|
}
|
|
|
|
common_core_usage() {
|
|
local prog="${1:-$0}"
|
|
echo "Usage: ${prog##*/} [${COMMON_CORE_ACTIONS//|/|}] [-n namespace] [--mode k3d|k3s|k8s] [-c conf/prole.cfg]" >&2
|
|
}
|
|
|
|
# Resolve namespace with precedence: CLI override -> SERVICE_NAMESPACE -> NAMESPACE -> provided default
|
|
common_core_resolve_namespace() {
|
|
local default_ns="${1:-default}"
|
|
local ns="${COMMON_CORE_NAMESPACE:-}"
|
|
[[ -z "$ns" && -n "${SERVICE_NAMESPACE:-}" ]] && ns="$SERVICE_NAMESPACE"
|
|
[[ -z "$ns" && -n "${NAMESPACE:-}" ]] && ns="$NAMESPACE"
|
|
[[ -z "$ns" ]] && ns="$default_ns"
|
|
echo "$ns"
|
|
}
|
|
|
|
# Apply a resolved namespace to both NAMESPACE and SERVICE_NAMESPACE for consistency
|
|
common_core_apply_namespace() {
|
|
local ns="$1"
|
|
if [[ -n "$ns" ]]; then
|
|
NAMESPACE="$ns"
|
|
SERVICE_NAMESPACE="$ns"
|
|
export NAMESPACE SERVICE_NAMESPACE
|
|
fi
|
|
}
|