Skip to content

Commit

Permalink
Switch instances monitoring from cluster to user-workload monitoring
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Bigler <[email protected]>
  • Loading branch information
TheBigLee committed Dec 13, 2024
1 parent 93a71c4 commit 4f9935c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions pkg/comp-functions/functions/common/billing.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import (
"context"
_ "embed"
"fmt"

xfnproto "github.com/crossplane/function-sdk-go/proto/v1beta1"
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
"github.com/vshn/appcat/v4/pkg/comp-functions/runtime"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
controllerruntime "sigs.k8s.io/controller-runtime"
)
Expand Down Expand Up @@ -75,6 +77,13 @@ func CreateBillingRecord(ctx context.Context, svc *runtime.ServiceRuntime, comp
}

p := &v1.PrometheusRule{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
// This label is required, the ensure that the rule is added to Prometheus and
// not the Thanos Rules in the Openshift User Workload Monitoring
"openshift.io/prometheus-rule-evaluation-scope": "leaf-prometheus",
},
},
Spec: v1.PrometheusRuleSpec{
Groups: []v1.RuleGroup{
rg,
Expand Down
2 changes: 1 addition & 1 deletion pkg/comp-functions/functions/common/instance_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func createInstanceNamespace(serviceName, compName, claimNamespace, instanceName
"appuio.io/no-rbac-creation": "true",
"appuio.io/billing-name": billingName,
"appuio.io/organization": org,
"openshift.io/cluster-monitoring": "true",
"openshift.io/cluster-monitoring": "false",
},
},
}
Expand Down

0 comments on commit 4f9935c

Please sign in to comment.