Skip to content

Commit 49e3d1e

Browse files
easyCZroboquat
authored andcommitted
[public-api] Do not use localhost as address, not reachable in k8s
1 parent 2bc93c2 commit 49e3d1e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

components/common-go/baseserver/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,21 +347,21 @@ type builtinServices struct {
347347
func newBuiltinServices(server *Server) *builtinServices {
348348
healthAddr := fmt.Sprintf(":%d", BuiltinHealthPort)
349349
if server.options.underTest {
350-
healthAddr = "localhost:0"
350+
healthAddr = ":0"
351351
}
352352

353353
return &builtinServices{
354354
underTest: server.options.underTest,
355355
Debug: &http.Server{
356-
Addr: fmt.Sprintf("localhost:%d", BuiltinDebugPort),
356+
Addr: fmt.Sprintf(":%d", BuiltinDebugPort),
357357
Handler: pprof.Handler(),
358358
},
359359
Health: &http.Server{
360360
Addr: healthAddr,
361361
Handler: server.healthEndpoint(),
362362
},
363363
Metrics: &http.Server{
364-
Addr: fmt.Sprintf("localhost:%d", BuiltinMetricsPort),
364+
Addr: fmt.Sprintf(":%d", BuiltinMetricsPort),
365365
Handler: server.metricsEndpoint(),
366366
},
367367
}

components/public-api-server/pkg/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Start(logger *logrus.Entry, cfg Config) error {
2020

2121
srv, err := baseserver.New("public_api_server",
2222
baseserver.WithLogger(logger),
23-
baseserver.WithGRPC(&baseserver.ServerConfiguration{Address: fmt.Sprintf("localhost:%d", cfg.GRPCPort)}),
23+
baseserver.WithGRPC(&baseserver.ServerConfiguration{Address: fmt.Sprintf(":%d", cfg.GRPCPort)}),
2424
baseserver.WithMetricsRegistry(registry),
2525
)
2626
if err != nil {

0 commit comments

Comments
 (0)