Use direct function call.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2018-03-13 04:41:21 +00:00
parent edb38dfecc
commit f0a500a390
16 changed files with 195 additions and 118 deletions

View File

@@ -22,12 +22,13 @@ import (
"math"
"net"
"golang.org/x/net/context"
k8snet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/tools/remotecommand"
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
"k8s.io/utils/exec"
ctrdutil "github.com/containerd/cri-containerd/pkg/containerd/util"
)
func newStreamServer(c *criContainerdService, addr, port string) (streaming.Server, error) {
@@ -56,7 +57,7 @@ func newStreamRuntime(c *criContainerdService) streaming.Runtime {
// returns non-zero exit code.
func (s *streamRuntime) Exec(containerID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser,
tty bool, resize <-chan remotecommand.TerminalSize) error {
exitCode, err := s.c.execInContainer(context.Background(), containerID, execOptions{
exitCode, err := s.c.execInContainer(ctrdutil.NamespacedContext(), containerID, execOptions{
cmd: cmd,
stdin: stdin,
stdout: stdout,
@@ -78,7 +79,7 @@ func (s *streamRuntime) Exec(containerID string, cmd []string, stdin io.Reader,
func (s *streamRuntime) Attach(containerID string, in io.Reader, out, err io.WriteCloser, tty bool,
resize <-chan remotecommand.TerminalSize) error {
return s.c.attachContainer(context.Background(), containerID, in, out, err, tty, resize)
return s.c.attachContainer(ctrdutil.NamespacedContext(), containerID, in, out, err, tty, resize)
}
func (s *streamRuntime) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error {