From 07b3b76c654f3699cde847bb10eb212c6fc87b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilson=20J=C3=BAnior?= Date: Fri, 10 Feb 2023 09:14:44 -0300 Subject: [PATCH] Add team_owner for PrometheusDiscover --- pkg/controllerapi/controllerapi.go | 3 +++ pkg/controllerapi/controllerapi_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pkg/controllerapi/controllerapi.go b/pkg/controllerapi/controllerapi.go index 4289d2c3d..c7b14bf60 100644 --- a/pkg/controllerapi/controllerapi.go +++ b/pkg/controllerapi/controllerapi.go @@ -61,6 +61,7 @@ func rpaasTargetGroups(svcMap map[sigsk8sclient.ObjectKey]*coreV1.Service, nginx serviceInstance := svc.Labels["rpaas.extensions.tsuru.io/instance-name"] service := svc.Labels["rpaas.extensions.tsuru.io/service-name"] + teamOwner := svc.Labels["rpaas.extensions.tsuru.io/team-owner"] targetGroups = append(targetGroups, TargetGroup{ Targets: []string{ @@ -69,6 +70,7 @@ func rpaasTargetGroups(svcMap map[sigsk8sclient.ObjectKey]*coreV1.Service, nginx Labels: map[string]string{ "service_instance": serviceInstance, "service": service, + "team_owner": teamOwner, }, }) @@ -82,6 +84,7 @@ func rpaasTargetGroups(svcMap map[sigsk8sclient.ObjectKey]*coreV1.Service, nginx "service_instance": serviceInstance, "service": service, "servername": host, + "team_owner": teamOwner, }, }) } diff --git a/pkg/controllerapi/controllerapi_test.go b/pkg/controllerapi/controllerapi_test.go index f7f8ba920..94b9a774c 100644 --- a/pkg/controllerapi/controllerapi_test.go +++ b/pkg/controllerapi/controllerapi_test.go @@ -51,6 +51,7 @@ func TestPrometheusDiscover(t *testing.T) { "nginx.tsuru.io/app": "nginx", "rpaas.extensions.tsuru.io/instance-name": "test", "rpaas.extensions.tsuru.io/service-name": "rpaasv2", + "rpaas.extensions.tsuru.io/team-owner": "team01", }, }, Status: coreV1.ServiceStatus{ @@ -84,6 +85,7 @@ func TestPrometheusDiscover(t *testing.T) { Labels: map[string]string{ "service": "rpaasv2", "service_instance": "test", + "team_owner": "team01", }, }, { @@ -92,6 +94,7 @@ func TestPrometheusDiscover(t *testing.T) { "servername": "test.internal", "service": "rpaasv2", "service_instance": "test", + "team_owner": "team01", }, }, { @@ -100,6 +103,7 @@ func TestPrometheusDiscover(t *testing.T) { "servername": "hello.globo", "service": "rpaasv2", "service_instance": "test", + "team_owner": "team01", }, }, }, l)