From af29b8120971a7f8b3eab9e9cc4606d1791498f5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 31 Jul 2026 08:37:10 +0000 Subject: [PATCH] Update install instructions from guided-setup --- .../guided-setup/cloudscale-decommission.adoc | 30 ++-- .../guided-setup/exoscale-decommission.adoc | 129 ++++++++++++------ 2 files changed, 105 insertions(+), 54 deletions(-) diff --git a/docs/modules/ROOT/partials/guided-setup/cloudscale-decommission.adoc b/docs/modules/ROOT/partials/guided-setup/cloudscale-decommission.adoc index 0e296d26..ba31dc88 100644 --- a/docs/modules/ROOT/partials/guided-setup/cloudscale-decommission.adoc +++ b/docs/modules/ROOT/partials/guided-setup/cloudscale-decommission.adoc @@ -533,7 +533,7 @@ kubectl delete machineautoscaler -A --all [[step-12]] === And I delete all persistent volumes -This step deletes all persistent volumes on the cluster, so that the corresponding Cloudscale resources can be decommissioned by the controller. +This step deletes all persistent volumes on the cluster, so that the corresponding CSP resources can be decommissioned by the controller. By cordoning all non-master nodes and deleting all their pods (except the csi driver pods) we ensure that no new PVs are created, while the existing ones can be cleaned up. Deleting all pods has the additional benefit that we don’t have to deal with PDBs when deleting the machinesets in the next step. @@ -659,6 +659,11 @@ GIT_AUTHOR_EMAIL=$(git config --global user.email) HIERADATA_REPO_TOKEN=${INPUT_gitlab_api_token} EOF +if [[ ! -d catalog ]] +then + commodore catalog compile "$INPUT_commodore_cluster_id" +fi + tf_image=$(\ yq eval ".parameters.openshift4_terraform.images.terraform.image" \ dependencies/openshift4-terraform/class/defaults.yml) @@ -838,7 +843,10 @@ terraform init \ "-backend-config=unlock_method=DELETE" \ "-backend-config=retry_wait_min=5" -terraform state rm "module.cluster.module.lb.module.hiera[0].gitfile_checkout.appuio_hieradata" +if terraform state list | grep "gitfile_checkout.appuio_hieradata" > /dev/null +then + terraform state rm "module.cluster.module.lb.module.hiera[0].gitfile_checkout.appuio_hieradata" +fi # Suppress errors on the first run; it is expected to fail terraform destroy --auto-approve || true @@ -1120,6 +1128,7 @@ In this step you need to remove the LoadBalancer servers from control.vshn.net * `lb_fqdn_1` * `lb_fqdn_2` +* `control_vshn_api_token` ==== Script @@ -1129,20 +1138,13 @@ OUTPUT=$(mktemp) # export INPUT_lb_fqdn_1= # export INPUT_lb_fqdn_2= +# export INPUT_control_vshn_api_token= set -euo pipefail -echo '###################################################################################' -echo '# #' -echo "# Please manually delete the cluster's LoadBalancer servers before proceeding. #" -echo '# #' -echo '###################################################################################' -echo -echo You can go to: -echo https://control.vshn.net/servers/definitions/appuio/${INPUT_lb_fqdn_1}/delete -echo https://control.vshn.net/servers/definitions/appuio/${INPUT_lb_fqdn_2}/delete -sleep 2 -# NOTE(aa): This step is currently annoying to automate, but once ticket PORTAL-253 is resolved, -# it should be easy. +echo "Deleting server definitions ..." +curl -XDELETE -H"$AUTH" https://control.vshn.net/api/servers/1/appuio/${INPUT_lb_fqdn_1} +curl -XDELETE -H"$AUTH" https://control.vshn.net/api/servers/1/appuio/${INPUT_lb_fqdn_2} +echo "Server definitions deleted." # echo "# Outputs" diff --git a/docs/modules/ROOT/partials/guided-setup/exoscale-decommission.adoc b/docs/modules/ROOT/partials/guided-setup/exoscale-decommission.adoc index 6cca6d36..f8568f20 100644 --- a/docs/modules/ROOT/partials/guided-setup/exoscale-decommission.adoc +++ b/docs/modules/ROOT/partials/guided-setup/exoscale-decommission.adoc @@ -10,20 +10,21 @@ * <> *   <> *   <> -*   <> -* <> -*   <> -*   <> -*   <> -*   <> -*   <> -*   <> -*   <> -*   <> -* <> -*   <> -*   <> -*   <> +*   <> +*   <> +* <> +*   <> +*   <> +*   <> +*   <> +*   <> +*   <> +*   <> +*   <> +* <> +*   <> +*   <> +*   <> [[step-1]] === Given I have all prerequisites installed @@ -503,6 +504,52 @@ echo '# Deleted Services. #' ---- [[step-11]] +=== And I delete all persistent volumes + +This step deletes all persistent volumes on the cluster, so that the corresponding CSP resources can be decommissioned by the controller. + +By cordoning all non-master nodes and deleting all their pods (except the csi driver pods) we ensure that no new PVs are created, while the existing ones can be cleaned up. Deleting all pods has the additional benefit that we don’t have to deal with PDBs when deleting the machinesets in the next step. + +==== Inputs + +* `kubeconfig_path` + +==== Script + +[source,bash] +---- +OUTPUT=$(mktemp) + +# export INPUT_kubeconfig_path= + +set -euo pipefail +export KUBECONFIG="${INPUT_kubeconfig_path}" +kubectl cordon -l node-role.kubernetes.io/worker +kubectl get po -A -oyaml | yq '.items = [.items[] | + select(.spec.nodeName | test("master-") | not) | + select(.metadata.namespace != "syn-csi-cloudscale")]' |\ + kubectl delete --wait=false -f- +kubectl delete pvc -A --all --wait=false +kubectl wait --for=delete pv --all --timeout=120s + +echo '########################################################' +echo '# #' +echo '# Please verify that all PVs were deleted properly. #' +echo '# #' +echo '########################################################' +echo +echo If the cluster still has PVs, please manually run the following: +echo " "kubectl delete pv --all +sleep 2 + + +# echo "# Outputs" +# cat "$OUTPUT" +# rm -f "$OUTPUT" + +---- + +[[step-12]] === And I prepare the cluster repository This step prepares the local cluster repository by cloning the Commodore hieradata repository @@ -582,7 +629,7 @@ commodore catalog compile ${INPUT_commodore_cluster_id} --push \ ---- -[[step-12]] +[[step-13]] === Then I save the loadbalancer metadata This step gathers metadata on the LoadBalancer instances (such as their icinga zone and backup server), such that they can be properly decommissioned down the line. @@ -639,6 +686,11 @@ GIT_AUTHOR_EMAIL=$(git config --global user.email) HIERADATA_REPO_TOKEN=${INPUT_gitlab_api_token} EOF +if [[ ! -d catalog ]] +then + commodore catalog compile "$INPUT_commodore_cluster_id" +fi + tf_image=$(\ yq eval ".parameters.openshift4_terraform.images.terraform.image" \ dependencies/openshift4-terraform/class/defaults.yml) @@ -705,7 +757,7 @@ popd ---- -[[step-13]] +[[step-14]] === And I downtime the loadbalancers in icinga In this step you have to configure downtimes in Icinga for the cluster's load balancers. @@ -744,7 +796,7 @@ sleep 2 ---- -[[step-14]] +[[step-15]] === And I decommission Terraform resources This step decommissions all Terraform resources for the cluster. @@ -824,7 +876,10 @@ terraform init \ "-backend-config=unlock_method=DELETE" \ "-backend-config=retry_wait_min=5" -terraform state rm "module.cluster.module.lb.module.hiera[0].gitfile_checkout.appuio_hieradata" +if terraform state list | grep "gitfile_checkout.appuio_hieradata" > /dev/null +then + terraform state rm "module.cluster.module.lb.module.hiera[0].gitfile_checkout.appuio_hieradata" +fi # Suppress errors on the first run; it is expected to fail terraform destroy --auto-approve || true @@ -839,7 +894,7 @@ popd ---- -[[step-15]] +[[step-16]] === And I delete all S3 buckets This step deletes the cluster's associated S3 buckets from Exoscale. @@ -878,7 +933,7 @@ exo storage rb -r -f "${INPUT_commodore_cluster_id}-logstore" || true ---- -[[step-16]] +[[step-17]] === And I delete the cluster backup This step deletes the cluster's associated backup bucket from Exoscale. @@ -990,7 +1045,7 @@ exo storage rb -r -f "${INPUT_commodore_cluster_id}-backup" || true ---- -[[step-17]] +[[step-18]] === And I delete the cluster's API tokens This step deletes the cluster's associated Exoscale API tokens from Exoscale. @@ -1031,7 +1086,7 @@ exo iam api-key delete -f "${INPUT_commodore_cluster_id}" || true ---- -[[step-18]] +[[step-19]] === And I remove the LoadBalancers from control.vshn.net In this step you need to remove the LoadBalancer servers from control.vshn.net @@ -1040,6 +1095,7 @@ In this step you need to remove the LoadBalancer servers from control.vshn.net * `lb_fqdn_1` * `lb_fqdn_2` +* `control_vshn_api_token` ==== Script @@ -1049,20 +1105,13 @@ OUTPUT=$(mktemp) # export INPUT_lb_fqdn_1= # export INPUT_lb_fqdn_2= +# export INPUT_control_vshn_api_token= set -euo pipefail -echo '###################################################################################' -echo '# #' -echo "# Please manually delete the cluster's LoadBalancer servers before proceeding. #" -echo '# #' -echo '###################################################################################' -echo -echo You can go to: -echo https://control.vshn.net/servers/definitions/appuio/${INPUT_lb_fqdn_1}/delete -echo https://control.vshn.net/servers/definitions/appuio/${INPUT_lb_fqdn_2}/delete -sleep 2 -# NOTE(aa): This step is currently annoying to automate, but once ticket PORTAL-253 is resolved, -# it should be easy. +echo "Deleting server definitions ..." +curl -XDELETE -H"$AUTH" https://control.vshn.net/api/servers/1/appuio/${INPUT_lb_fqdn_1} +curl -XDELETE -H"$AUTH" https://control.vshn.net/api/servers/1/appuio/${INPUT_lb_fqdn_2} +echo "Server definitions deleted." # echo "# Outputs" @@ -1071,7 +1120,7 @@ sleep 2 ---- -[[step-19]] +[[step-20]] === And I decommission the LoadBalancers This step decommissions resources associated with the Puppet managed LoadBalancers. @@ -1195,7 +1244,7 @@ echo "# Deleted backups from Burp server. #" ---- -[[step-20]] +[[step-21]] === And I remove the cluster's DNS entries In this step, you must manually remove any DNS entries associated with the cluster from https://git.vshn.net/vshn/vshn_zonefiles. @@ -1222,7 +1271,7 @@ sleep 2 ---- -[[step-21]] +[[step-22]] === Then I delete the cluster's Vault secrets This step cleans up all the cluster's Vault secrets. @@ -1294,7 +1343,7 @@ done ---- -[[step-22]] +[[step-23]] === And I delete the cluster's OpsGenie heartbeat This step deletes the cluster's OpsGenie heartbeat. @@ -1333,7 +1382,7 @@ curl "https://api.opsgenie.com/v2/heartbeats/${INPUT_commodore_cluster_id}" \ ---- -[[step-23]] +[[step-24]] === And I delete the cluster from Lieutenant This step deletes the cluster from Lieutenant @@ -1365,7 +1414,7 @@ curl -H "Authorization: Bearer $(commodore fetch-token)" -XDELETE \ ---- -[[step-24]] +[[step-25]] === And I delete the Keycloak service This step deletes the cluster's keycloak service from control.vshn.net