mirror of
https://github.com/dredx/prole.git
synced 2026-09-24 13:54:32 +00:00
feat(scripts): add create, delete, and recreate actions for CloudNative-PG initialization
- Introduced new script commands to manage CloudNative-PG clusters (`create`, `delete`, `recreate`). - Updated default namespace to `prole` and refined variable handling for cluster name. - Adjusted kustomization.yaml to reference `prole-db.yaml` for consistency in manifests.
This commit is contained in:
parent
940a48a237
commit
528e362d95
@ -43,8 +43,8 @@ if [[ -z "${PROLE_SERVICE:-}" ]]; then
|
||||
fi
|
||||
|
||||
ACTION=${1:-}
|
||||
NAMESPACE=${NAMESPACE:-default}
|
||||
CNPG_CLUSTER_NAME=${CNPG_CLUSTER_NAME:-prole-db}
|
||||
CNPG_CLUSTER_NAME=${2:-${CNPG_CLUSTER_NAME:-prole-db}}
|
||||
NAMESPACE=${NAMESPACE:-prole}
|
||||
OPENBAO_NAME=${OPENBAO_NAME:-openbao}
|
||||
REALM=${REALM:-PROLE.ORG}
|
||||
DOMAIN=${DOMAIN:-prole.org}
|
||||
@ -214,6 +214,27 @@ update_reload() {
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
recreate)
|
||||
ensure_tools
|
||||
"$0" delete "$CNPG_CLUSTER_NAME"
|
||||
"$0" create "$CNPG_CLUSTER_NAME"
|
||||
;;
|
||||
create)
|
||||
ensure_tools
|
||||
echo "Installing CloudNative-PG operator ..."
|
||||
kubectl apply --server-side -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.27/releases/cnpg-1.27.0.yaml
|
||||
|
||||
echo "Creating CloudNative-PG cluster and resources for '$CNPG_CLUSTER_NAME' ..."
|
||||
kubectl apply -k "$SCRIPT_DIR/../k8s/prole"
|
||||
|
||||
echo "Initializing and patching cluster ..."
|
||||
initialize
|
||||
;;
|
||||
delete)
|
||||
ensure_tools
|
||||
echo "Deleting all resources for '$CNPG_CLUSTER_NAME' ..."
|
||||
kubectl delete -k "$SCRIPT_DIR/../k8s/prole" --ignore-not-found
|
||||
;;
|
||||
start)
|
||||
ensure_tools
|
||||
if [[ ! -f "$CNPG_MANIFEST" ]]; then
|
||||
@ -260,7 +281,7 @@ case "$ACTION" in
|
||||
update_reload
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart|initialize|update|reload}" >&2
|
||||
echo "Usage: $0 {create|delete|recreate|start|stop|status|restart|initialize|update|reload} [dbname]" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -5,7 +5,7 @@ namespace: prole
|
||||
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- ../../cloudnative-pg-prole-dB.yaml
|
||||
- prole-db.yaml
|
||||
- prole-configmap.yaml
|
||||
- prole-deployment.yaml
|
||||
- prole-service.yaml
|
||||
|
||||
Loading…
Reference in New Issue
Block a user