Fix bug in exec command retrieval (#265)

The exec command as extracted from the query comprises only the first
part of the command and does not include potentially supplied
parameters. E.g.,
  $ kubectl exec pod -- ls -t /usr
  > command: ls

This change fixes the problem by moving away from the Query.Get API.
  $ kubectl exec pod -- ls -t /usr
  > command: [ls -t /usr]
This commit is contained in:
Daniel Mueller
2018-07-25 11:54:22 -07:00
committed by Robbie Zhang
parent b28bb7a070
commit 31a415c83a

View File

@@ -79,7 +79,7 @@ func ApiServerHandlerExec(w http.ResponseWriter, req *http.Request) {
supportedStreamProtocols := strings.Split(req.Header.Get("X-Stream-Protocol-Version"), ",")
q := req.URL.Query()
command := q.Get("command")
command := q["command"]
// streamOpts := &remotecommand.Options{
// Stdin: (q.Get("input") == "1"),
@@ -99,5 +99,5 @@ func ApiServerHandlerExec(w http.ResponseWriter, req *http.Request) {
idleTimeout := time.Second * 30
streamCreationTimeout := time.Second * 30
remotecommand.ServeExec(w, req, p, fmt.Sprintf("%s-%s", namespace, pod), "", container, []string{command}, streamOpts, idleTimeout, streamCreationTimeout, supportedStreamProtocols)
remotecommand.ServeExec(w, req, p, fmt.Sprintf("%s-%s", namespace, pod), "", container, command, streamOpts, idleTimeout, streamCreationTimeout, supportedStreamProtocols)
}