Skip to content

Commit aa73d55

Browse files
authored
Merge pull request #272 from vshn/add/ignore-vshn-test-billing
Don't deploy billing prometheus rule for tests
2 parents 33a1df9 + 3908409 commit aa73d55

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/comp-functions/functions/common/billing.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import (
55
"context"
66
_ "embed"
77
"fmt"
8+
"text/template"
9+
810
xfnproto "github.com/crossplane/function-sdk-go/proto/v1beta1"
911
v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
1012
"github.com/vshn/appcat/v4/pkg/comp-functions/runtime"
1113
"k8s.io/apimachinery/pkg/util/intstr"
1214
controllerruntime "sigs.k8s.io/controller-runtime"
13-
"text/template"
1415
)
1516

1617
var rawExpr = "vector({{.}})"
@@ -22,6 +23,11 @@ func CreateBillingRecord(ctx context.Context, svc *runtime.ServiceRuntime, comp
2223
log := controllerruntime.LoggerFrom(ctx)
2324
log.Info("Enabling billing for service", "service", comp.GetName())
2425

26+
if comp.GetClaimNamespace() == svc.Config.Data["ignoreNamespaceForBilling"] {
27+
log.Info("Test instance, skipping billing")
28+
return nil
29+
}
30+
2531
expr, err := getExprFromTemplate(comp.GetInstances())
2632
if err != nil {
2733
runtime.NewWarningResult(fmt.Sprintf("cannot add billing to service %s", comp.GetName()))

0 commit comments

Comments
 (0)