mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #77287 from tedyu/kube-long-running
Use map to check for long-running request
This commit is contained in:
commit
6a8a368291
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user