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.
This commit is contained in:
Abu Kashem
2020-10-30 16:30:05 -04:00
parent d20e3246ba
commit 83f869ee13
16 changed files with 392 additions and 67 deletions

View File

@@ -124,7 +124,7 @@ func testWebhookTimeout(t *testing.T, watchCache bool) {
},
{
name: "timed out client requests skip later mutating webhooks (regardless of failure policy) and fail",
timeoutSeconds: 3,
timeoutSeconds: 4,
mutatingWebhooks: []testWebhook{
{path: "/mutating/1/5s", policy: admissionv1beta1.Ignore, timeoutSeconds: 4},
{path: "/mutating/2/1s", policy: admissionv1beta1.Ignore, timeoutSeconds: 5},
@@ -133,8 +133,7 @@ func testWebhookTimeout(t *testing.T, watchCache bool) {
expectInvocations: []invocation{
{path: "/mutating/1/5s", timeoutSeconds: 3}, // from request
},
expectError: true,
errorContains: "request did not complete within requested timeout",
expectError: true,
},
}