Skip to content

Instantly share code, notes, and snippets.

@wayneashleyberry
Created August 6, 2018 10:53
Show Gist options
  • Save wayneashleyberry/50e5b03772b1021fcd3ddf4c3ff13536 to your computer and use it in GitHub Desktop.
Save wayneashleyberry/50e5b03772b1021fcd3ddf4c3ff13536 to your computer and use it in GitHub Desktop.
Go command for a Kubernetes liveness probe
package live
import (
"os"
"github.com/overhq/over-stories-api/pkg/probe"
"github.com/spf13/cobra"
)
// Command contains the livee command
var Command = &cobra.Command{
Use: "live",
Short: "Check if application is live",
Run: func(cmd *cobra.Command, args []string) {
if probe.Exists() {
os.Exit(0)
}
os.Exit(1)
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment