Checker provides simple liveness and readiness checkers. You can use this package to configure Kubernetes probes.
Creates a simple HTTP server listening on port 8080
with only GET:/live
and
GET:/ready
endpoints. It takes liveness
and readiness
functions as
parameters. Each parameter is a ckeckFunc
function. It simply returns an error
if the probe fails.
Example:
// Use a separate coroutine
go checker.HTTP(
func() error {
if !app.Ready() {
return errors.New("App is not ready")
}
return nil
},
func() error {
if !app.Live() {
return errors.New("App is not live")
}
return nil
},
)