Skip to content

remyduthu/checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Checker

GoReference

Checker provides simple liveness and readiness checkers. You can use this package to configure Kubernetes probes.

Checkers

HTTP

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
  },
)