mirror of
https://github.com/kubernetes/node-problem-detector.git
synced 2026-08-19 04:06:24 +00:00
allow setting crictl timeout
This commit is contained in:
@@ -39,6 +39,7 @@ type HealthCheckerOptions struct {
|
||||
EnableRepair bool
|
||||
CriCtlPath string
|
||||
CriSocketPath string
|
||||
CriTimeout time.Duration
|
||||
CoolDownTime time.Duration
|
||||
LoopBackTime time.Duration
|
||||
HealthCheckTimeout time.Duration
|
||||
@@ -62,6 +63,8 @@ func (hco *HealthCheckerOptions) AddFlags(fs *pflag.FlagSet) {
|
||||
"The path to the crictl binary. This is used to check health of cri component.")
|
||||
fs.StringVar(&hco.CriSocketPath, "cri-socket-path", types.DefaultCriSocketPath,
|
||||
"The path to the cri socket. Used with crictl to specify the socket path.")
|
||||
fs.DurationVar(&hco.CriTimeout, "cri-timeout", types.DefaultCriTimeout,
|
||||
"The duration to wait for crictl to run.")
|
||||
fs.DurationVar(&hco.CoolDownTime, "cooldown-time", types.DefaultCoolDownTime,
|
||||
"The duration to wait for the service to be up before attempting repair.")
|
||||
fs.DurationVar(&hco.LoopBackTime, "loopback-time", types.DefaultLoopBackTime,
|
||||
|
||||
@@ -150,7 +150,7 @@ func getHealthCheckFunc(hco *options.HealthCheckerOptions) func() (bool, error)
|
||||
}
|
||||
case types.CRIComponent:
|
||||
return func() (bool, error) {
|
||||
if _, err := execCommand(hco.HealthCheckTimeout, hco.CriCtlPath, "--runtime-endpoint="+hco.CriSocketPath, "pods", "--latest"); err != nil {
|
||||
if _, err := execCommand(hco.HealthCheckTimeout, hco.CriCtlPath, "--timeout="+hco.CriTimeout.String()+"--runtime-endpoint="+hco.CriSocketPath, "pods", "--latest"); err != nil {
|
||||
return false, nil
|
||||
}
|
||||
return true, nil
|
||||
|
||||
@@ -26,6 +26,7 @@ import (
|
||||
|
||||
const (
|
||||
DefaultLoopBackTime = 0 * time.Minute
|
||||
DefaultCriTimeout = 2 * time.Second
|
||||
DefaultCoolDownTime = 2 * time.Minute
|
||||
DefaultHealthCheckTimeout = 10 * time.Second
|
||||
CmdTimeout = 10 * time.Second
|
||||
|
||||
Reference in New Issue
Block a user