Skip to content

Commit

Permalink
Add team_owner for PrometheusDiscover
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Feb 10, 2023
1 parent dce71a0 commit 07b3b76
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controllerapi/controllerapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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,
},
})

Expand All @@ -82,6 +84,7 @@ func rpaasTargetGroups(svcMap map[sigsk8sclient.ObjectKey]*coreV1.Service, nginx
"service_instance": serviceInstance,
"service": service,
"servername": host,
"team_owner": teamOwner,
},
})
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/controllerapi/controllerapi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -84,6 +85,7 @@ func TestPrometheusDiscover(t *testing.T) {
Labels: map[string]string{
"service": "rpaasv2",
"service_instance": "test",
"team_owner": "team01",
},
},
{
Expand All @@ -92,6 +94,7 @@ func TestPrometheusDiscover(t *testing.T) {
"servername": "test.internal",
"service": "rpaasv2",
"service_instance": "test",
"team_owner": "team01",
},
},
{
Expand All @@ -100,6 +103,7 @@ func TestPrometheusDiscover(t *testing.T) {
"servername": "hello.globo",
"service": "rpaasv2",
"service_instance": "test",
"team_owner": "team01",
},
},
}, l)
Expand Down

0 comments on commit 07b3b76

Please sign in to comment.