From 1e2d9150dd709ee7259aa85417f2642316952dc6 Mon Sep 17 00:00:00 2001 From: Dean Roehrich Date: Wed, 15 Nov 2023 15:29:01 -0600 Subject: [PATCH] Delete the ServiceMonitor CR only if its CRD exists Signed-off-by: Dean Roehrich --- deploy.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index e0ce4f3a..52768923 100755 --- a/deploy.sh +++ b/deploy.sh @@ -55,7 +55,9 @@ deploy) fi ;; undeploy) - $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 # When the NnfDataMovementManager CRD gets deleted all related resource are also # removed, so the delete will always fail. We ignore all errors at our # own risk.