Commit Graph

130 Commits

Author SHA1 Message Date
Abu Kashem 863c48fbc2 apf: rename WorkEstimate.Seats to InitialSeats
Kubernetes-commit: 5d67896adedbce27f01b59eb5f2054919a047f2b
2021-09-24 09:41:38 -04:00
Mike Spreitzer fa81877012 Rename httplog entry from "apf_d" to "apf_fd"
Because it is for the "Flow Distinguisher".

Kubernetes-commit: be717abb8317ed309a9d2139856a8e87fad76a16
2021-09-15 17:10:11 -04:00
Abu Kashem db8aff032b apf: update apf logic to use v1beta2
Kubernetes-commit: 28f2b42a4116a9223113e8b152e02a4f1e602ff4
2021-08-16 17:53:57 -04:00
Mike Spreitzer 06debee006 Remove race condition from TestApfExecuteWatchRequestsWithInitializationSignal
Kubernetes-commit: b78baaad5ff4bcaf12e5de9e7e35f8fadba1c25b
2021-08-31 17:40:03 -04:00
Abu Kashem 033ff70436 Revert "Merge pull request #104281 from tkashem/not-ready-429"
This reverts commit fc5863b8b276e0789f717859e8cce58d7d060181, reversing
changes made to 027fe2554fd18343b8be39eddc8ff6570a6c390f.

Kubernetes-commit: f9f08725907b7db2104ee5fe9f82ab0752726533
2021-08-31 10:10:46 -04:00
Maciej Borsz 02f98184b3 Add APF's priorityLevel to httplog.go
Kubernetes-commit: 6db63869b0fd0551382dec1b30b649fda4289444
2021-08-13 13:00:07 +02:00
Abu Kashem f3ae70d0cf send retry-after until ready
Kubernetes-commit: 6e3923d0a4f4720d2d9f628eb9c073d2d3ee291a
2021-08-10 12:03:21 -04:00
Abu Kashem 030819c510 apiserver: refactor WithRetryAfter server filter
Kubernetes-commit: 83889ae5940036d89b9822a1e38f0f939308e408
2021-08-09 18:25:29 -04:00
Abu Kashem ffb869e08f apiserver: add a new mode for graceful termination
add a new mode for graceful termination with the new server run option
'shutdown-send-retry-after'
- shutdown-send-retry-after=true: we initiate shutdown of the
  HTTP Server when all in-flight request(s) have been drained. during
  this window all incoming requests are rejected with status code
  429 and the following response headers:
    - 'Retry-After: N' - client should retry after N seconds
    - 'Connection: close' - tear down the TCP connection
- shutdown-send-retry-after=false: we initiate shutdown of the
  HTTP Server as soon as shutdown-delay-duration has elapsed. This
  is in keeping with the current behavior.

Kubernetes-commit: 3182b69e970bd1fd036ff839fdf811f14e790244
2021-07-14 10:39:29 -04:00
wojtekt b4c306e1e8 Rename width to workEstimate in P&F code
Kubernetes-commit: 73211256e8f15cf84ee69d6fe8258c3a912e0f94
2021-07-13 15:10:58 +02:00
wojtekt 280558d490 Add additional APF test for handling other panic types
Kubernetes-commit: faed88bb7200cc4693b7a3f9cecff1a99ea1fc95
2021-07-14 16:36:38 +02:00
wojtekt 242c8c8a1c Optimize APF support for watch initialization to fix the pod startup time regression.
Kubernetes-commit: ef435b85b47618d0d463ac93e9758d75c2998681
2021-07-13 10:22:30 +02:00
wojtekt fbc127e994 Add watch tracker to APF for request cost estimation
Kubernetes-commit: cea1dcfeed2fc4e8ab89cd43e5a0e402251c8df5
2021-06-15 10:49:42 +02:00
Abu Kashem cf5c77fde9 apf: add additional latency into width
Kubernetes-commit: 24e19229101d242d924ce98a562be3864dde9eae
2021-06-27 12:45:24 -04:00
Antonio Ojea 5a7fb85083 deflake TestClientReceivedGOAWAY test
The test was flaking because the test was creating more connections
than expected.

Disabling connection pooling removes the flakes, and no more connections
are created that the necessary.

Kubernetes-commit: 4d11c3cd8cb18c1e246a7a6b8e9a791177c49d31
2021-06-18 00:38:02 +02:00
Abu Kashem 3c7f54740f apf: add plumbing to estimate width" of a request
- add plumbing that allows us to estimated "width" of a request
- the default implementation returns 1 as the "width" of all
  incoming requests, this is in keeping with the current behavior.

