Skip to content

Commit

Permalink
PMM-12913 migrate /v1/version
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Mar 11, 2024
1 parent dd00b48 commit 581e273
Show file tree
Hide file tree
Showing 12 changed files with 518 additions and 510 deletions.
10 changes: 5 additions & 5 deletions api/MIGRATION_TO_V3.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
| ----------------------------------------------- | -------------------------------------------- | ------------------------------- |

**ServerService** **ServerService**
GET /logz.zip GET /api/server/v1/logs.zip redirect to /logs.zip in swagger
GET /v1/version GET /api/server/v1/version redirect to /v1/version in swagger
POST /v1/readyz GET /api/server/v1/readyz
POST /v1/AWSInstanceCheck GET /api/server/v1/AWSInstance
POST /v1/leaderHealthCheck GET /api/server/v1/leaderHealthCheck
GET /logz.zip GET /api/server/v1/logs.zip redirect to /logs.zip in swagger
GET /v1/version GET /api/server/v1/version redirect to /v1/version in swagger
POST /v1/readyz GET /api/server/v1/readyz
POST /v1/AWSInstanceCheck GET /api/server/v1/AWSInstance
POST /v1/leaderHealthCheck GET /api/server/v1/leaderHealthCheck
POST /v1/settings/Change PUT /api/server/v1/settings
POST /v1/settings/Get GET /api/server/v1/settings
POST /v1/updates/Check GET /api/server/v1/updates
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/server/v1/json/client/server_service/version_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

252 changes: 126 additions & 126 deletions api/server/v1/json/v1.json

Large diffs are not rendered by default.

233 changes: 117 additions & 116 deletions api/server/v1/server.pb.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions api/server/v1/server.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/server/v1/server.proto
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ message AWSInstanceCheckResponse {}
service ServerService {
// Version returns PMM Server versions.
rpc Version(VersionRequest) returns (VersionResponse) {
option (google.api.http) = {get: "/v1/version"};
option (google.api.http) = {get: "/api/server/v1/version"};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Version"
description: "Returns PMM Server versions."
Expand Down
252 changes: 126 additions & 126 deletions api/swagger/swagger-dev.json

Large diffs are not rendered by default.

252 changes: 126 additions & 126 deletions api/swagger/swagger.json

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions build/ansible/roles/nginx/files/conf.d/pmm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@
proxy_http_version 1.1;
proxy_set_header Connection "";
}
location /api/ {
proxy_pass http://managed-json/api/;
proxy_http_version 1.1;
proxy_set_header Connection "";
}

# qan-api gRPC APIs should not be exposed

Expand All @@ -220,8 +225,10 @@
proxy_set_header Connection "";
}

# for minimal compatibility with PMM 1.x
rewrite ^/ping$ /v1/readyz;
# minimal compatibility with PMM 1.x
rewrite ^/ping$ /api/server/v1/version;
# compatibility with PMM 2.x
rewrite ^/v1/readyz$ /api/server/v1/version;

# logs.zip in both PMM 1.x and 2.x variants
location /logs.zip {
Expand Down
2 changes: 1 addition & 1 deletion managed/services/grafana/auth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var rules = map[string]role{
"/ping": none, // PMM 1.x variant

// must not be available without authentication as it can leak data
"/v1/version": viewer,
"/api/server/v1/version": viewer,

"/v1/qan/": viewer,

Expand Down
2 changes: 1 addition & 1 deletion managed/services/grafana/auth_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func TestAuthServerAuthenticate(t *testing.T) {
"/v1/readyz": none,
"/ping": none,

"/v1/version": viewer,
"/api/server/v1/version": viewer,

"/v1/qan/ObjectDetails/GetQueryExample": viewer,

Expand Down

0 comments on commit 581e273

Please sign in to comment.