github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/hack/update_prometheus_rules.sh (about) 1 #!/usr/bin/env bash 2 # 3 # Copyright (c) 2023, Oracle and/or its affiliates. 4 # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 5 # 6 7 SCRIPT_DIR=$(cd $(dirname "$0"); pwd -P) 8 9 # Update the Prometheus Rule resources to include "verrazzano_cluster" in "on" and "by" clauses, otherwise the 10 # cluster label is dropped from alerts and it is impossible to determine which cluster fired the alert. This 11 # script should be run whenever we upgrade any upstream charts that include Prometheus Rules (currently the 12 # kube-prometheus-stack and thanos charts). 13 sed -i -E 's/ by ?\(([^\)]*)\)/ by (\1, verrazzano_cluster)/gI' `grep -Rl PrometheusRule $SCRIPT_DIR/../* | grep templates` 14 sed -i -E 's/ on ?\(([^\)]*)\)/ on (\1, verrazzano_cluster)/gI' `grep -Rl PrometheusRule $SCRIPT_DIR/../* | grep templates`