forked from rh-ecosystem-edge/ib-orchestrate-vm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acm-cleanup-on-seed.sh
executable file
·37 lines (29 loc) · 1.66 KB
/
acm-cleanup-on-seed.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
#!/bin/bash
#
# 1. Drop site-config
# Is it sufficient to delete the managedcluster from the hub? Would it potentially get reimported?
# Or do we drop everything via gitops?
# This will delete the open-cluster-management-agent and open-cluster-management-agent-addon namespaces,
# but there are other resources remaining that can also be cleaned up. In the case of the assisted-installer
# namespace and the observability feature, this includes hub-signed certs that are not supported by the
# recert tool and must be cleaned up before generating the seed image.
#
# oc --kubeconfig ${HUB_KUBECONFIG} delete managedcluster cnfde8
# 2. Clean up ACM resources remaining on seed SNO
oc delete ns assisted-installer
oc delete ClusterRole klusterlet
oc delete ClusterRole klusterlet-bootstrap-kubeconfig
oc delete ClusterRole open-cluster-management:klusterlet-admin-aggregate-clusterrole
oc delete ClusterRoleBinding klusterlet
oc delete crd \
clusterclaims.cluster.open-cluster-management.io \
appliedmanifestworks.work.open-cluster-management.io \
configurationpolicies.policy.open-cluster-management.io \
observabilityaddons.observability.open-cluster-management.io \
policies.policy.open-cluster-management.io
# 3. Cleanup pods
oc delete pod --field-selector=status.phase==Succeeded --all-namespaces
oc delete pod --field-selector=status.phase==Failed --all-namespaces
# 4. Delete observablity namespace and secret, if configured
oc delete ns open-cluster-management-addon-observability
oc delete secret -n openshift-monitoring observability-alertmanager-accessor