Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ This is required to access the encrypted emergency credentials.


* `commodore_cluster_id`
* `commodore_api_url`

==== Outputs

Expand All @@ -332,12 +333,13 @@ OUTPUT=$(mktemp)

# export INPUT_passbolt_passphrase=
# export INPUT_commodore_cluster_id=
# export INPUT_commodore_api_url=

set -euo pipefail
export KHARON_PASSBOLT_PASSPHRASE="${INPUT_passbolt_passphrase}"
export KUBECONFIG="em-${INPUT_commodore_cluster_id}"
kharon update
kharon emergency-credentials "${INPUT_commodore_cluster_id}"
kharon update --lieutenant-url "${INPUT_commodore_api_url}" --inventory-file kharon-inventory.json
kharon emergency-credentials "${INPUT_commodore_cluster_id}" --inventory-file kharon-inventory.json

kubectl get nodes

Expand Down
143 changes: 110 additions & 33 deletions docs/modules/ROOT/partials/guided-setup/exoscale-decommission.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
* <<step-8,Then I disable the OpsGenie heartbeat>>
* &nbsp;&nbsp;<<step-9,And I disable Project Syn>>
* &nbsp;&nbsp;<<step-10,And I delete all Load Balancer services>>
* <<step-11,Then I save the loadbalancer metadata>>
* &nbsp;&nbsp;<<step-12,And I downtime the loadbalancers in icinga>>
* &nbsp;&nbsp;<<step-13,And I decommission Terraform resources>>
* &nbsp;&nbsp;<<step-14,And I delete all S3 buckets>>
* &nbsp;&nbsp;<<step-15,And I delete the cluster backup>>
* &nbsp;&nbsp;<<step-16,And I delete the cluster's API tokens>>
* &nbsp;&nbsp;<<step-17,And I remove the LoadBalancers from control.vshn.net>>
* &nbsp;&nbsp;<<step-18,And I decommission the LoadBalancers>>
* &nbsp;&nbsp;<<step-19,And I remove the cluster's DNS entries>>
* <<step-20,Then I delete the cluster's Vault secrets>>
* &nbsp;&nbsp;<<step-21,And I delete the cluster's OpsGenie heartbeat>>
* &nbsp;&nbsp;<<step-22,And I delete the cluster from Lieutenant>>
* &nbsp;&nbsp;<<step-23,And I delete the Keycloak service>>
* &nbsp;&nbsp;<<step-11,And I prepare the cluster repository>>
* <<step-12,Then I save the loadbalancer metadata>>
* &nbsp;&nbsp;<<step-13,And I downtime the loadbalancers in icinga>>
* &nbsp;&nbsp;<<step-14,And I decommission Terraform resources>>
* &nbsp;&nbsp;<<step-15,And I delete all S3 buckets>>
* &nbsp;&nbsp;<<step-16,And I delete the cluster backup>>
* &nbsp;&nbsp;<<step-17,And I delete the cluster's API tokens>>
* &nbsp;&nbsp;<<step-18,And I remove the LoadBalancers from control.vshn.net>>
* &nbsp;&nbsp;<<step-19,And I decommission the LoadBalancers>>
* &nbsp;&nbsp;<<step-20,And I remove the cluster's DNS entries>>
* <<step-21,Then I delete the cluster's Vault secrets>>
* &nbsp;&nbsp;<<step-22,And I delete the cluster's OpsGenie heartbeat>>
* &nbsp;&nbsp;<<step-23,And I delete the cluster from Lieutenant>>
* &nbsp;&nbsp;<<step-24,And I delete the Keycloak service>>

[[step-1]]
=== Given I have all prerequisites installed
Expand Down Expand Up @@ -324,6 +325,7 @@ This is required to access the encrypted emergency credentials.


* `commodore_cluster_id`
* `commodore_api_url`

==== Outputs

Expand All @@ -337,12 +339,13 @@ OUTPUT=$(mktemp)

# export INPUT_passbolt_passphrase=
# export INPUT_commodore_cluster_id=
# export INPUT_commodore_api_url=

set -euo pipefail
export KHARON_PASSBOLT_PASSPHRASE="${INPUT_passbolt_passphrase}"
export KUBECONFIG="em-${INPUT_commodore_cluster_id}"
kharon update
kharon emergency-credentials "${INPUT_commodore_cluster_id}"
kharon update --lieutenant-url "${INPUT_commodore_api_url}" --inventory-file kharon-inventory.json
kharon emergency-credentials "${INPUT_commodore_cluster_id}" --inventory-file kharon-inventory.json

kubectl get nodes

Expand Down Expand Up @@ -500,6 +503,86 @@ echo '# Deleted Services. #'
----

[[step-11]]
=== And I prepare the cluster repository

This step prepares the local cluster repository by cloning the Commodore hieradata repository
and setting up the necessary configuration for the specified cluster.

==== Inputs

* `commodore_api_url`
* `commodore_cluster_id`
* `commodore_tenant_id`
* `cluster_domain`
* `image_major`
* `image_minor`

==== Script

[source,bash]
----
OUTPUT=$(mktemp)

# export INPUT_commodore_api_url=
# export INPUT_commodore_cluster_id=
# export INPUT_commodore_tenant_id=
# export INPUT_cluster_domain=
# export INPUT_image_major=
# export INPUT_image_minor=

set -euo pipefail

export COMMODORE_API_URL="${INPUT_commodore_api_url}"

rm -rf inventory/classes/
mkdir -p inventory/classes/
git clone "$(curl -sH"Authorization: Bearer $(commodore fetch-token)" "${INPUT_commodore_api_url}/tenants/${INPUT_commodore_tenant_id}" | jq -r '.gitRepo.url')" inventory/classes/${INPUT_commodore_tenant_id}

pushd "inventory/classes/${INPUT_commodore_tenant_id}/"

yq eval -i ".parameters.openshift.baseDomain = \"${INPUT_cluster_domain}\"" \
${INPUT_commodore_cluster_id}.yml

git diff --exit-code --quiet || git commit -a -m "Configure cluster domain for ${INPUT_commodore_cluster_id}"

if ls openshift4.y*ml 1>/dev/null 2>&1; then
yq eval -i '.classes += ".openshift4"' ${INPUT_commodore_cluster_id}.yml;
git diff --exit-code --quiet || git commit -a -m "Include openshift4 class for ${INPUT_commodore_cluster_id}"
fi

yq eval -i '.applications += ["exoscale-cloud-controller-manager"]' ${INPUT_commodore_cluster_id}.yml
yq eval -i '.applications = (.applications | unique)' ${INPUT_commodore_cluster_id}.yml
git diff --exit-code --quiet || git commit -a -m "Deploy Exoscale cloud-controller-manager on ${INPUT_commodore_cluster_id}"


yq eval -i '.applications += ["cilium"]' ${INPUT_commodore_cluster_id}.yml
yq eval -i '.applications = (.applications | unique)' ${INPUT_commodore_cluster_id}.yml

yq eval -i '.parameters.openshift.infraID = "TO_BE_DEFINED"' ${INPUT_commodore_cluster_id}.yml
yq eval -i '.parameters.openshift.clusterID = "TO_BE_DEFINED"' ${INPUT_commodore_cluster_id}.yml

yq eval -i '.parameters.cilium.olm.generate_olm_deployment = true' ${INPUT_commodore_cluster_id}.yml

git diff --exit-code --quiet || git commit -a -m "Add Cilium addon to ${INPUT_commodore_cluster_id}"

git push

popd

commodore catalog compile ${INPUT_commodore_cluster_id} --push \
--dynamic-fact kubernetesVersion.major=1 \
--dynamic-fact kubernetesVersion.minor="$((INPUT_image_minor+13))" \
--dynamic-fact openshiftVersion.Major=${INPUT_image_major} \
--dynamic-fact openshiftVersion.Minor=${INPUT_image_minor}


# echo "# Outputs"
# cat "$OUTPUT"
# rm -f "$OUTPUT"

----

[[step-12]]
=== 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.
Expand All @@ -513,7 +596,6 @@ This step gathers metadata on the LoadBalancer instances (such as their icinga z
* `gitlab_api_token`
* `commodore_cluster_id`
* `commodore_api_url`
* `rhcos_template`
* `csp_region`

==== Outputs
Expand All @@ -538,7 +620,6 @@ OUTPUT=$(mktemp)
# export INPUT_gitlab_api_token=
# export INPUT_commodore_cluster_id=
# export INPUT_commodore_api_url=
# export INPUT_rhcos_template=
# export INPUT_csp_region=

set -euo pipefail
Expand All @@ -553,7 +634,6 @@ EXOSCALE_API_KEY=${INPUT_exoscale_key}
EXOSCALE_API_SECRET=${INPUT_exoscale_secret}
TF_VAR_control_vshn_net_token=${INPUT_control_vshn_api_token}
TF_VAR_region=${INPUT_csp_region}
TF_VAR_rhcos_template=${INPUT_rhcos_template}
GIT_AUTHOR_NAME=$(git config --global user.name)
GIT_AUTHOR_EMAIL=$(git config --global user.email)
HIERADATA_REPO_TOKEN=${INPUT_gitlab_api_token}
Expand Down Expand Up @@ -625,7 +705,7 @@ popd

----

[[step-12]]
[[step-13]]
=== And I downtime the loadbalancers in icinga

In this step you have to configure downtimes in Icinga for the cluster's load balancers.
Expand Down Expand Up @@ -664,7 +744,7 @@ sleep 2

----

[[step-13]]
[[step-14]]
=== And I decommission Terraform resources

This step decommissions all Terraform resources for the cluster.
Expand All @@ -678,7 +758,6 @@ This step decommissions all Terraform resources for the cluster.
* `gitlab_api_token`
* `commodore_cluster_id`
* `commodore_api_url`
* `rhcos_template`
* `csp_region`

==== Script
Expand All @@ -694,7 +773,6 @@ OUTPUT=$(mktemp)
# export INPUT_gitlab_api_token=
# export INPUT_commodore_cluster_id=
# export INPUT_commodore_api_url=
# export INPUT_rhcos_template=
# export INPUT_csp_region=

set -euo pipefail
Expand All @@ -709,7 +787,6 @@ EXOSCALE_API_KEY=${INPUT_exoscale_key}
EXOSCALE_API_SECRET=${INPUT_exoscale_secret}
TF_VAR_control_vshn_net_token=${INPUT_control_vshn_api_token}
TF_VAR_region=${INPUT_csp_region}
TF_VAR_rhcos_template=${INPUT_rhcos_template}
GIT_AUTHOR_NAME=$(git config --global user.name)
GIT_AUTHOR_EMAIL=$(git config --global user.email)
HIERADATA_REPO_TOKEN=${INPUT_gitlab_api_token}
Expand Down Expand Up @@ -762,7 +839,7 @@ popd

----

[[step-14]]
[[step-15]]
=== And I delete all S3 buckets

This step deletes the cluster's associated S3 buckets from Exoscale.
Expand Down Expand Up @@ -801,7 +878,7 @@ exo storage rb -r -f "${INPUT_commodore_cluster_id}-logstore" || true

----

[[step-15]]
[[step-16]]
=== And I delete the cluster backup

This step deletes the cluster's associated backup bucket from Exoscale.
Expand Down Expand Up @@ -913,7 +990,7 @@ exo storage rb -r -f "${INPUT_commodore_cluster_id}-backup" || true

----

[[step-16]]
[[step-17]]
=== And I delete the cluster's API tokens

This step deletes the cluster's associated Exoscale API tokens from Exoscale.
Expand Down Expand Up @@ -954,7 +1031,7 @@ exo iam api-key delete -f "${INPUT_commodore_cluster_id}" || true

----

[[step-17]]
[[step-18]]
=== And I remove the LoadBalancers from control.vshn.net

In this step you need to remove the LoadBalancer servers from control.vshn.net
Expand Down Expand Up @@ -994,7 +1071,7 @@ sleep 2

----

[[step-18]]
[[step-19]]
=== And I decommission the LoadBalancers

This step decommissions resources associated with the Puppet managed LoadBalancers.
Expand Down Expand Up @@ -1118,7 +1195,7 @@ echo "# Deleted backups from Burp server. #"

----

[[step-19]]
[[step-20]]
=== 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.
Expand All @@ -1145,7 +1222,7 @@ sleep 2

----

[[step-20]]
[[step-21]]
=== Then I delete the cluster's Vault secrets

This step cleans up all the cluster's Vault secrets.
Expand Down Expand Up @@ -1217,7 +1294,7 @@ done

----

[[step-21]]
[[step-22]]
=== And I delete the cluster's OpsGenie heartbeat

This step deletes the cluster's OpsGenie heartbeat.
Expand Down Expand Up @@ -1256,7 +1333,7 @@ curl "https://api.opsgenie.com/v2/heartbeats/${INPUT_commodore_cluster_id}" \

----

[[step-22]]
[[step-23]]
=== And I delete the cluster from Lieutenant

This step deletes the cluster from Lieutenant
Expand Down Expand Up @@ -1288,7 +1365,7 @@ curl -H "Authorization: Bearer $(commodore fetch-token)" -XDELETE \

----

[[step-23]]
[[step-24]]
=== And I delete the Keycloak service

This step deletes the cluster's keycloak service from control.vshn.net
Expand Down