req := restclient.Post().
Resource("pods").
Name(podname).
Namespace(namespace).
SubResource("exec").
Param("container", container).
Param("stdin", "true").
Param("stdout", "true").
Param("stderr", "true").
Param("command", "/bin/sh").Param("tty", "true")
req.VersionedParams(
&api.PodExecOptions{
Container: container,
Command: []string{"sh"},
Stdin: true,
Stdout: true,
Stderr: true,
TTY: true,
},
api.ParameterCodec,
)
executor, err := remotecommand.NewExecutor(
config, http.MethodPost, req.URL(),
)
err = executor.Stream(remotecommand.StreamOptions{
SupportedProtocols: remotecommandconsts.SupportedStreamingProtocols,
Stdin: r,
Stdout: w,
Stderr: os.Stderr,
Tty: true,
TerminalSizeQueue: t,
})