11 lines
560 B
Bash
11 lines
560 B
Bash
#!/bin/bash -e
|
|
rules=$(kubectl get prometheusRule -A |grep -v "Name" | grep -E 'dev|qa' | awk '{print $1"/"$2}')
|
|
for i in $rules;do
|
|
rule=$(echo $i | cut -d '/' -f2)
|
|
namespace=$(echo $i | cut -d '/' -f1)
|
|
if `kubectl apply view-last-applied prometheusRule $rule -n $namespace -o yaml |grep -q "tag_Namespace,tag_Name"`;then
|
|
echo "found in $namespace/$rule"
|
|
kubectl apply view-last-applied prometheusRule $rule -n $namespace -o yaml | sed 's/tag_Namespace,tag_Name/tag_Namespace,tag_Ingress/g' | kubectl apply -f -
|
|
fi
|
|
done
|