Skip to content

Commit

Permalink
Delete the ServiceMonitor CR only if its CRD exists
Browse files Browse the repository at this point in the history
Signed-off-by: Dean Roehrich <[email protected]>
  • Loading branch information
roehrich-hpe committed Nov 15, 2023
1 parent 1a62f95 commit 5199b56
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down

0 comments on commit 5199b56

Please sign in to comment.