Skip to content

Commit

Permalink
fix(health): do not require auth for /healthz and /readyz
Browse files Browse the repository at this point in the history
Fixes: #3655

Signed-off-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
mudler committed Sep 24, 2024
1 parent 90cacb9 commit 2efeb3c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions core/http/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ func App(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfig *confi
})
}

routes.HealthRoutes(app)

kaConfig, err := middleware.GetKeyAuthConfig(appConfig)
if err != nil || kaConfig == nil {
return nil, fmt.Errorf("failed to create key auth config: %w", err)
Expand Down
13 changes: 13 additions & 0 deletions core/http/routes/health.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package routes

import "github.com/gofiber/fiber/v2"

func HealthRoutes(app *fiber.App) {
// Service health checks
ok := func(c *fiber.Ctx) error {
return c.SendStatus(200)
}

app.Get("/healthz", ok)
app.Get("/readyz", ok)
}
8 changes: 0 additions & 8 deletions core/http/routes/localai.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ func RegisterLocalAIRoutes(app *fiber.App,
app.Post("/stores/get", localai.StoresGetEndpoint(sl, appConfig))
app.Post("/stores/find", localai.StoresFindEndpoint(sl, appConfig))

// Kubernetes health checks
ok := func(c *fiber.Ctx) error {
return c.SendStatus(200)
}

app.Get("/healthz", ok)
app.Get("/readyz", ok)

app.Get("/metrics", localai.LocalAIMetricsEndpoint())

// Experimental Backend Statistics Module
Expand Down

0 comments on commit 2efeb3c

Please sign in to comment.