apiserver: plumb context with request deadline

- as soon as a request is received by the apiserver, determine the
  timeout of the request and set a new request context with the deadline.
- the timeout filter that times out non-long-running requests should
  use the request context as opposed to a fixed 60s wait today.
- admission and storage layer uses the same request context with the
  deadline specified.

we use the default timeout enforced by the apiserver:
- if the user has specified a timeout of 0s, this implies no timeout on the user's part.
- if the user has specified a timeout that exceeds the maximum deadline allowed by the apiserver.
This commit is contained in:
Abu Kashem
2020-11-26 23:53:20 -05:00
parent 99fc71b37a
commit e416c9e574
15 changed files with 748 additions and 92 deletions

View File

@@ -134,7 +134,7 @@ func testWebhookTimeout(t *testing.T, watchCache bool) {
{path: "/mutating/1/5s", timeoutSeconds: 3}, // from request
},
expectError: true,
errorContains: "request did not complete within requested timeout",
errorContains: "the server was unable to return a response in the time allotted",
},
}