// GetPodContainerID gets pod sandbox ID func (m *kubeGenericRuntimeManager) GetPodContainerID(pod *kubecontainer.Pod) (kubecontainer.ContainerID, error) { formattedPod := kubecontainer.FormatPod(pod) if len(pod.Sandboxes) == 0 { glog.Errorf("No sandboxes are found for pod %q", formattedPod) return kubecontainer.ContainerID{}, fmt.Errorf("sandboxes for pod %q not found", formattedPod) } // return sandboxID of the first sandbox since it is the latest one 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") }