diff --git a/deploy.sh b/deploy.sh index 47b9636ab..ec793b5cf 100755 --- a/deploy.sh +++ b/deploy.sh @@ -65,7 +65,9 @@ if [[ $CMD == 'deploy' ]]; then fi if [[ $CMD == 'undeploy' ]]; then - $KUSTOMIZE build config/prometheus | kubectl delete --ignore-not-found -f- + if kubectl get crd servicemonitors.monitoring.coreos.com > /dev/null 2>&1; then + $KUSTOMIZE build config/prometheus | kubectl delete --ignore-not-found -f- + fi $KUSTOMIZE build config/ports | kubectl delete --ignore-not-found -f - $KUSTOMIZE build $OVERLAY_EXAMPLES_DIR | kubectl delete --ignore-not-found -f - $KUSTOMIZE build $OVERLAY_DIR | kubectl delete --ignore-not-found -f -