Cluster zones#
Prerequisites#
Inputs#
export GIT_PATH="${HOME}/git/"
export ZONE_NAME="kub-..."
export ENVS_NG="${GIT_PATH}/caascad/terraform/envs-ng"
1 - Requirements#
Before destroying the cluster zone ensure all service zones on it have destroyed or migrated.
2 - Destroy the contract and service zones related to the cluster#
The zones are named svc-${ZONE_NAME} and obs-${ZONE_NAME}. All other service and contract zones should already have been removed at the previous step.
# Service zone svc-<cluster>
trackbone destroy -t purge=true -z "svc-${ZONE_NAME}" --non-interactive --detailed-exitcode -n 8 --add-services
# Contract zone obs-<cluster>
trackbone destroy -t purge=true -z "obs-${ZONE_NAME}" --non-interactive --detailed-exitcode -n 8
3 - Destroy the cluster zone#
Get the zone line abbreviation
cd "${ENVS_NG}/zones/ngot_zones"
LINE=$(cue export | jq --arg ZONE_NAME "${ZONE_NAME}" -r '.zones[$ZONE_NAME].metadata.line')
LINE_ABBR=$(cue export | jq --arg LINE "${LINE}" -r '.lines[$LINE].abbr')
cd "${ENVS_NG}/contexts/ngot"
trackbone destroy -z ${ZONE_NAME} -t purge=true --non-interactive --add-services
4 - Remove zone in zone module (envs-ng)#
Simply remove the cluster corresponding line in clusters.cue:
cd "${ENVS_NG}/zones/ngot_zones"
vi clusters.cue
"kub-10000": type: "cluster" // to delete
"kub-10000": az_list: ["a", "c"] // to delete
Create a MR:
git switch -c "decom ${ZONE_NAME}"
# Run script to generate static files from zones
generate-static-zones-files
cd ${ENVS_NG}
# Add all modifications to the commit
git add zones/
git add gen/
git commit -m "Decom ${ZONE_NAME} zone"
# Create target branch
git push -u origin "${ZONE_NAME}"
Do not forget to merge the merge request.
5 - Redeploy central components#
The following commands should be run from a branch where the cluster has been removed. Ideally, the MR above should have been merged and these commands should be run from master branch.
cd "${ENVS_NG}/contexts/ngot"
trackbone apply --non-interactive --add-services \
-z svc-monitoring-stack-corp-"${LINE_ABBR}"-1 \
-z svc-monitoring-stack-corp-"${LINE_ABBR}"-2 \
-c federate-metrics-mom-scrapeconfig \
-c prometheus-rules
6 - Update drifts pipeline#
Follow this page to update the list of configuration's zones and update concourse pipelines