diff --git a/pkg/kubelet/dockershim/docker_service.go b/pkg/kubelet/dockershim/docker_service.go index 5ffe8829312..59eed62cd49 100644 --- a/pkg/kubelet/dockershim/docker_service.go +++ b/pkg/kubelet/dockershim/docker_service.go @@ -18,7 +18,6 @@ package dockershim import ( "fmt" - "io" "github.com/golang/glog" "github.com/golang/protobuf/proto" @@ -33,7 +32,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/network/cni" "k8s.io/kubernetes/pkg/kubelet/network/kubenet" "k8s.io/kubernetes/pkg/kubelet/server/streaming" - "k8s.io/kubernetes/pkg/util/term" ) const ( @@ -132,25 +130,14 @@ func NewDockerService(client dockertools.DockerInterface, seccompProfileRoot str return ds, nil } -// DockerService is an interface that embeds both the new RuntimeService and -// ImageService interfaces, while including DockerLegacyService for backward -// compatibility. +// DockerService is an interface that embeds the new RuntimeService and +// ImageService interfaces. type DockerService interface { internalApi.RuntimeService internalApi.ImageManagerService - DockerLegacyService Start() error } -// DockerLegacyService is an interface that embeds all legacy methods for -// backward compatibility. -type DockerLegacyService interface { - // Supporting legacy methods for docker. - LegacyExec(containerID kubecontainer.ContainerID, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) error - LegacyAttach(id kubecontainer.ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) error - LegacyPortForward(sandboxID string, port uint16, stream io.ReadWriteCloser) error -} - type dockerService struct { seccompProfileRoot string client dockertools.DockerInterface diff --git a/pkg/kubelet/dockershim/legacy.go b/pkg/kubelet/dockershim/legacy.go deleted file mode 100644 index 683e3755310..00000000000 --- a/pkg/kubelet/dockershim/legacy.go +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright 2016 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package dockershim - -import ( - "io" - - kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/util/term" -) - -// This file implements the functions that are needed for backward -// compatibility. Therefore, it imports various kubernetes packages -// directly. - -// TODO: implement the methods in this file. -func (ds *dockerService) LegacyAttach(id kubecontainer.ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) (err error) { - return ds.streamingRuntime.Attach(id.ID, stdin, stdout, stderr, resize) -} - -func (ds *dockerService) LegacyPortForward(sandboxID string, port uint16, stream io.ReadWriteCloser) error { - return ds.streamingRuntime.PortForward(sandboxID, int32(port), stream) -} - -func (ds *dockerService) LegacyExec(containerID kubecontainer.ContainerID, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) error { - return ds.streamingRuntime.Exec(containerID.ID, cmd, stdin, stdout, stderr, tty, resize) -} diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 80209b02684..30ae9111df9 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -567,13 +567,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub // functions in CRI. // TODO: Remove this hack after CRI is fully implemented. // TODO: Move the instrumented interface wrapping into kuberuntime. - runtimeService = &struct { - internalApi.RuntimeService - dockershim.DockerLegacyService - }{ - RuntimeService: kuberuntime.NewInstrumentedRuntimeService(rs), - DockerLegacyService: ds, - } + runtimeService = kuberuntime.NewInstrumentedRuntimeService(rs) imageService = is case "remote": runtimeService, imageService, err = getRuntimeAndImageServices(kubeCfg) diff --git a/pkg/kubelet/kuberuntime/kuberuntime_container.go b/pkg/kubelet/kuberuntime/kuberuntime_container.go index d4b388ecfc0..9f6debf13d2 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_container.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_container.go @@ -33,7 +33,6 @@ import ( "k8s.io/kubernetes/pkg/api/unversioned" runtimeApi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/kubelet/dockershim" "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/kubelet/qos" "k8s.io/kubernetes/pkg/kubelet/types" @@ -42,7 +41,6 @@ import ( utilruntime "k8s.io/kubernetes/pkg/util/runtime" "k8s.io/kubernetes/pkg/util/selinux" "k8s.io/kubernetes/pkg/util/sets" - "k8s.io/kubernetes/pkg/util/term" ) // startContainer starts a container and returns a message indicates why it is failed on error. @@ -653,17 +651,6 @@ func findNextInitContainerToRun(pod *api.Pod, podStatus *kubecontainer.PodStatus return nil, &pod.Spec.InitContainers[0], false } -// AttachContainer attaches to the container's console -// TODO: Remove this method once the indirect streaming path is fully functional. -func (m *kubeGenericRuntimeManager) AttachContainer(id kubecontainer.ContainerID, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size) (err error) { - // Use `docker attach` directly for in-process docker integration for - // now to unblock other tests. - if ds, ok := m.runtimeService.(dockershim.DockerLegacyService); ok { - return ds.LegacyAttach(id, stdin, stdout, stderr, tty, resize) - } - return fmt.Errorf("not implemented") -} - // GetContainerLogs returns logs of a specific container. func (m *kubeGenericRuntimeManager) GetContainerLogs(pod *api.Pod, containerID kubecontainer.ContainerID, logOptions *api.PodLogOptions, stdout, stderr io.Writer) (err error) { status, err := m.runtimeService.ContainerStatus(containerID.ID) @@ -714,19 +701,6 @@ func (m *kubeGenericRuntimeManager) RunInContainer(id kubecontainer.ContainerID, return append(stdout, stderr...), err } -// Runs the command in the container of the specified pod using nsenter. -// Attaches the processes stdin, stdout, and stderr. Optionally uses a -// tty. -// TODO: Remove this method once the indirect streaming path is fully functional. -func (m *kubeGenericRuntimeManager) ExecInContainer(containerID kubecontainer.ContainerID, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan term.Size, timeout time.Duration) error { - // Use `docker exec` directly for in-process docker integration for - // now to unblock other tests. - if ds, ok := m.runtimeService.(dockershim.DockerLegacyService); ok { - return ds.LegacyExec(containerID, cmd, stdin, stdout, stderr, tty, resize) - } - return fmt.Errorf("not implemented") -} - // removeContainer removes the container and the container logs. // Notice that we remove the container logs first, so that container will not be removed if // container logs are failed to be removed, and kubelet will retry this later. This guarantees diff --git a/pkg/kubelet/kuberuntime/kuberuntime_manager.go b/pkg/kubelet/kuberuntime/kuberuntime_manager.go index 159f4dce33c..587695f2df5 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_manager.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_manager.go @@ -19,7 +19,6 @@ package kuberuntime import ( "errors" "fmt" - "io" "os" "time" @@ -33,7 +32,6 @@ import ( internalApi "k8s.io/kubernetes/pkg/kubelet/api" runtimeApi "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/runtime" kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" - "k8s.io/kubernetes/pkg/kubelet/dockershim" "k8s.io/kubernetes/pkg/kubelet/events" "k8s.io/kubernetes/pkg/kubelet/images" "k8s.io/kubernetes/pkg/kubelet/lifecycle" @@ -114,8 +112,6 @@ type KubeGenericRuntime interface { kubecontainer.Runtime kubecontainer.IndirectStreamingRuntime kubecontainer.ContainerCommandRunner - // TODO(timstclair): Remove this once the indirect path is fully functional. - kubecontainer.DirectStreamingRuntime } // NewKubeGenericRuntimeManager creates a new kubeGenericRuntimeManager @@ -919,24 +915,6 @@ func (m *kubeGenericRuntimeManager) GetPodContainerID(pod *kubecontainer.Pod) (k return pod.Sandboxes[0].ID, nil } -// Forward the specified port from the specified pod to the stream. -// TODO: Remove this method once the indirect streaming path is fully functional. -func (m *kubeGenericRuntimeManager) PortForward(pod *kubecontainer.Pod, port uint16, stream io.ReadWriteCloser) error { - formattedPod := kubecontainer.FormatPod(pod) - if len(pod.Sandboxes) == 0 { - glog.Errorf("No sandboxes are found for pod %q", formattedPod) - return fmt.Errorf("sandbox for pod %q not found", formattedPod) - } - - // Use docker portforward directly for in-process docker integration - // now to unblock other tests. - if ds, ok := m.runtimeService.(dockershim.DockerLegacyService); ok { - return ds.LegacyPortForward(pod.Sandboxes[0].ID.ID, port, stream) - } - - return fmt.Errorf("not implemented") -} - // UpdatePodCIDR is just a passthrough method to update the runtimeConfig of the shim // with the podCIDR supplied by the kubelet. func (m *kubeGenericRuntimeManager) UpdatePodCIDR(podCIDR string) error {