Kubernetes-commit: 9b72eb1929a64b9d5a5234090a631ba312fb4d41
2021-05-11 07:03:05 -04:00
Abu Kashem 9421ee44c4 apf: fix flake in test
Kubernetes-commit: 8847a25026711f51ae694fe8288e285a48e70675
2021-06-01 20:07:51 -04:00
wojtekt 9b71cff19c Fix watch rejections in P&F filter
Kubernetes-commit: 8054b0f808d116658ac086e4b71fb34d1502cd57
2021-06-02 08:22:29 +02:00
wojtekt d000916ae7 Address watch panics in P&F handler and extend testing.
Kubernetes-commit: d9d51541a87ec627160d7d6a1fcd4b357a0fa493
2021-05-27 14:49:54 +02:00
wojtekt 5290a24345 Implement support for watch initialization in P&F
Kubernetes-commit: 0cc217647ca8be0820973b970124a072c27b6575
2021-05-07 12:49:06 +02:00
Abu Kashem b84fa01322 add more context to post timeout request activities
Kubernetes-commit: 66587afb60b10569aa4ed35d53a4a91fcc40abd2
2021-04-09 12:09:35 -04:00
Abu Kashem bb69e234a6 apiserver: improve correlation by using the audit ID
- when we forward the request to the aggregated server, set the audit
  ID in the new request header. This allows audit logs from aggregated
  apiservers to be correlated with the kube-apiserver.
- use the audit ID in the current tracer
- use the audit ID in httplog
- when a request panics, log an error with the audit ID.

Kubernetes-commit: b607ca1bf3e1cf6152c446ea61ac7fdd9014e1f1
2021-03-02 19:27:43 -05:00
Abu Kashem f1a76db888 apiserver: manage audit ID associated with a request
Manage the audit ID early in the request handling logic so that it can
be used by different layers to improve correlation.
- If the caller does not specify a value for Audit-ID in the request
  header, we generate a new audit ID
- If a user specified Audit-ID is too large, we truncate it
- We echo the Audit-ID value to the caller via the response
  Header 'Audit-ID'

Kubernetes-commit: 31653bacb9b979ee2f878ebece7e25f79d3f9aa6
2021-03-02 19:22:39 -05:00
Abu Kashem 1e7338b1ea use request received timestamp in httplog
Kubernetes-commit: 71199664be6d26e435a78566818379ff43110352
2021-03-02 18:05:51 -05:00
answer1991 db01b261c4 disable flaky TestClientReceivedGOAWAY test case
Kubernetes-commit: d6f9369126dcaa3c94902108ec1aa3d01f658163
2021-03-15 21:12:22 +08:00
answer1991 43c20c5bfe enable goaway testcases which will not flake any more with new golang.org/x/net version.
Kubernetes-commit: f1b23fe7679f3c650cabcd13a60b5a08b8cda36f
2021-02-05 23:34:30 +08:00
Shiming Zhang 4180bf5339 Fix flake test timeout
Kubernetes-commit: bd2655be235a00fe9db47dfe03220b691599f5f0
2021-02-23 13:59:31 +08:00
Abu Kashem 8cbefb5817 apf: set response headers for rejected requests
Kubernetes-commit: de73ac519867b3ce41adcb9a419c3c28c7a99c41
2021-02-16 12:13:36 -05:00
hellogdc 1d45e7fbbc fix the address of restful-CORS-filter.go and restful-basic-authentication.go in the comment of ./staging/src/k8s.io/apiserver/pkg/server/filters/cors.go
Kubernetes-commit: 66459d3386db74ba02a06ee29f68248bd695aa8f
2021-02-06 09:07:58 +08:00
yoyinzyc 74c8267082 add context to metrics in apiserver/endpoint
Kubernetes-commit: 266d67bd5124725befe775d580289b67a59f496c
2021-01-20 13:13:00 -08:00
Abu Kashem c4f555497d add unit test to simulate an enqued request that times out
Kubernetes-commit: 1d691ddb44e8dfa54008977469201a811410f7e9
2020-12-21 12:08:58 -05:00
Abu Kashem 026eb846a4 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.

Kubernetes-commit: e416c9e574c49fd0190c8cdac58322aa33a935cf
2020-11-26 23:53:20 -05:00
KeZhang 23abb6c50f Fix HSTS Missing From HTTPS Server(Nessus Scanner)
Kubernetes-commit: 4801f4d25506dbfed834c67e3fc363bfab54a48e
2020-11-12 16:10:58 +08:00
Abu Kashem eea0d66fcd clean up executing request on panic
Kubernetes-commit: 13cedca0eb5337b13e5176983ea5e784ec38df22
2020-12-10 12:57:21 -05:00
Abu Kashem 239a5f624e add comment to describe why we set the UID in the response headers
Kubernetes-commit: cecd90f52418458d7ef146846fa6efabeddc3f7c
2020-12-01 14:31:54 -05:00
Ken Sipe 0da065589a fix S1023 redundant return statement
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 1d795002919675b8cf3bf462b6543fef843b5b54
2020-06-25 17:29:42 -05:00
Jordan Liggitt cec339c07a Revert "plumb context with request deadline"
This reverts commit 83f869ee1350da1b65d508725749fb70d0f535f2.

