Skip to content

Instantly share code, notes, and snippets.

@rvennam
Created March 12, 2019 15:44
Show Gist options
  • Save rvennam/9e574255069e4f5e29ecb6b8d42d3b37 to your computer and use it in GitHub Desktop.
Save rvennam/9e574255069e4f5e29ecb6b8d42d3b37 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z "$1" ]
then
echo "No argument supplied"
exit 1
fi
ibmcloud ks cluster-addon-disable istio --cluster $1 -f
sleep 10
helm delete istio --purge --kube-context="$1"
kubectl delete ns istio-system --context="$1"
sleep 5
protos=( cm secrets sa)
for proto in "${protos[@]}"; do
kubectl get "$proto" --all-namespaces --context="$1" | grep "istio" | while read -r entry; do
ns=$(echo "$entry" | awk '{print $1}')
name=$(echo "$entry" | awk '{print $2}')
echo "Deleting $proto with name: $name"
kubectl delete "$proto" "$name" -n "$ns" --context="$1"
done
done
protos=( clusterrolebinding clusterrole crd mutatingwebhookconfigurations validatingwebhookconfigurations )
for proto in "${protos[@]}"; do
kubectl get "$proto" --context="$1" | grep "istio" | while read -r entry; do
name=$(echo "$entry" | awk '{print $1}')
echo "Deleting $proto with name: $name"
kubectl delete "$proto" "$name" --context="$1"
done
done
$ISTIO/istio/samples/bookinfo/platform/kube/cleanup.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment