Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch instances monitoring from cluster to user-workload monitoring #283

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
TheBigLee marked this conversation as resolved.
Show resolved Hide resolved
},
},
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
Loading