Skip to content

Instantly share code, notes, and snippets.

View schwabix's full-sized avatar
🎸
rock 2020

Michael Steinlechner schwabix

🎸
rock 2020
  • Schwabix
  • Munich
View GitHub Profile
@dkeightley
dkeightley / clean-monitoring-v1.sh
Created April 1, 2021 00:25
clean-monitoring-v1
for clusterId in $(kubectl get clusters.management.cattle.io -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}');
do
# empty recipients for cluster alert groups
for clusterAlertGroup in $(kubectl -n $clusterId get clusteralertgroups -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}');
do
kubectl -n $clusterId patch clusteralertgroup $clusterAlertGroup --type merge --patch '{"spec": {"recipients": []}}'
done
# disable cluster monitoring
kubectl patch clusters.management.cattle.io $clusterId --type merge --patch '{"spec": {"enableClusterMonitoring": false}}'
for projectId in $(kubectl -n $clusterId get projects.management.cattle.io -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}{end}')