Add --health-check command line switch. Fixes #1257

This commit is contained in:
bugficks 2023-08-09 05:54:04 +00:00
parent 7948242260
commit 3acc52ed59
6 changed files with 34 additions and 1 deletions

View file

@ -152,6 +152,15 @@ func Run(c *cobra.Command, names []string) {
enableMetricsAPI, _ := c.PersistentFlags().GetBool("http-api-metrics")
unblockHTTPAPI, _ := c.PersistentFlags().GetBool("http-api-periodic-polls")
apiToken, _ := c.PersistentFlags().GetString("http-api-token")
healthCheck, _ := c.PersistentFlags().GetBool("health-check")
if healthCheck {
// health check should not have pid 1
if os.Getpid() == 1 {
os.Exit(1)
}
os.Exit(0)
}
if rollingRestart && monitorOnly {
log.Fatal("Rolling restarts is not compatible with the global monitor only flag")