Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
ef29b836
Commit
ef29b836
authored
Aug 04, 2017
by
Lantao Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set ExecSync timeout in liveness prober.
parent
90a45b2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
kuberuntime_container.go
pkg/kubelet/kuberuntime/kuberuntime_container.go
+1
-1
remote_runtime.go
pkg/kubelet/remote/remote_runtime.go
+9
-3
No files found.
pkg/kubelet/kuberuntime/kuberuntime_container.go
View file @
ef29b836
...
...
@@ -763,7 +763,7 @@ func (m *kubeGenericRuntimeManager) GetAttach(id kubecontainer.ContainerID, stdi
// RunInContainer synchronously executes the command in the container, and returns the output.
func
(
m
*
kubeGenericRuntimeManager
)
RunInContainer
(
id
kubecontainer
.
ContainerID
,
cmd
[]
string
,
timeout
time
.
Duration
)
([]
byte
,
error
)
{
stdout
,
stderr
,
err
:=
m
.
runtimeService
.
ExecSync
(
id
.
ID
,
cmd
,
0
)
stdout
,
stderr
,
err
:=
m
.
runtimeService
.
ExecSync
(
id
.
ID
,
cmd
,
timeout
)
// NOTE(tallclair): This does not correctly interleave stdout & stderr, but should be sufficient
// for logging purposes. A combined output option will need to be added to the ExecSyncRequest
// if more precise output ordering is ever required.
...
...
pkg/kubelet/remote/remote_runtime.go
View file @
ef29b836
...
...
@@ -23,6 +23,7 @@ import (
"time"
"github.com/golang/glog"
"golang.org/x/net/context"
"google.golang.org/grpc"
internalapi
"k8s.io/kubernetes/pkg/kubelet/apis/cri"
...
...
@@ -291,9 +292,14 @@ func (r *RemoteRuntimeService) ContainerStatus(containerID string) (*runtimeapi.
// ExecSync executes a command in the container, and returns the stdout output.
// If command exits with a non-zero exit code, an error is returned.
func
(
r
*
RemoteRuntimeService
)
ExecSync
(
containerID
string
,
cmd
[]
string
,
timeout
time
.
Duration
)
(
stdout
[]
byte
,
stderr
[]
byte
,
err
error
)
{
ctx
,
cancel
:=
getContextWithTimeout
(
timeout
)
if
timeout
==
0
{
// Do not set timeout when timeout is 0.
// Do not set timeout when timeout is 0.
var
ctx
context
.
Context
var
cancel
context
.
CancelFunc
if
timeout
!=
0
{
// Use timeout + default timeout (2 minutes) as timeout to leave some time for
// the runtime to do cleanup.
ctx
,
cancel
=
getContextWithTimeout
(
r
.
timeout
+
timeout
)
}
else
{
ctx
,
cancel
=
getContextWithCancel
()
}
defer
cancel
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment