mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +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) {
|
||||
//unimplemented
|
||||
// unimplemented
|
||||
}
|
||||
|
||||
func (eic *execInContainer) SetStdin(in io.Reader) {
|
||||
//unimplemented
|
||||
// unimplemented
|
||||
}
|
||||
|
||||
func (eic *execInContainer) SetStdout(out io.Writer) {
|
||||
@ -287,11 +287,11 @@ func (eic *execInContainer) SetStderr(out io.Writer) {
|
||||
}
|
||||
|
||||
func (eic *execInContainer) SetEnv(env []string) {
|
||||
//unimplemented
|
||||
// unimplemented
|
||||
}
|
||||
|
||||
func (eic *execInContainer) Stop() {
|
||||
//unimplemented
|
||||
// unimplemented
|
||||
}
|
||||
|
||||
func (eic *execInContainer) Start() error {
|
||||
|
@ -72,7 +72,8 @@ func (pr execProber) Probe(e exec.Cmd) (probe.Result, string, error) {
|
||||
timeoutErr, ok := err.(*TimeoutError)
|
||||
if ok {
|
||||
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())
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"k8s.io/kubernetes/pkg/probe"
|
||||
)
|
||||
@ -122,6 +123,8 @@ func TestExec(t *testing.T) {
|
||||
{probe.Unknown, true, "", "", fmt.Errorf("test error")},
|
||||
// Unhealthy
|
||||
{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 {
|
||||
fake := FakeCmd{
|
||||
|
Loading…
Reference in New Issue
Block a user