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:
committed by
Robbie Zhang
parent
b28bb7a070
commit
31a415c83a
@@ -79,7 +79,7 @@ func ApiServerHandlerExec(w http.ResponseWriter, req *http.Request) {
|
|||||||
supportedStreamProtocols := strings.Split(req.Header.Get("X-Stream-Protocol-Version"), ",")
|
supportedStreamProtocols := strings.Split(req.Header.Get("X-Stream-Protocol-Version"), ",")
|
||||||
|
|
||||||
q := req.URL.Query()
|
q := req.URL.Query()
|
||||||
command := q.Get("command")
|
command := q["command"]
|
||||||
|
|
||||||
// streamOpts := &remotecommand.Options{
|
// streamOpts := &remotecommand.Options{
|
||||||
// Stdin: (q.Get("input") == "1"),
|
// Stdin: (q.Get("input") == "1"),
|
||||||
@@ -99,5 +99,5 @@ func ApiServerHandlerExec(w http.ResponseWriter, req *http.Request) {
|
|||||||
idleTimeout := time.Second * 30
|
idleTimeout := time.Second * 30
|
||||||
streamCreationTimeout := 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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user