Make log pattern check configurable in health checker

This commit is contained in:
Archit Bansal
2021-02-17 17:46:18 -08:00
parent fc4f167caa
commit 100f2bf8e6
4 changed files with 206 additions and 46 deletions
+3
View File
@@ -40,6 +40,7 @@ type HealthCheckerOptions struct {
CriSocketPath string
CoolDownTime time.Duration
HealthCheckTimeout time.Duration
LogPatterns types.LogPatternFlag
}
// AddFlags adds health checker command line options to pflag.
@@ -57,6 +58,8 @@ func (hco *HealthCheckerOptions) AddFlags(fs *pflag.FlagSet) {
"The duration to wait for the service to be up before attempting repair.")
fs.DurationVar(&hco.HealthCheckTimeout, "health-check-timeout", types.DefaultHealthCheckTimeout,
"The time to wait before marking the component as unhealthy.")
fs.Var(&hco.LogPatterns, "log-pattern",
"The log pattern to look for in service journald logs. The format for flag value <failureThresholdCount>:<logPattern>")
}
// IsValid validates health checker command line options.