Skip to content

Commit a5b7cd3

Browse files
committed
server: fix admin v1 health endpoint
PR #153929 migrated admin RPC use DRPC http instead of the grpc-gateway. This introduced a bug that made the admin/v1/health endpoint require authentication when it previously did not require this. This PR changes it to use an unauthenticated internal server. Fixes: 155052 Epic: None Release note: None
1 parent b86f9f7 commit a5b7cd3

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

pkg/server/server_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func (s *httpServer) setupRoutes(
237237

238238
// Exempt the 2nd health check endpoint from authentication.
239239
// (This simply mirrors /health and exists for backward compatibility.)
240-
s.mux.Handle(apiconstants.AdminHealth, authenticatedAPIInternalServer)
240+
s.mux.Handle(apiconstants.AdminHealth, unauthenticatedAPIInternalServer)
241241
// The /_status/vars and /metrics endpoint is not authenticated either. Useful for monitoring.
242242
s.mux.Handle(apiconstants.StatusVars, http.HandlerFunc(varsHandler{metricSource, s.cfg.Settings, false /* useStaticLabels */}.handleVars))
243243
s.mux.Handle(apiconstants.MetricsPath, http.HandlerFunc(varsHandler{metricSource, s.cfg.Settings, true /* useStaticLabels */}.handleVars))

pkg/server/storage_api/health_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/cockroachdb/cockroach/pkg/server/srvtestutils"
1919
"github.com/cockroachdb/cockroach/pkg/testutils"
2020
"github.com/cockroachdb/cockroach/pkg/testutils/serverutils"
21-
"github.com/cockroachdb/cockroach/pkg/testutils/skip"
2221
"github.com/cockroachdb/cockroach/pkg/testutils/testcluster"
2322
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
2423
"github.com/cockroachdb/cockroach/pkg/util/log"
@@ -30,7 +29,6 @@ func TestHealthAPI(t *testing.T) {
3029
defer leaktest.AfterTest(t)()
3130
defer log.Scope(t).Close(t)
3231

33-
skip.WithIssue(t, 155052)
3432
ctx := context.Background()
3533

3634
t.Run("sql", func(t *testing.T) {

0 commit comments

Comments
 (0)