mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #106201 from yxxhero/fea_106111
Add more msg when exec probe timeout
This commit is contained in:
commit
39af75af30
@ -271,11 +271,11 @@ func (eic *execInContainer) Output() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) SetDir(dir string) {
|
func (eic *execInContainer) SetDir(dir string) {
|
||||||
//unimplemented
|
// unimplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) SetStdin(in io.Reader) {
|
func (eic *execInContainer) SetStdin(in io.Reader) {
|
||||||
//unimplemented
|
// unimplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) SetStdout(out io.Writer) {
|
func (eic *execInContainer) SetStdout(out io.Writer) {
|
||||||
@ -287,11 +287,11 @@ func (eic *execInContainer) SetStderr(out io.Writer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) SetEnv(env []string) {
|
func (eic *execInContainer) SetEnv(env []string) {
|
||||||
//unimplemented
|
// unimplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) Stop() {
|
func (eic *execInContainer) Stop() {
|
||||||
//unimplemented
|
// unimplemented
|
||||||
}
|
}
|
||||||
|
|
||||||
func (eic *execInContainer) Start() error {
|
func (eic *execInContainer) Start() error {
|
||||||
|
@ -72,7 +72,8 @@ func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
|
|||||||
timeoutErr, ok := err.(*TimeoutError)
|
timeoutErr, ok := err.(*TimeoutError)
|
||||||
if ok {
|
if ok {
|
||||||
if utilfeature.DefaultFeatureGate.Enabled(features.ExecProbeTimeout) {
|
if utilfeature.DefaultFeatureGate.Enabled(features.ExecProbeTimeout) {
|
||||||
return probe.Failure, string(data), nil
|
// When exec probe timeout, data is empty, so we should return timeoutErr.Error() as the stdout.
|
||||||
|
return probe.Failure, timeoutErr.Error(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
klog.Warningf("Exec probe timed out after %s but ExecProbeTimeout feature gate was disabled", timeoutErr.Timeout())
|
klog.Warningf("Exec probe timed out after %s but ExecProbeTimeout feature gate was disabled", timeoutErr.Timeout())
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/probe"
|
"k8s.io/kubernetes/pkg/probe"
|
||||||
)
|
)
|
||||||
@ -122,6 +123,8 @@ func TestExec(t *testing.T) {
|
|||||||
{probe.Unknown, true, "", "", fmt.Errorf("test error")},
|
{probe.Unknown, true, "", "", fmt.Errorf("test error")},
|
||||||
// Unhealthy
|
// Unhealthy
|
||||||
{probe.Failure, false, "Fail", "", &fakeExitError{true, 1}},
|
{probe.Failure, false, "Fail", "", &fakeExitError{true, 1}},
|
||||||
|
// Timeout
|
||||||
|
{probe.Failure, false, "", "command testcmd timed out", NewTimeoutError(fmt.Errorf("command testcmd timed out"), time.Second)},
|
||||||
}
|
}
|
||||||
for i, test := range tests {
|
for i, test := range tests {
|
||||||
fake := FakeCmd{
|
fake := FakeCmd{
|
||||||
|
Loading…
Reference in New Issue
Block a user