Don't import pod util package from k/k

These are all simple changes that will not change w/o breaking API
changes upstream anyway.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2021-05-04 23:20:06 +00:00
parent e1486ade00
commit 405d5d63b1
4 changed files with 34 additions and 26 deletions

View File

@@ -27,7 +27,6 @@ import (
"github.com/virtual-kubelet/virtual-kubelet/internal/kubernetes/remotecommand"
"k8s.io/apimachinery/pkg/types"
remoteutils "k8s.io/client-go/tools/remotecommand"
api "k8s.io/kubernetes/pkg/apis/core"
)
// ContainerExecHandlerFunc defines the handler function used for "execing" into a
@@ -136,11 +135,18 @@ func HandleContainerExec(h ContainerExecHandlerFunc, opts ...ContainerExecHandle
})
}
const (
execTTYParam = "tty"
execStdinParam = "input"
execStdoutParam = "output"
execStderrParam = "error"
)
func getExecOptions(req *http.Request) (*remotecommand.Options, error) {
tty := req.FormValue(api.ExecTTYParam) == "1"
stdin := req.FormValue(api.ExecStdinParam) == "1"
stdout := req.FormValue(api.ExecStdoutParam) == "1"
stderr := req.FormValue(api.ExecStderrParam) == "1"
tty := req.FormValue(execTTYParam) == "1"
stdin := req.FormValue(execStdinParam) == "1"
stdout := req.FormValue(execStdoutParam) == "1"
stderr := req.FormValue(execStderrParam) == "1"
if tty && stderr {
return nil, errors.New("cannot exec with tty and stderr")
}