forked from redhat-appstudio/infra-deployments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdestroy-cluster.sh
executable file
·57 lines (45 loc) · 1.81 KB
/
destroy-cluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/..
TOOLCHAIN_E2E_TEMP_DIR=/tmp/toolchain-e2e
# Remove resources in the reverse order from bootstrapping
ARGO_CD_ROUTE=$(kubectl get \
-n openshift-gitops \
-o template \
--template={{.spec.host}} \
route/openshift-gitops-server \
)
ARGO_CD_URL="https://$ARGO_CD_ROUTE"
# there is an issue with deletion of chains-pods
function wait_and_delete_chains {
sleep 10
kubectl delete pod -n openshift-pipelines -l app=tekton-chains-controller
}
wait_and_delete_chains &
echo
echo "Starting with removing application, you can see progress $ARGO_CD_URL"
echo "If there is running Sync then cancel it manually"
echo "Remove Argo CD Applications:"
kubectl delete -f $ROOT/argo-cd-apps/app-of-apps/all-applications-staging.yaml
#kubectl -k $ROOT/argo-cd-apps/overlays/staging
echo
echo "Remove RBAC for OpenShift GitOps:"
kubectl delete -k $ROOT/openshift-gitops/base/cluster-rbac
echo
echo "Remove the OpenShift GitOps operator subscription:"
kubectl delete -f $ROOT/openshift-gitops/overlays/production-and-dev/subscription-openshift-gitops.yaml
echo
echo "Removing operators and operands:"
oc delete clusterserviceversions.operators.coreos.com --all -n openshift-operators
echo
echo "Removing custom projects"
oc delete project enterprise-contract-service gitops quality-dashboard internal-services application-api
echo
echo "Removing dev-sso"
oc delete project dev-sso || :
echo
echo "Remove Toolchain (Sandbox) Operators with the user data:"
rm -rf ${TOOLCHAIN_E2E_TEMP_DIR} 2>/dev/null || true
git clone --depth=1 https://github.com/codeready-toolchain/toolchain-e2e.git ${TOOLCHAIN_E2E_TEMP_DIR}
make -C ${TOOLCHAIN_E2E_TEMP_DIR} appstudio-cleanup
echo
echo "Complete."