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
e80ad2be
Commit
e80ad2be
authored
Jul 25, 2016
by
Yu-Ju Hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dockershim: add support for legacy methods
parent
03971d39
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
7 deletions
+19
-7
legacy.go
pkg/kubelet/dockershim/legacy.go
+3
-2
docker_manager.go
pkg/kubelet/dockertools/docker_manager.go
+16
-5
No files found.
pkg/kubelet/dockershim/legacy.go
View file @
e80ad2be
...
...
@@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/dockertools"
"k8s.io/kubernetes/pkg/util/term"
)
...
...
@@ -31,11 +32,11 @@ import (
// TODO: implement the methods in this file.
func
(
ds
*
dockerService
)
AttachContainer
(
id
kubecontainer
.
ContainerID
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
WriteCloser
,
tty
bool
,
resize
<-
chan
term
.
Size
)
(
err
error
)
{
return
fmt
.
Errorf
(
"not implemented"
)
return
dockertools
.
AttachContainer
(
ds
.
client
,
id
,
stdin
,
stdout
,
stderr
,
tty
,
resize
)
}
func
(
ds
*
dockerService
)
GetContainerLogs
(
pod
*
api
.
Pod
,
containerID
kubecontainer
.
ContainerID
,
logOptions
*
api
.
PodLogOptions
,
stdout
,
stderr
io
.
Writer
)
(
err
error
)
{
return
fmt
.
Errorf
(
"not implemented"
)
return
dockertools
.
GetContainerLogs
(
ds
.
client
,
pod
,
containerID
,
logOptions
,
stdout
,
stderr
)
}
func
(
ds
*
dockerService
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
...
...
pkg/kubelet/dockertools/docker_manager.go
View file @
e80ad2be
...
...
@@ -285,7 +285,13 @@ func NewDockerManager(
// stream the log. Set 'follow' to false and specify the number of lines (e.g.
// "100" or "all") to tail the log.
// TODO: Make 'RawTerminal' option flagable.
func
(
dm
*
DockerManager
)
GetContainerLogs
(
pod
*
api
.
Pod
,
containerID
kubecontainer
.
ContainerID
,
logOptions
*
api
.
PodLogOptions
,
stdout
,
stderr
io
.
Writer
)
(
err
error
)
{
func
(
dm
*
DockerManager
)
GetContainerLogs
(
pod
*
api
.
Pod
,
containerID
kubecontainer
.
ContainerID
,
logOptions
*
api
.
PodLogOptions
,
stdout
,
stderr
io
.
Writer
)
error
{
return
GetContainerLogs
(
dm
.
client
,
pod
,
containerID
,
logOptions
,
stdout
,
stderr
)
}
// Temporarily export this function to share with dockershim.
// TODO: clean this up.
func
GetContainerLogs
(
client
DockerInterface
,
pod
*
api
.
Pod
,
containerID
kubecontainer
.
ContainerID
,
logOptions
*
api
.
PodLogOptions
,
stdout
,
stderr
io
.
Writer
)
error
{
var
since
int64
if
logOptions
.
SinceSeconds
!=
nil
{
t
:=
unversioned
.
Now
()
.
Add
(
-
time
.
Duration
(
*
logOptions
.
SinceSeconds
)
*
time
.
Second
)
...
...
@@ -309,8 +315,7 @@ func (dm *DockerManager) GetContainerLogs(pod *api.Pod, containerID kubecontaine
ErrorStream
:
stderr
,
RawTerminal
:
false
,
}
err
=
dm
.
client
.
Logs
(
containerID
.
ID
,
opts
,
sopts
)
return
return
client
.
Logs
(
containerID
.
ID
,
opts
,
sopts
)
}
var
(
...
...
@@ -1123,10 +1128,16 @@ func (dm *DockerManager) ExecInContainer(containerID kubecontainer.ContainerID,
}
func
(
dm
*
DockerManager
)
AttachContainer
(
containerID
kubecontainer
.
ContainerID
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
WriteCloser
,
tty
bool
,
resize
<-
chan
term
.
Size
)
error
{
return
AttachContainer
(
dm
.
client
,
containerID
,
stdin
,
stdout
,
stderr
,
tty
,
resize
)
}
// Temporarily export this function to share with dockershim.
// TODO: clean this up.
func
AttachContainer
(
client
DockerInterface
,
containerID
kubecontainer
.
ContainerID
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
WriteCloser
,
tty
bool
,
resize
<-
chan
term
.
Size
)
error
{
// Have to start this before the call to client.AttachToContainer because client.AttachToContainer is a blocking
// call :-( Otherwise, resize events don't get processed and the terminal never resizes.
kubecontainer
.
HandleResizing
(
resize
,
func
(
size
term
.
Size
)
{
dm
.
client
.
ResizeContainerTTY
(
containerID
.
ID
,
int
(
size
.
Height
),
int
(
size
.
Width
))
client
.
ResizeContainerTTY
(
containerID
.
ID
,
int
(
size
.
Height
),
int
(
size
.
Width
))
})
// TODO(random-liu): Do we really use the *Logs* field here?
...
...
@@ -1142,7 +1153,7 @@ func (dm *DockerManager) AttachContainer(containerID kubecontainer.ContainerID,
ErrorStream
:
stderr
,
RawTerminal
:
tty
,
}
return
dm
.
client
.
AttachToContainer
(
containerID
.
ID
,
opts
,
sopts
)
return
client
.
AttachToContainer
(
containerID
.
ID
,
opts
,
sopts
)
}
func
noPodInfraContainerError
(
podName
,
podNamespace
string
)
error
{
...
...
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