Skip to content

Commit

Permalink
PMM-12913 fix wrong grpc paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Mar 16, 2024
1 parent 48afac7 commit 75cd92c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
16 changes: 8 additions & 8 deletions managed/services/grafana/auth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ var rules = map[string]role{
"/agent.Agent/Connect": none, // NOTE: remove before v3 GA
"/agent.v1.AgentService/Connect": none,

"/inventory.": admin,
"/management.": admin,
"/actions/": viewer,
"/server.Server/CheckUpdates": viewer,
"/server.Server/UpdateStatus": none, // special token-based auth
"/server.Server/AWSInstanceCheck": none, // special case - used before Grafana can be accessed
"/server.": admin,
"/inventory.": admin,
"/management.": admin,
"/actions/": viewer,
"/server.v1.ServerService/CheckUpdates": viewer,
"/server.v1.ServerService/UpdateStatus": none, // special token-based auth
"/server.v1.ServerService/AWSInstanceCheck": none, // special case - used before Grafana can be accessed
"/server.v1.": admin,

"/v1/alerting": viewer,
"/v1/backup": admin,
Expand Down Expand Up @@ -110,7 +110,7 @@ const vmProxyHeaderName = "X-Proxy-Filter"

// Only UI is blocked by setup wizard; APIs can be used.
// Critically, AWSInstanceCheck must be available for the setup wizard itself to work;
// and /agent.Agent/Connect and Management APIs should be available for pmm-agent on PMM Server registration.
// and /agent.v1.AgentService/Connect and Management APIs should be available for pmm-agent on PMM Server registration.
var mustSetupRules = []string{
"/prometheus",
"/victoriametrics",
Expand Down
22 changes: 11 additions & 11 deletions managed/services/grafana/auth_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,17 +199,17 @@ func TestAuthServerAuthenticate(t *testing.T) {
})

for uri, minRole := range map[string]role{
"/agent.Agent/Connect": none,

"/inventory.Nodes/ListNodes": admin,
"/actions/StartMySQLShowTableStatusAction": viewer,
"/management.Service/RemoveService": admin,
"/management.Service/ListServices": admin,
"/management.Annotation/AddAnnotation": admin,
"/server.Server/CheckUpdates": viewer,
"/server.Server/StartUpdate": admin,
"/server.Server/UpdateStatus": none,
"/server.Server/AWSInstanceCheck": none,
"/agent.v1.AgentService/Connect": none,

"/inventory.Nodes/ListNodes": admin,
"/actions/StartMySQLShowTableStatusAction": viewer,
"/management.Service/RemoveService": admin,
"/management.Service/ListServices": admin,
"/management.Annotation/AddAnnotation": admin,
"/server.v1.ServerService/CheckUpdates": viewer,
"/server.v1.ServerService/StartUpdate": admin,
"/server.v1.ServerService/UpdateStatus": none,
"/server.v1.ServerService/AWSInstanceCheck": none,

"/v1/inventory/Nodes/List": admin,
"/v1/actions/StartMySQLShowTableStatus": viewer,
Expand Down
2 changes: 1 addition & 1 deletion managed/utils/interceptors/grpc_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func getCallerOriginStr(ctx context.Context) string {
}

func callerOriginFromRequest(ctx context.Context, method string) callerOrigin {
if method == "/server.Server/Readiness" || method == "/agent.Agent/Connect" {
if method == "/server.v1.ServerService/Readiness" || method == "/agent.v1.AgentService/Connect" {
return internalCallerOrigin
}

Expand Down
4 changes: 2 additions & 2 deletions managed/utils/interceptors/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func Unary(interceptor grpc.UnaryServerInterceptor) UnaryInterceptorType {
l := logrus.WithField("request", logger.MakeRequestID())
ctx = logger.SetEntry(ctx, l)

if info.FullMethod == "/server.Server/Readiness" && os.Getenv("LESS_LOG_NOISE") != "" {
if info.FullMethod == "/server.v1.ServerService/Readiness" && os.Getenv("LESS_LOG_NOISE") != "" {
l = logrus.NewEntry(logrus.New())
l.Logger.SetOutput(io.Discard)
}
Expand Down Expand Up @@ -124,7 +124,7 @@ func Stream(interceptor grpc.StreamServerInterceptor) func(srv interface{}, ss g

// set logger
l := logrus.WithField("request", logger.MakeRequestID())
if info.FullMethod == "/agent.Agent/Connect" {
if info.FullMethod == "/agent.v1.AgentService/Connect" {
md, _ := agentv1.ReceiveAgentConnectMetadata(ss)
if md != nil && md.ID != "" {
l = l.WithField("agent_id", md.ID)
Expand Down

0 comments on commit 75cd92c

Please sign in to comment.