Merge pull request #77287 from tedyu/kube-long-running

Use map to check for long-running request
This commit is contained in:
Kubernetes Prow Robot 2019-05-02 16:23:09 -07:00 committed by GitHub
commit 6a8a368291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -824,15 +824,17 @@ func trimURLPath(path string) string {
return parts[0]
}
var longRunningRequestPathMap = map[string]bool{
"exec": true,
"attach": true,
"portforward": true,
"debug": true,
}
// isLongRunningRequest determines whether the request is long-running or not.
func isLongRunningRequest(path string) bool {
longRunningRequestPaths := []string{"exec", "attach", "portforward", "debug"}
for _, p := range longRunningRequestPaths {
if p == path {
return true
}
}
return false
_, ok := longRunningRequestPathMap[path]
return ok
}
// ServeHTTP responds to HTTP requests on the Kubelet.