/
pod_exec.go
42 lines (30 loc) · 1.33 KB
/
pod_exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package fake
import (
"fmt"
"io"
icommon "github.com/apporbit/infranetes/pkg/common"
"github.com/apporbit/infranetes/pkg/vmserver/common"
"k8s.io/client-go/tools/remotecommand"
kubeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
"k8s.io/kubernetes/pkg/kubelet/server/streaming"
)
type podExecProvider struct{}
func (p *podExecProvider) ExecSync(req *kubeapi.ExecSyncRequest) (*kubeapi.ExecSyncResponse, error) {
return common.ExecSync(req)
}
func (f *podExecProvider) GetStreamingRuntime() streaming.Runtime {
return nil
}
func (d *podExecProvider) Logs(req *icommon.LogsRequest, stream icommon.VMServer_LogsServer) error {
return fmt.Errorf("Logging not currently support in vm mode yet")
}
type streamingRuntime struct{}
func (r *streamingRuntime) Exec(containerID string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error {
return common.Exec(cmd, in, out, err, tty, resize)
}
func (r *streamingRuntime) Attach(containerID string, in io.Reader, out, errw io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error {
return fmt.Errorf("Attach currently unsupported for VMs")
}
func (r *streamingRuntime) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error {
return common.PortForward(podSandboxID, port, stream)
}