Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion workflows/cloudscale/decommission-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ spells:
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)
Expand Down Expand Up @@ -195,7 +200,10 @@ spells:
"-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
Expand Down
1 change: 1 addition & 0 deletions workflows/exoscale-decommission.workflow
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Then I confirm cluster deletion
Then I disable the OpsGenie heartbeat
And I disable Project Syn
And I delete all Load Balancer services
And I delete all persistent volumes
Then I save the loadbalancer metadata
And I downtime the loadbalancers in icinga
And I decommission Terraform resources
Expand Down
10 changes: 9 additions & 1 deletion workflows/exoscale/decommission-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ spells:
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)
Expand Down Expand Up @@ -165,7 +170,10 @@ spells:
"-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
Expand Down
20 changes: 7 additions & 13 deletions workflows/shared/decommission-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ spells:

Usually of the form `<CLUSTER_ID>.<BASE_DOMAIN>`
- name: passbolt_passphrase
type: local-sensitive
description: |-
Your password for Passbolt.

Expand Down Expand Up @@ -90,7 +91,7 @@ spells:
kubectl delete machineautoscaler -A --all
- match: And I delete all persistent volumes
description: |-
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.
inputs:
Expand Down Expand Up @@ -154,20 +155,13 @@ spells:
inputs:
- name: lb_fqdn_1
- name: lb_fqdn_2
- name: control_vshn_api_token
run: |
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."

- match: And I decommission the LoadBalancers
description: |-
Expand Down
Loading