mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Fixes issue #7352
readinessProbe calls livenessProbe.Exec.Command which cause "invalid memory address or nil pointer dereference".
This commit is contained in:
parent
a4316aa638
commit
4e05bc7035
@ -154,7 +154,7 @@ func (pb *prober) runProbe(p *api.Probe, pod *api.Pod, status api.PodStatus, con
|
|||||||
timeout := time.Duration(p.TimeoutSeconds) * time.Second
|
timeout := time.Duration(p.TimeoutSeconds) * time.Second
|
||||||
if p.Exec != nil {
|
if p.Exec != nil {
|
||||||
glog.V(4).Infof("Exec-Probe Pod: %v, Container: %v", pod, container)
|
glog.V(4).Infof("Exec-Probe Pod: %v, Container: %v", pod, container)
|
||||||
return pb.exec.Probe(pb.newExecInContainer(pod, container, containerID))
|
return pb.exec.Probe(pb.newExecInContainer(pod, container, containerID, p.Exec.Command))
|
||||||
}
|
}
|
||||||
if p.HTTPGet != nil {
|
if p.HTTPGet != nil {
|
||||||
port, err := extractPort(p.HTTPGet.Port, container)
|
port, err := extractPort(p.HTTPGet.Port, container)
|
||||||
@ -227,9 +227,9 @@ type execInContainer struct {
|
|||||||
run func() ([]byte, error)
|
run func() ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *prober) newExecInContainer(pod *api.Pod, container api.Container, containerID string) exec.Cmd {
|
func (p *prober) newExecInContainer(pod *api.Pod, container api.Container, containerID string, cmd []string) exec.Cmd {
|
||||||
return execInContainer{func() ([]byte, error) {
|
return execInContainer{func() ([]byte, error) {
|
||||||
return p.runner.RunInContainer(containerID, container.LivenessProbe.Exec.Command)
|
return p.runner.RunInContainer(containerID, cmd)
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user