Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kidswiss committed Sep 10, 2024
1 parent a0086a1 commit be84509
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,7 @@ bootstrap: api-bootstrap generate ## API bootstrapping, create a new claim/compo
.PHONY: install-proxy
install-proxy:
kubectl apply -f hack/functionproxy

.PHONY: render-diff
render-diff: docker-build-branchtag ## Render diff between the cluter in KUBECONF and the local branch
hack/diff/compare.sh
Empty file modified hack/diff/compare.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nonsla
import (
"context"
"fmt"
"sort"

fnproto "github.com/crossplane/function-sdk-go/proto/v1beta1"
promV1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
Expand Down Expand Up @@ -38,6 +39,11 @@ func GenerateNonSLAPromRules[T client.Object](alerts Alerts) func(ctx context.Co
}
rules = append(rules, alerts.customRules...)

// Sort the alerts to avoid random diff changes
sort.Slice(rules, func(i, j int) bool {
return rules[i].Alert < rules[j].Alert
})

err = generatePromeRules(elem.GetName(), elem.GetInstanceNamespace(), rules, svc)
if err != nil {
return runtime.NewWarningResult("can't create prometheus rules: " + err.Error())
Expand Down

0 comments on commit be84509

Please sign in to comment.