This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}') |