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
dd14f636
Commit
dd14f636
authored
Sep 30, 2016
by
Pengfei Ni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fake docker portfoward for in-process docker CRI integration
parent
cfb833e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
legacy.go
pkg/kubelet/dockershim/legacy.go
+1
-1
docker_manager.go
pkg/kubelet/dockertools/docker_manager.go
+6
-1
kuberuntime_manager.go
pkg/kubelet/kuberuntime/kuberuntime_manager.go
+8
-0
No files found.
pkg/kubelet/dockershim/legacy.go
View file @
dd14f636
...
@@ -40,7 +40,7 @@ func (ds *dockerService) GetContainerLogs(pod *api.Pod, containerID kubecontaine
...
@@ -40,7 +40,7 @@ func (ds *dockerService) GetContainerLogs(pod *api.Pod, containerID kubecontaine
}
}
func
(
ds
*
dockerService
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
func
(
ds
*
dockerService
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
return
fmt
.
Errorf
(
"not implemented"
)
return
dockertools
.
PortForward
(
ds
.
client
,
pod
,
port
,
stream
)
}
}
func
(
ds
*
dockerService
)
ExecInContainer
(
containerID
kubecontainer
.
ContainerID
,
cmd
[]
string
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
WriteCloser
,
tty
bool
,
resize
<-
chan
term
.
Size
)
error
{
func
(
ds
*
dockerService
)
ExecInContainer
(
containerID
kubecontainer
.
ContainerID
,
cmd
[]
string
,
stdin
io
.
Reader
,
stdout
,
stderr
io
.
WriteCloser
,
tty
bool
,
resize
<-
chan
term
.
Size
)
error
{
...
...
pkg/kubelet/dockertools/docker_manager.go
View file @
dd14f636
...
@@ -1273,11 +1273,16 @@ func noPodInfraContainerError(podName, podNamespace string) error {
...
@@ -1273,11 +1273,16 @@ func noPodInfraContainerError(podName, podNamespace string) error {
// - should we support nsenter + socat on the host? (current impl)
// - should we support nsenter + socat on the host? (current impl)
// - should we support nsenter + socat in a container, running with elevated privs and --pid=host?
// - should we support nsenter + socat in a container, running with elevated privs and --pid=host?
func
(
dm
*
DockerManager
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
func
(
dm
*
DockerManager
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
return
PortForward
(
dm
.
client
,
pod
,
port
,
stream
)
}
// Temporarily export this function to share with dockershim.
func
PortForward
(
client
DockerInterface
,
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
podInfraContainer
:=
pod
.
FindContainerByName
(
PodInfraContainerName
)
podInfraContainer
:=
pod
.
FindContainerByName
(
PodInfraContainerName
)
if
podInfraContainer
==
nil
{
if
podInfraContainer
==
nil
{
return
noPodInfraContainerError
(
pod
.
Name
,
pod
.
Namespace
)
return
noPodInfraContainerError
(
pod
.
Name
,
pod
.
Namespace
)
}
}
container
,
err
:=
dm
.
client
.
InspectContainer
(
podInfraContainer
.
ID
.
ID
)
container
,
err
:=
client
.
InspectContainer
(
podInfraContainer
.
ID
.
ID
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
pkg/kubelet/kuberuntime/kuberuntime_manager.go
View file @
dd14f636
...
@@ -32,6 +32,7 @@ import (
...
@@ -32,6 +32,7 @@ import (
internalApi
"k8s.io/kubernetes/pkg/kubelet/api"
internalApi
"k8s.io/kubernetes/pkg/kubelet/api"
runtimeApi
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
runtimeApi
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
kubecontainer
"k8s.io/kubernetes/pkg/kubelet/container"
"k8s.io/kubernetes/pkg/kubelet/dockershim"
"k8s.io/kubernetes/pkg/kubelet/events"
"k8s.io/kubernetes/pkg/kubelet/events"
"k8s.io/kubernetes/pkg/kubelet/images"
"k8s.io/kubernetes/pkg/kubelet/images"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
...
@@ -851,5 +852,12 @@ func (m *kubeGenericRuntimeManager) GetPodContainerID(pod *kubecontainer.Pod) (k
...
@@ -851,5 +852,12 @@ func (m *kubeGenericRuntimeManager) GetPodContainerID(pod *kubecontainer.Pod) (k
// Forward the specified port from the specified pod to the stream.
// Forward the specified port from the specified pod to the stream.
func
(
m
*
kubeGenericRuntimeManager
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
func
(
m
*
kubeGenericRuntimeManager
)
PortForward
(
pod
*
kubecontainer
.
Pod
,
port
uint16
,
stream
io
.
ReadWriteCloser
)
error
{
// Use docker portforward directly for in-process docker integration
// now to unblock other tests.
// TODO: remove this hack after portforward is defined in CRI.
if
ds
,
ok
:=
m
.
runtimeService
.
(
dockershim
.
DockerLegacyService
);
ok
{
return
ds
.
PortForward
(
pod
,
port
,
stream
)
}
return
fmt
.
Errorf
(
"not implemented"
)
return
fmt
.
Errorf
(
"not implemented"
)
}
}
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