# 1. Verwijder alle ClusterRoles van vorige installatie
kubectl delete clusterrole monitoring-grafana-clusterrole --ignore-not-found=true
kubectl delete clusterrole monitoring-kube-prometheus-admission --ignore-not-found=true
kubectl delete clusterrole monitoring-kube-prometheus-operator --ignore-not-found=true
kubectl delete clusterrole monitoring-kube-prometheus-prometheus --ignore-not-found=true
kubectl delete clusterrole monitoring-kube-state-metrics --ignore-not-found=true

# 2. Verwijder ClusterRoleBindings
kubectl delete clusterrolebinding monitoring-grafana-clusterrolebinding --ignore-not-found=true
kubectl delete clusterrolebinding monitoring-kube-prometheus-admission --ignore-not-found=true
kubectl delete clusterrolebinding monitoring-kube-prometheus-operator --ignore-not-found=true
kubectl delete clusterrolebinding monitoring-kube-prometheus-prometheus --ignore-not-found=true
kubectl delete clusterrolebinding monitoring-kube-state-metrics --ignore-not-found=true

# 3. Verwijder eventuele webhook configurations
kubectl delete mutatingwebhookconfiguration monitoring-kube-prometheus-admission --ignore-not-found=true
kubectl delete validatingwebhookconfiguration monitoring-kube-prometheus-admission --ignore-not-found=true

# 4. Check voor andere monitoring resources
kubectl get clusterroles | grep monitoring
kubectl get clusterrolebindings | grep monitoring

# 5. Als er nog resources zijn, verwijder ze:
kubectl get clusterroles | grep monitoring | awk '{print $1}' | xargs -r kubectl delete clusterrole
kubectl get clusterrolebindings | grep monitoring | awk '{print $1}' | xargs -r kubectl delete clusterrolebinding
