Skip to content

Instantly share code, notes, and snippets.

@kameshsampath
Created December 8, 2017 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kameshsampath/e5372a3b3131a7bad917c83ac04ccbf8 to your computer and use it in GitHub Desktop.
Save kameshsampath/e5372a3b3131a7bad917c83ac04ccbf8 to your computer and use it in GitHub Desktop.
Cleanup istio on OpenShift
#!/bin/bash
set -o pipefail
set -e
oc login -u system:admin
oc project istio-system
oc delete --ignore-not-found=true clusterroles "istio-pilot-istio-system" || true
oc delete --ignore-not-found=true clusterroles "istio-initializer-istio-system" || true
oc delete --ignore-not-found=true clusterroles "istio-mixer-istio-system" || true
oc delete --ignore-not-found=true clusterroles "istio-ca-istio-system" || true
oc delete --ignore-not-found=true clusterroles "istio-sidecar-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-pilot-admin-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-initializer-admin-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-ca-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-ingress-admin-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-egress-admin-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-sidecar-role-binding-istio-system" || true
oc delete --ignore-not-found=true clusterrolebindings "istio-mixer-admin-role-binding-istio-system" || true
oc delete --ignore-not-found=true customresourcedefinitions "rules.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "attributemanifests.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "deniers.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "listcheckers.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "memquotas.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "noops.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "prometheuses.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "stackdrivers.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "statsds.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "stdios.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "svcctrls.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "checknothings.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "listentries.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "logentries.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "metrics.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "quotas.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "reportnothings.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "destinationpolicies.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "egressrules.config.istio.io" || true
oc delete --ignore-not-found=true customresourcedefinitions "routerules.config.istio.io" || true
oc delete --ignore-not-found=true configmaps "istio-mixer" || true
oc delete --ignore-not-found=true services "istio-mixer" || true
oc delete --ignore-not-found=true serviceaccounts "istio-mixer-service-account" || true
oc delete --ignore-not-found=true deployments "istio-mixer" || true
oc delete --ignore-not-found=true configmaps "istio" || true
oc delete --ignore-not-found=true services "istio-pilot" || true
oc delete --ignore-not-found=true serviceaccounts "istio-pilot-service-account" || true
oc delete --ignore-not-found=true deployments "istio-pilot" || true
oc delete --ignore-not-found=true services "istio-ingress" || true
oc delete --ignore-not-found=true serviceaccounts "istio-ingress-service-account" || true
oc delete --ignore-not-found=true deployments "istio-ingress" || true
oc delete --ignore-not-found=true services "istio-egress" || true
oc delete --ignore-not-found=true serviceaccounts "istio-egress-service-account" || true
oc delete --ignore-not-found=true deployments "istio-egress" || true
oc delete --ignore-not-found=true serviceaccounts "istio-ca-service-account" || true
oc delete --ignore-not-found=true deployments "istio-ca" || true
oc delete --ignore-not-found=true project istio-system || true
oc project myproject || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment