diff --git a/pkg/api/v1beta1/defaults.go b/pkg/api/v1beta1/defaults.go index 743ebbf2b40..19cb2e0228a 100644 --- a/pkg/api/v1beta1/defaults.go +++ b/pkg/api/v1beta1/defaults.go @@ -75,5 +75,10 @@ func init() { obj.DNSPolicy = DNSClusterFirst } }, + func(obj *LivenessProbe) { + if obj.TimeoutSeconds == 0 { + obj.TimeoutSeconds = 1 + } + }, ) } diff --git a/pkg/api/v1beta2/defaults.go b/pkg/api/v1beta2/defaults.go index 0897186b855..4f385884e08 100644 --- a/pkg/api/v1beta2/defaults.go +++ b/pkg/api/v1beta2/defaults.go @@ -75,5 +75,10 @@ func init() { obj.DNSPolicy = DNSClusterFirst } }, + func(obj *LivenessProbe) { + if obj.TimeoutSeconds == 0 { + obj.TimeoutSeconds = 1 + } + }, ) } diff --git a/pkg/api/v1beta3/defaults.go b/pkg/api/v1beta3/defaults.go index 2c908e6c1ee..f312b0ca2c2 100644 --- a/pkg/api/v1beta3/defaults.go +++ b/pkg/api/v1beta3/defaults.go @@ -70,5 +70,10 @@ func init() { obj.DNSPolicy = DNSClusterFirst } }, + func(obj *Probe) { + if obj.TimeoutSeconds == 0 { + obj.TimeoutSeconds = 1 + } + }, ) } diff --git a/pkg/kubelet/probe.go b/pkg/kubelet/probe.go index b2955e257ef..382b6f4da45 100644 --- a/pkg/kubelet/probe.go +++ b/pkg/kubelet/probe.go @@ -36,10 +36,7 @@ import ( "github.com/golang/glog" ) -const ( - defaultProbeTimeout = 1 * time.Second - maxProbeRetries = 3 -) +const maxProbeRetries = 3 // probeContainer executes the given probe on a container and returns the result. // If the probe is nil this returns Success. If the probe's initial delay has not passed @@ -71,11 +68,7 @@ func (kl *Kubelet) probeContainer(p *api.Probe, } func (kl *Kubelet) runProbe(p *api.Probe, podFullName string, podUID types.UID, status api.PodStatus, container api.Container) (probe.Result, error) { - timeout := defaultProbeTimeout - secs := p.TimeoutSeconds - if secs > 0 { - timeout = time.Duration(secs) * time.Second - } + timeout := time.Duration(p.TimeoutSeconds) * time.Second if p.Exec != nil { return kl.prober.exec.Probe(kl.newExecInContainer(podFullName, podUID, container)) }