Guard Prometheus data deletion workflow
This commit is contained in:
parent
4561dd9788
commit
c526b57f30
21
jeannie
21
jeannie
|
|
@ -497,9 +497,26 @@ run_tofu_plan_stack() {
|
|||
move_prometheus_stack_workers() {
|
||||
local stack="bootstrap/platform"
|
||||
local namespace="${LAB_MONITORING_NAMESPACE:-monitoring}"
|
||||
local auto_approve="${LAB_AUTO_APPROVE:-true}"
|
||||
local -a approve_args=()
|
||||
|
||||
require_debian_server "move-prometheus-stack-workers"
|
||||
|
||||
if [[ "${LAB_CONFIRM_DELETE_PROMETHEUS_DATA:-}" != "true" ]]; then
|
||||
cat >&2 <<'EOF'
|
||||
move-prometheus-stack-workers deletes existing prometheus-stack PVC/PV data.
|
||||
Rerun with LAB_CONFIRM_DELETE_PROMETHEUS_DATA=true when that data loss is intended.
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if truthy "${auto_approve}"; then
|
||||
approve_args+=("-auto-approve")
|
||||
elif ! disabled_value "${auto_approve}"; then
|
||||
echo "LAB_AUTO_APPROVE must be true or false." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export TF_VAR_kubeconfig_path="${TF_VAR_kubeconfig_path:-${KUBECONFIG_PATH}}"
|
||||
export KUBECONFIG="${TF_VAR_kubeconfig_path}"
|
||||
|
||||
|
|
@ -507,9 +524,9 @@ move_prometheus_stack_workers() {
|
|||
ensure_homelab_node_labels
|
||||
tofu -chdir="${REPO_ROOT}/${stack}" init
|
||||
adopt_platform_existing_resources
|
||||
tofu -chdir="${REPO_ROOT}/${stack}" destroy -target=helm_release.prometheus_stack -auto-approve
|
||||
tofu -chdir="${REPO_ROOT}/${stack}" destroy -target=helm_release.prometheus_stack "${approve_args[@]}"
|
||||
delete_prometheus_stack_storage "${namespace}"
|
||||
tofu -chdir="${REPO_ROOT}/${stack}" apply -auto-approve
|
||||
tofu -chdir="${REPO_ROOT}/${stack}" apply "${approve_args[@]}"
|
||||
kubectl --kubeconfig "${KUBECONFIG_PATH}" -n "${namespace}" get pods -o wide
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue