-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update uninstall.sh #164
base: master
Are you sure you want to change the base?
Update uninstall.sh #164
Changes from all commits
0c784da
928da4e
7d04589
9aaf5bf
aba67ed
5324ece
60a440b
a9f280a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ | |
|
||
|
||
KEEP_PROVIDERS=0 | ||
OCM_NAMESPACE=open-cluster-management | ||
TOTAL_POD_COUNT_2X=55 | ||
POLL_DURATION_21X=1500 | ||
|
||
|
||
# save args to pass to called scripts | ||
args=("$@") | ||
|
@@ -46,18 +50,115 @@ printf "\n" | |
oc cluster-info | head -n 1 | awk '{print $NF}' | ||
printf "\n" | ||
|
||
./clean-clusters.sh "$args" | ||
|
||
kubectl delete -k multiclusterhub/ | ||
echo "Sleeping for 200 seconds to allow resources to finalize ..." | ||
sleep 200 | ||
#./clean-clusters.sh "$args" | ||
|
||
kubectl delete -k multicluster-hub-operator/ | ||
./multicluster-hub-operator/uninstall.sh | ||
|
||
kubectl delete -k acm-operator/ | ||
./acm-operator/uninstall.sh | ||
if [ -z ${OCM_NAMESPACE+x} ]; | ||
then | ||
echo "OCM_NAMESPACE must be set" | ||
exit 1 | ||
else | ||
echo "Cleaning up resources in namespace: $OCM_NAMESPACE" | ||
fi | ||
|
||
kubectl delete -k community-subscriptions/ | ||
oc delete mco --all -n $OCM_NAMESPACE | ||
|
||
COMPLETE=1 | ||
if [[ " $@ " =~ " --watch " ]]; then | ||
if [[ $DEFAULT_SNAPSHOT =~ v{0,1}2\.[1-9][0-9]*\.[0-9]+.* ]]; then | ||
echo "" | ||
echo "#####" | ||
#mch_status=`oc get multiclusterhub --all-namespaces` | ||
acc=0 | ||
while [[ $(oc get multiclusterobservability --all-namespaces) && $acc -le $POLL_DURATION_21X ]]; do | ||
curr_status=$(oc get multiclusterobservability --all-namespaces -o json | jq -r '.items[].status.phase') 2> /dev/null | ||
echo "Waited $acc/$POLL_DURATION_21X seconds for MCO to be deleted. Current Status: $curr_status" | ||
if [[ "$DEBUG" == "true" ]]; then | ||
echo "#####" | ||
component_list=$(oc get multiclusterobservability --all-namespaces -o json | jq -r '.items[].status.components') | ||
printf "%-30s\t%-10s\t%-30s\t%-30s\n" "COMPONENT" "STATUS" "TYPE" "REASON" | ||
for status_item in $(echo $component_list | jq -r 'keys | .[]'); do | ||
component=$(echo $component_list | jq -r --arg ITEM_NAME "$status_item" '.[$ITEM_NAME]') | ||
component_status="$(echo $component | jq -r '.status')"; | ||
type="$(echo $component | jq -r '.type')"; | ||
reason="$(echo $component | jq -r '.reason')"; | ||
message="$(echo $component | jq -r '.message')"; | ||
printf "%-30s\t%-10s\t%-30s\t%-30s\n" "$status_item" "$component_status" "$type" "$reason" | ||
done | ||
fi | ||
Comment on lines
+75
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this doesnt work for obs so lets remove it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does observability not have components we can watch be torn down? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably not check their schema |
||
echo "" | ||
acc=$((acc+30)) | ||
sleep 30 | ||
done; | ||
if [[ $(oc get multiclusterobservability --all-namespaces) ]]; then | ||
COMPLETE=1 | ||
else | ||
COMPLETE=0 | ||
echo "MCO was deleted after $acc seconds." | ||
echo "" | ||
fi | ||
fi | ||
fi | ||
|
||
oc delete mch --all -n $OCM_NAMESPACE | ||
## Delete all helm charts in given namespace | ||
#helm ls --namespace $OCM_NAMESPACE | cut -f 1 | tail -n +2 | xargs -n 1 helm delete --namespace $OCM_NAMESPACE | ||
#oc delete apiservice v1.admission.cluster.open-cluster-management.io v1beta1.webhook.certmanager.k8s.io v1.admission.cluster.open-cluster-management.io v1.admission.work.open-cluster-management.io | ||
#oc delete clusterimageset --all | ||
#oc delete configmap -n $OCM_NAMESPACE cert-manager-controller cert-manager-cainjector-leader-election cert-manager-cainjector-leader-election-core | ||
#oc delete consolelink acm-console-link | ||
#oc delete crd klusterletaddonconfigs.agent.open-cluster-management.io placementbindings.policy.open-cluster-management.io policies.policy.open-cluster-management.io userpreferences.console.open-cluster-management.io | ||
#oc delete mutatingwebhookconfiguration cert-manager-webhook-v1alpha1 | ||
#oc delete oauthclient multicloudingress | ||
#oc delete rolebinding -n kube-system cert-manager-webhook-webhook-authentication-reader | ||
#oc delete scc kui-proxy-scc | ||
#oc delete validatingwebhookconfiguration cert-manager-webhook-v1alpha1 | ||
|
||
#kubectl delete -k multiclusterhub/ | ||
#echo "Sleeping for 200 seconds to allow resources to finalize ..." | ||
#sleep 200 | ||
|
||
#kubectl delete -k multicluster-hub-operator/ | ||
#./multicluster-hub-operator/uninstall.sh | ||
|
||
#kubectl delete -k acm-operator/ | ||
#./acm-operator/uninstall.sh | ||
|
||
#kubectl delete -k community-subscriptions/ | ||
|
||
COMPLETE=1 | ||
if [[ " $@ " =~ " --watch " ]]; then | ||
if [[ $DEFAULT_SNAPSHOT =~ v{0,1}2\.[1-9][0-9]*\.[0-9]+.* ]]; then | ||
echo "" | ||
echo "#####" | ||
#mch_status=`oc get multiclusterhub --all-namespaces` | ||
acc=0 | ||
while [[ $(oc get multiclusterhub --all-namespaces) && $acc -le $POLL_DURATION_21X ]]; do | ||
curr_status=$(oc get multiclusterhub --all-namespaces -o json | jq -r '.items[].status.phase') 2> /dev/null | ||
echo "Waited $acc/$POLL_DURATION_21X seconds for MCH to be deleted. Current Status: $curr_status" | ||
if [[ "$DEBUG" == "true" ]]; then | ||
echo "#####" | ||
component_list=$(oc get multiclusterhub --all-namespaces -o json | jq -r '.items[].status.components') | ||
printf "%-30s\t%-10s\t%-30s\t%-30s\n" "COMPONENT" "STATUS" "TYPE" "REASON" | ||
for status_item in $(echo $component_list | jq -r 'keys | .[]'); do | ||
component=$(echo $component_list | jq -r --arg ITEM_NAME "$status_item" '.[$ITEM_NAME]') | ||
component_status="$(echo $component | jq -r '.status')"; | ||
type="$(echo $component | jq -r '.type')"; | ||
reason="$(echo $component | jq -r '.reason')"; | ||
message="$(echo $component | jq -r '.message')"; | ||
printf "%-30s\t%-10s\t%-30s\t%-30s\n" "$status_item" "$component_status" "$type" "$reason" | ||
done | ||
fi | ||
echo "" | ||
acc=$((acc+30)) | ||
sleep 30 | ||
done; | ||
if [[ $(oc get multiclusterhub --all-namespaces) ]]; then | ||
COMPLETE=1 | ||
else | ||
COMPLETE=0 | ||
echo "MCH was deleted after $acc seconds." | ||
echo "" | ||
fi | ||
fi | ||
fi | ||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indention