Kubernetes-commit: afd92b3b3ea8fa8e3dbe2521d6ce213c809d25c7
2020-11-19 18:15:04 -05:00
Abu Kashem 46e3e4810e 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.

Kubernetes-commit: 83f869ee1350da1b65d508725749fb70d0f535f2
2020-10-30 16:30:05 -04:00
yue9944882 a4a3fc9b87 APF: graduate API and types to beta
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: 849be447f563fc93a27a0827fb1185b885b57114
2020-11-04 16:33:14 +08:00
David Eads fd497c40f8 put a message, not a stack, in the log on a timeout
Kubernetes-commit: 2fca40d5b1699aafa940fcf6260a994ca8a7567f
2020-11-10 14:52:36 -05:00
Lukasz Szaszkiewicz 383e99f309 stops puting a stacktrace of aborted requests in the logs
Aborted requests are the ones that were disrupted with http.ErrAbortHandler.
For example, the timeout handler will panic with http.ErrAbortHandler when a response to the client has been already sent
and the timeout elapsed.

Additionally, a new metric requestAbortsTotal was defined to count aborted requests. The new metric allows for aggregation for each group, version, verb, resource, subresource and scope.

Kubernetes-commit: 057986e32c1bb7284b0edbc161f0380f1548492f
2020-09-24 10:07:24 +02:00
yue9944882 dd68cdaa08 removes filter metrics test retries
Kubernetes-commit: 58cf6c0fb87a670165bd02128bb3b6db44e765e4
2020-11-05 11:41:34 +08:00
Adhityaa Chandrasekar 1ad5afe6a9 apiserver/filters test: fix data race and do not leak goroutines
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: a2eb6d67ee43c799465ea0378c83dc3ac3a24246
2020-11-04 18:58:06 +00:00
staebler a541a1b602 do not allow inflight watermark histograms to fall too far behind
The MaxInFlight and PriorityAndFairness apiserver filters maintain
watermarks with histogram metrics that are observed when requests
are handled. When a request is received, the watermark observer
needs to fill out observations for the entire time period since the
last request was received. If it has been a long time since a
request has been received, then it can take an inordinate amount of
time to fill out the observations, to the extent that the request
may time out. To combat this, these changes will have the filters
fill out the observations on a 10-second interval, so that the
observations never fall too far behind.

This follows a similar approach taken in
9e89b92a92c02cdd2c70c0f52a30936e9c3309c7.

https://github.com/kubernetes/kubernetes/issues/95300

The Priority-and-Fairness and Max-in-Flight filters start goroutines to
handle some maintenance tasks on the watermarks for those filters. Once
started, these goroutines run forever. Instead, the goroutines should
have a lifetime tied to the lifetime of the apiserver.

These changes move the functionality for starting the goroutines to
a PostStartHook. The goroutines have been changed to accept a stop channel
and only run until the stop channel is closed.

Kubernetes-commit: 6c9b86646871f13a4431361310ba6a0785372053
2020-10-05 11:26:48 -04:00
bjrara 7498f28769 Add multi request test
Kubernetes-commit: 833ce487b9fab1650d5aaba2a8b295f8a90e07bd
2020-10-09 16:51:19 +08:00
bjrara bb16b18666 Fix issue in missing metrics of terminated requests
Kubernetes-commit: ce00f4ee545af8d7b7519045c3422893e19d43bc
2020-08-17 15:57:15 +08:00
yue9944882 0c7caae2de e2e cases for apf
Kubernetes-commit: c28036efa5fcafdbd9d10014c9197bef42d05eaf
2020-09-21 15:43:01 +08:00
Zhou Peng b07fe5362d [k8s.io/apiserver/pkg/server/filters]: fixup go vet warning
Signed-off-by: Zhou Peng <p@ctriple.cn>

Kubernetes-commit: 842cd8e315566388025f509edf563b20022922f6
2020-07-20 17:06:01 +08:00
chenjun.cj cdf4e75f4f skip TestClientReceivedGOAWAY
Kubernetes-commit: 3a4ae287d43046516e1686cb950907e981b96cae
2020-09-09 00:26:24 +08:00
Jordan Liggitt 338bb3eda2 Skip TestGOAWAYConcurrency
Kubernetes-commit: dbdd8c5a0c2b345a6b9f2c47055701390d42c3c8
2020-09-04 12:07:02 -04:00