Commit Graph

363 Commits

Author SHA1 Message Date
Abu Kashem 9560ec6e92 introduce final seats for work estimate
Kubernetes-commit: 3d6cc118fee15313419bf7aa0082a2a608ec62f6
2021-09-24 15:18:27 -04:00
Mike Spreitzer dc449969cc Use SeatSeconds
Kubernetes-commit: 4b5e1398199282f471d0f332eefeb5c2415bdb01
2021-10-01 15:33:37 -07:00
Mike Spreitzer 0cb46ec2f7 Draft datatype for seat-seconds
Kubernetes-commit: d866f9445831687ab3254d754b13a4acf271882f
2021-10-01 13:29:35 -07:00
Abu Kashem 863c48fbc2 apf: rename WorkEstimate.Seats to InitialSeats
Kubernetes-commit: 5d67896adedbce27f01b59eb5f2054919a047f2b
2021-09-24 09:41:38 -04:00
Mike Spreitzer 72ff8a6261 Improve queueset sharding and dispatching
New anti-windup technique: use the request arrival time as the floor
on the virtual dispatch time.  Prevent bound violations where they
might arise rather than fixing up just one queue at dispatch time,
so that the fixed up dispatch times figure into the dispatching choice.

Two tweaks to the shuffle sharding.  Take seats of executing requests
into account as well as seats of waiting requests.  Do not always
consider the generated hand in the same order.

Rename the queueset methods that do shuffle sharding and finding the
queue to dispatch from, because the old names were confusingly
similar.

Tighten up some request margins.

Name the test cases in TestNoRestraint and TestWindup.

Kubernetes-commit: 4b9cba85874158b25b5c994773a4ec04343820c2
2021-09-20 15:45:24 -04:00
Mike Spreitzer 8d3036922c More test tweaks
Canonicalize listing of test cases.

Make TestNoRestraint try both cases: competition and none.

Kubernetes-commit: 0ee1a7b4ff9012b050bd447055ad5e1e8c57c30e
2021-09-20 15:45:24 -04:00
Mike Spreitzer c505aa64af Update TestNoRestraint and TestWindup
Make TestNoRestraint verify that fairness is NOT achieved
when there is real competition.

Make TestWindup run two cases, to show that 0.1 is too narrow
a margin and 0.26 is wide enough.

Kubernetes-commit: c4945fdf0c14ba2032a5c8edf192678d9fe00374
2021-09-17 01:40:16 -04:00
Mike Spreitzer e417abf592 Migrate apiserver/pkg/util/flowcontrol to use k8s.io/utils/clock
.. instead of apimachinery/pkt/util/clock

Kubernetes-commit: 9f45c0f8c07cd0adfe38c887aa618d33b8a4ee1c
2021-09-17 15:14:42 -04:00
Mike Spreitzer f17b9e7b4b Track recent reorg in testing clockery
Kubernetes-commit: 20ccd735f6a55fdd9ecbe8cddb889310f0bc033b
2021-09-13 16:15:28 -04:00
Abu Kashem db8aff032b apf: update apf logic to use v1beta2
Kubernetes-commit: 28f2b42a4116a9223113e8b152e02a4f1e602ff4
2021-08-16 17:53:57 -04:00
Abu Kashem 7964b85d9c apf: update e2e test to use v1beta2
Kubernetes-commit: d99497ef6d5581b787e7aebfca943697ed8fe164
2021-08-16 17:12:42 -04:00
Mike Spreitzer de042674ed Widen margins of TestDifferentWidths and TestTooWide
These behavioral unit tests of queueset were failing because the
evaluation criteria were too strict.

Kubernetes-commit: 59d319ec06bb33289a87036418b4a61ed3bb215f
2021-09-09 17:07:58 -04:00
Mike Spreitzer de227d1d37 Change execution duration guess from 1 minute to 3 milliseconds
So that the width estimate has some effect but not a grossly excessive
one.

Added the fifo::Peek method to simplify the fifo client code.

Also renamed the queueSet::estimatedServiceTime field to
estimatedServiceSeconds to make the units clear.

Kubernetes-commit: a0c161f2f6908ee424ea888ff40f75ff071bd20a
2021-09-07 00:46:50 -04:00
Mike Spreitzer 1efcc1c03a Refine locking in API Priority and Fairness config controller
Instead of a plain `Mutex`, use an `RWMutex` so that the common
operations can proceed in parallel.

Kubernetes-commit: 58927c1abede11ce7a8a74104328cf823df1b39e
2021-09-08 00:34:52 -04:00
Justin SB d5beafeb68 Avoid expensive go-cmp/cmp comparison
The cmp comparison is relatively expensive (#104821).  If we're not
going to log it, we shouldn't make the comparison.

Kubernetes-commit: f9f556dc7061df1dfc8c1628db983eeb97149317
2021-09-07 13:36:50 -04:00
Mike Spreitzer d6c30c1553 Adjust LIST work estimator to match current code
Kubernetes-commit: 6f160ca11b0ce9e9fda9571e37eec2de1b97bcc5
2021-08-25 23:22:13 -04:00
Mike Spreitzer cc873bafd2 Increase debug logging in waitGroupCounter::Add
Now tries a little harder to get to meaningful stack frames.
This revision seems to strike a balance that is useful in the queueset tests.

Kubernetes-commit: b56dd725032cb7a14aa27e4c50c1c9d7c6d23eb1
2021-08-06 14:32:19 -04:00
Maciej Borsz 02f98184b3 Add APF's priorityLevel to httplog.go
Kubernetes-commit: 6db63869b0fd0551382dec1b30b649fda4289444
2021-08-13 13:00:07 +02:00
Mike Spreitzer 7d5430cfba Fix extra latency and add tests for that and width
Added missing dispatching after delayed release of seats.

Updated logging for all six situations of execution completion and
seat release.

Added behavioral tests for non-zero extra latency and non-unit width.

Also added two tests for baseline functionality.

Also improved some comments and other logging in `queueset.go`.

Kubernetes-commit: d2a27a58f0af20c6185fa1c21890d666e9d3746b
2021-08-12 16:48:02 -04:00
Jordan Liggitt bbc4211158 Update unit tests to handle go1.17 certificate parsing error messages
Kubernetes-commit: 0e925f266f78d72ed05a5a2fe48faa5e2a87d107
2021-08-17 11:24:03 -04:00
Ryan Moriarty 0741f109f6 Add a new webhook metric tracking request totals.
Also add a 1.0s bucket boundary to the webhook latency metric.

Kubernetes-commit: 8ed1628a6e75f4029853502dbac44fdb0edac5fc
2021-06-22 22:32:47 +00:00
Abu Kashem da50ca4c6e apf: free seats in use after additional latency
Kubernetes-commit: d68186452d9150b113489e6a722caf82f898857f
2021-06-27 13:04:20 -04:00
Mike Spreitzer 8c2108bc80 Refactor goroutine counting
Add comment outlining TestContextCancel.

Stop calling `t.Errorf` from wrong goroutine.

Package up queueNoteFn expectation checking.

Add counting of goroutine in req1 exec fn.

Remove unnecessary assignment to `_`.

Make TestContextCancel wait on fake clock, to insulate timing check
from scheduler noise.

Factor goroutine counting out of queueset.go, into queueset_test.go,
where it matters.

Refactor promise: Use a simple channel-based implementation for normal
code, a mutex-based one for testing code.

Took all the panics out of queueset.go

Shrink the timeouts in promise tests to 1 second.

Kubernetes-commit: 1db36ae3b30e30d70972998a22987a7db470479b
2021-07-29 00:35:25 -04:00
Mike Spreitzer 904cd74454 Some cleanup of the package for event clocks
Rename from `clock` to `eventclock`.

Simplify by removing the prohibition on an EventFunc suspending and
resuming activity.

Remove "EventClock" from names to avoid stuttering.

Start to consolidate test code under fairqueuing/testing/.

Kubernetes-commit: 80ca6a4ae6ff571c32962a7155efd55edefff9e6
2021-08-06 02:06:43 -04:00
Abu Kashem f013b63777 apf: use EventClock rather than a PassiveClock for queueset
Kubernetes-commit: c2a3b793d3ec62e781dd20704370d09f7e1be706
2021-07-21 17:06:48 -04:00
Abu Kashem bd2ef9810a apf: estimate list width
Kubernetes-commit: 296c18ec323328bf1c6a621a9ca3a094d78bb9d0
2021-06-22 19:38:00 -04:00
Manu Gupta b09300b3f0 fix unsafe json construction for digestConfigObjects.
fix unsafe json creation by creating intermediate objects
while creating patch bytes.

Kubernetes-commit: dfde50b18564cc9a8e99fdcba2f136d770ec6943
2021-08-01 18:43:40 -07:00
Mike Spreitzer 0c550377cf Introduce event clocks based on k8s.io/utils/clock
So we can move off of the apimachinery clock package.

Switch queueset to new clocks.

Removed event clocks based on apimachinery clocks,
because this PR introduces ones based on k8s.io/utils/clock .

Removed interface that is implemented by only one interesting type.

Simplify RealEventClock::EventAfterTime.

Kubernetes-commit: dcb298c9552de44e27ed52f5e2b58a0dd7cd8d54
2021-07-21 16:56:11 -04:00
Abu Kashem feb4eefe1c apiserver: add callback to get notified of object count
Kubernetes-commit: 2c60feffbee690af4632d068158e640abe10f678
2021-07-14 16:44:34 -04:00
wojtekt 719fda2a8b Simplify APF promise to what is really used in the code
Kubernetes-commit: 9f735e71bbb7d0dde67a718891641d8afd20a8bc
2021-07-23 13:30:34 +02:00
wojtekt d6e0cf5d71 Remove unused promise code from APF
Kubernetes-commit: a1cf44eab44f21c3929ff2d79501c56e6fbcddc3
2021-07-21 12:14:30 +02:00
wojtekt 9209ed5928 Get rid of unused flowSchemaRVs in P&F
Kubernetes-commit: c79a0a08828ef86e07941e96dafefb7d8bc51990
2021-07-13 15:16:17 +02:00
wojtekt b4c306e1e8 Rename width to workEstimate in P&F code
Kubernetes-commit: 73211256e8f15cf84ee69d6fe8258c3a912e0f94
2021-07-13 15:10:58 +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
David Ashpole 785c5626f9 add tracing to webhook requests
Kubernetes-commit: 9dd59017c4c218135b12949a2bd3af07e892199a
2021-07-08 20:13:33 -07:00
Abu Kashem b206f9ea02 apf: fix virtual clock
Kubernetes-commit: a570008cbd6c2142a2f270570fe49bf982825c19
2021-07-06 19:29:16 -04:00
Ryan Phillips 7afffd8ef3 Revert "apiserver: add callback to get notified of object count"
Kubernetes-commit: d95b14e1abfb5ec87248e5dd826b89d0c738af42
2021-07-08 13:56:39 -05:00
wojtekt 9606daa5ef Refinements to pick queue logic in P&F
Kubernetes-commit: 7f1c4977d7ad9fdfd44549ee8ffe289127be4d81
2021-07-07 08:58:49 +02:00
Davanum Srinivas fe1610f3fe switch from golang-lru to the one in k8s.io/utils
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 79d0c6cdc10293c9bfe644ce31dc186a936579b0
2021-07-07 13:45:07 -04:00
wojtekt fbc127e994 Add watch tracker to APF for request cost estimation
Kubernetes-commit: cea1dcfeed2fc4e8ab89cd43e5a0e402251c8df5
2021-06-15 10:49:42 +02:00
wojtekt a35bb85f09 Update the logic to pick the best queue in P&F
Kubernetes-commit: 0ecc7ba311ab33b16c5d907ebb1120e3e51a947d
2021-06-17 09:22:00 +02:00
Abu Kashem cf5c77fde9 apf: add additional latency into width
Kubernetes-commit: 24e19229101d242d924ce98a562be3864dde9eae
2021-06-27 12:45:24 -04:00
Abu Kashem d929410e13 apiserver: add callback to get notified of object count
Kubernetes-commit: 1002b0d163dd948334f10b0e25d0e91d253791e8
2021-06-18 10:44:07 -04:00
Abu Kashem e9708ba84d apf: calculation of dR/dt should use seats in use
Kubernetes-commit: 6203d4fc6af36b1fd60177e8a88b8d4d45acb029
2021-06-21 05:38:07 -04:00
Mike Spreitzer 4dcb848926 Track generalization for width
Kubernetes-commit: 3930629e130f1c98821f8033941870ab582db284
2021-06-18 01:37:22 -04:00
Mike Spreitzer d28ccb4224 Add APF metrics about R(t)
Kubernetes-commit: 676f0450ed37eeec92b67246719cc46e7567e512
2021-06-14 16:48:27 -04:00
youhonglian 56e6dac0bb update github.com/pkg/errors to go native errors pkg in staging
Kubernetes-commit: 4b1402187474a1ebd0f71c824f45448fea160fc6
2021-06-22 11:54:56 +08:00
Abu Kashem e1aec4ecae apf: take seats into account when dispatching request
Kubernetes-commit: ff716cef508f948b50e1026e980e6df5ee475538
2021-06-14 12:19:06 -04:00
Abu Kashem abdd901971 apf: always include seats in virtual time
Kubernetes-commit: 2f7456076e0cb29a95d86cd0f54c34a04b4722ab
2021-06-14 09:52:00 -04:00
Abu Kashem 345d1c6ff9 apf: add a gauge for the number of seats currently in use
Kubernetes-commit: c710f99ef730a791a6911e63cc3b9d26cced6bd3
2021-06-10 17:34:50 -04: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
wojtekt 5290a24345 Implement support for watch initialization in P&F
Kubernetes-commit: 0cc217647ca8be0820973b970124a072c27b6575
2021-05-07 12:49:06 +02:00
Abu Kashem ec22c8bdd8 apf: add "width" for request
all requests have a width of 1 to maintain current behavior.

Kubernetes-commit: b50507d98bd12503592ea62d2be2aadef49bdf70
2021-05-11 07:03:05 -04:00
Monis Khan 5289a15a1a client-go transport: assert that final CA data is valid
Signed-off-by: Monis Khan <mok@vmware.com>

Kubernetes-commit: 440ea3ef49e0ac77353ceeaebc2aad6c995d5b35
2021-05-03 10:11:54 -04:00
Stanislav Laznicka 7eb7056b38 webhooks,aggregation: add metrics to count certs missing SAN
Adds counters to generic webhook code and to the kube aggregator
so that it is possible to effectively measure the impact of
Golang 1.15's deprecation of x509 cert CN hostname
verification.

Kubernetes-commit: 9d6a19efff05a40081337a2fcb3dce6331b04022
2020-10-06 13:02:52 +02:00
Abu Kashem 4e12e0cd34 apf: use a list instead of slice for queueset
Kubernetes-commit: 69f9bc181f155ded7c5d5cc0ca9f026a6b42f431
2021-03-29 11:31:12 -04:00
Gautier Delorme af9424d2c9 remove go-openapi/spec
Signed-off-by: Gautier Delorme <gautier.delorme@gmail.com>

Kubernetes-commit: 34b0fcef5fc47e3fcddf7f6ca1b3e6176b2a5323
2021-04-20 17:48:33 +02:00
John Howard d7e2a0bbee Update kube-openapi and gnostic dependencies
Pulling in https://github.com/kubernetes/kube-openapi/pull/220

Kubernetes-commit: a849c8998c1ed71f25387a560f8359596aec8bd3
2021-03-23 08:33:15 -07:00
Abu Kashem 7c07064678 apf: fix test flake
Kubernetes-commit: fa0952ee778aaf7df3e593305575f5d121b55cf1
2021-03-29 16:09:49 -04:00
David Eads 4c81a6672b Enable, rate limit, and test APF controller fights
Using real time.

Kubernetes-commit: 80ff06fe846c5e565e0cbd4b70f5f1e8a4ea7295
2020-12-02 16:50:05 -05:00
yoyinzyc 1a8abfc56f add context to metrics in util/flowcontrol.
Kubernetes-commit: 57d0bc301a017c41d890baee0a3a287f448c664d
2020-12-16 17:08:43 -08:00
Adhityaa Chandrasekar ec9a97b26e flowcontrol: make TestConfigConsumer less time-consuming
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: c1f3e90969d38f5b8410b67f0640d5df0d098e6b
2021-02-02 11:20:18 +00:00
Mike Spreitzer b2c3c4f86c Tweak up TestSampler in response to review
Kubernetes-commit: 736a87a4ee516a3feca0a79a4c48806ad4916aa3
2021-01-24 23:38:48 -05:00
Mike Spreitzer 39f5df86ff Added comment explaining the new unit test
Kubernetes-commit: 42f8d4e28fc05f3532f5cf7d2294049e3314896a
2021-01-18 00:57:09 -05:00
Mike Spreitzer 60021e2fed Explain warnings in new test
Add info message that explains what warnings are deliberate and expected.

Kubernetes-commit: 194c22fed54ba89d985085412795a9850bedeaf3
2021-01-06 12:56:16 -05:00
Mike Spreitzer 71c9d22768 Add unit test for sample-and-watermark histograms
Kubernetes-commit: 5fe48be506fe2b946d4db9cd7976ad0c4d4e7e1a
2021-01-05 23:31:06 -05:00
pacoxu 2343af38bb fix all keps links 404 for kep folder migration
Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: a10bdfed09e96f3c2703454caafa2c884914e064
2021-01-14 14:03:21 +08:00
Mike Spreitzer 5d4804815d Less demanding test cases in TestUniformDistribution
Also a bug fix in the evaluation.

Kubernetes-commit: 1f1e8e21d81c4ff75078adc163bf2872d1b4650e
2021-01-25 01:44:08 -05:00
Abu Kashem 84ce907827 fix apf controller unit test
- don't expose the internal states of the apf controller to the caller
- return a boolean, instead of the priority level states

Kubernetes-commit: f20c6cb2d9060920cae9ff5cade1739c7e0b7f7a
2021-01-13 11:06:17 -05:00
Mike Spreitzer 16288a4d61 move all variables in sampleAndWaterMarkHistograms::innerSet
to tiptoe around https://github.com/golang/go/issues/43570 for #97685

Kubernetes-commit: 611184aa59d0cd40466bc3bc4b40a3712a038171
2021-01-08 13:32:38 -05:00
Abu Kashem 3ba02b7f93 handle webhook authenticator and authorizer error
webhook.WithExponentialBackoff returns an error, and the priority is:
- A: if the last invocation of the webhook function returned an error
  that error should be returned, otherwise
- B: the error associated with the context if it has been canceled or
  it has expired, or the ErrWaitTimeout returned by the wait package
  once all retries have been exhausted.

caller should check the error returned by webhook.WithExponentialBackoff
to handle both A and B. Currently, we only handle A.

Kubernetes-commit: ae2b353fbf519b29d168c534f88c373fd67a1c31
2021-01-07 16:14:18 -05:00
Mike Spreitzer 41788f53e2 Relax apf_controller's reaction to certain errors
When the error is due to the object having been deleted, the
controller does not need to do anything before the coming
notification.

Kubernetes-commit: ef1e2039b5fc7f955ec4f9c636a64aa403cba2ab
2020-12-17 10:46:14 -05:00
Abu Kashem eea0d66fcd clean up executing request on panic
Kubernetes-commit: 13cedca0eb5337b13e5176983ea5e784ec38df22
2020-12-10 12:57:21 -05:00
Abu Kashem 59a718ed18 fix the deadlock in priority and fairness config controller
Kubernetes-commit: 7114319b3e66e331250c116ac926f1a57352072f
2020-12-15 12:19:56 -05:00
Mike Spreitzer a011399e98 Define TestableConfig in k/apiserver/pkg/util/flowcontrol
Collect the parameters of newTestableController into a named type.

Also tolerate the surprising situation in which a request's user
groups include neither `system:authenticated` nor
`system:unauthenticated` --- because this is observed to happen in
some tests.

Also a few other minor fixups.

Kubernetes-commit: 10df6d459b5bca7b42471f9409182417fbc3f253
2020-12-16 18:58:45 -05:00
Mike Spreitzer 2ceb0fcbe8 Create OWNERS for most of the API Priority and Fairness impl
Kubernetes-commit: 23de8061fbb63928c62aa6020b443a62491a0a1d
2020-12-11 17:54:59 -05:00
corehello b6f30b469b Fix typo for ServiceAccount
Kubernetes-commit: c20b2c8cd79f9e7dafa86fb4245dee9dd2d795c7
2020-12-02 01:38:46 +08: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
Ken Sipe b60943f03a fix S1019 use of make
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: a4d05d51d95d30ebe90ec8f652c9a794caa44d53
2020-06-25 17:26:42 -05:00
Adhityaa Chandrasekar 43cf7154be APF matching: fallback to catch-all if nothing matches
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: 794a3ec0997caffa116c2e6f78feb53ebfca6052
2020-11-13 03:58:07 +00: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
Mike Spreitzer 70bbff23ac Fixed quantization and made monotic time reversal not panic
Changed quantization to use monotonic clock readings.

Stopping panicing when monotonic clock readings go backwards because
https://github.com/kubernetes/kubernetes/issues/96459 reported it
happening.

Re-organized sampleAndWaterMarkHistograms::innerSet to `defer` the
Unlock call, because that is the preferred pattern.

Kubernetes-commit: 0809220fd04d26892f0fcfd3bf54cc4baeda22da
2020-11-12 15:17:07 -05:00
Adhityaa Chandrasekar 8b21b5725d APF metrics: set StabilityLevel to ALPHA
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: b16f36b251ddbfef5f12fed58640de53512631f0
2020-11-05 15:35:39 +00:00
Adhityaa Chandrasekar ebe254b2e6 APF: use snake_case in metric labels
Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>

Kubernetes-commit: f9d57a8d5db3e58f79a1b1958d80c049c63d6cde
2020-11-04 22:19:52 +00:00
yue9944882 5474822749 fixes max-min fairness
Kubernetes-commit: fd889ec8ae37437a9e75386542291bd0e2cc605e
2020-10-29 18:57:38 +08:00
Abu Kashem 5254108841 make backoff parameters configurable for webhook
Currently webhook retry backoff parameters are hard coded, we want
to have the ability to configure the backoff parameters for webhook
retry logic.

Kubernetes-commit: 53a1307f68ccf6c9ffd252eeea2b333e818c1103
2020-10-30 11:25:32 -04:00
Abu Kashem 67f1bb6022 Webhook: handle error when calling wait.ExponentialBackoff
- Inside WithExponentialBackoff function, handle error returned
by wait.ExponentialBackoff.
- Ensure that the wait time is bound to the given context.

Kubernetes-commit: f8e35de156f212b6989b465e608dd99b525bd5dc
2020-10-26 11:37:11 -04:00
Andrew Sy Kim 6746ccadda apiserver: support egress selection name 'controlplane' and deprecate 'master'
Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>

Kubernetes-commit: a0aebf96ec2eef6517e2611335f0e6c9375dd807
2020-10-26 10:24:16 -04:00
Mike Spreitzer 86c572cf3f Remove phantoms from dump_requests output
No longer writes a single info-free line for each exempt priority level.

Kubernetes-commit: 6aeca5fb345256e104b9b2224a0f8797c1921214
2020-07-24 00:35:26 -04:00
Ken Sipe 4ad3e91efa changes in imports was unintentional
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 09cd56b561d0c31421dfc6374b68e0b18c6cc746
2020-06-28 15:26:40 -05:00
Ken Sipe 32533315c9 fix S1000 simplify ch switch cases
Signed-off-by: Ken Sipe <kensipe@gmail.com>

Kubernetes-commit: 268c2f81c7ab94cbab68a8d6c00725144b81fa09
2020-06-26 10:45:30 -05:00
Mike Spreitzer b1ede52e21 Make sampleAndWaterMarkHistograms not fall very far behind
Kubernetes-commit: 9e89b92a92c02cdd2c70c0f52a30936e9c3309c7
2020-08-20 16:43:11 -04:00
yue9944882 543449d042 removes empty columns and fixes request details
Kubernetes-commit: 40e3feb7f1b7f54a512785af7e28810c0874ac63
2020-07-23 14:25:11 +08:00
Mike Spreitzer e28ab56bd4 Introduce more metrics on concurrency
Introduce min, average, and standard deviation for the number of
executing mutating and readOnly requests.

Introduce min, max, average, and standard deviation for the number
waiting and number waiting per priority level.

Later:

Revised to use a series of windows

Use three individuals instead of array of powers

Later:

Add coarse queue count metrics, removed windowed avg and stddev

Add metrics for number of queued mutating and readOnly requests,
to complement metrics for number executing.

Later:

Removed windowed average and standard deviation because consumers can
derive such from integrals of consumer's chosen window.

Also replaced "requestKind" Prometheus label with "request_kind".

Later:

Revised to focus on sampling

Make the clock intrinsic to a TimedObserver

... so that the clock can be read while holding the observer's lock;
otherwise, forward progress is not guaranteed (and violations were
observed in testing).

Bug fixes and histogram buckets revision

SetX1 to 1 when queue length limit is zero, beause dividing by zero is nasty.

Remove obsolete argument in gen_test.go.

Add a bucket boundary at 0 for sample-and-water-mark histograms, to
distinguish zeroes from non-zeros.

This includes adding Integrator test.

Simplified test code.

More pervasively used "ctlr" instead of "ctl" as abbreviation for
"controller".

Kubernetes-commit: 57ecea22296797a93b0157169db0ff2e477f58d0
2020-05-17 01:02:25 -04:00
Mike Spreitzer f0320d394e Add test for windup problem in APF
The current design for Fair Queueing for Server Requests has a
problem: if the min-max fair result stays different from an even
division for a long time and no queue involved in the imbalance goes
empty then the imbalance keeps accruing in queue virtual state times.

This commit adds a test that demonstrates the problem.

It also has some other tweaks to make other tests less flaky.

Factor the big scenario-testing func into pieces, with supporting
structs.

Kubernetes-commit: f3fdd5cf9f51f2a03ebfddef82bc2014e04b62a0
2020-06-04 00:15:08 -04:00
yue9944882 7f1f8c2578 introduce apf debug endpoint
Kubernetes-commit: 567becd5eedd9a1f3802f2b3b0b6b8efc445d2a1
2020-05-22 13:02:10 +08:00
RainbowMango efc2982011 Fix a wrong usage of recover in apiserver.
Kubernetes-commit: d1a883293930336b5c561448900e40d9c4fe4676
2020-05-29 17:03:43 +08:00
Mike Spreitzer 705ee42713 Clean up fairqueuing/interface.go
Fixed outdated comment on QueueSet::StartRequest.

Removed unused interface EmptyHandler.

Kubernetes-commit: 28671fc4cf34e9e34eee545312c848ce40ab148b
2020-05-17 22:36:30 -04:00
Davanum Srinivas 5879417a28 switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 442a69c3bdf6fe8e525b05887e57d89db1e2f3a5
2020-04-17 15:25:06 -04:00
Gaurav Singh 43ce4f9092 Remove double import of k8s.io/apimachinery/pkg/util/net
Kubernetes-commit: 29ceb8d5f2fc48d1fe4974110b7f60579668c00e
2020-04-08 16:25:23 -04:00
Jordan Liggitt 08f23b5217 github.com/googleapis/gnostic v0.4.1
Kubernetes-commit: 93c7b24562d80959f45c308e7412456a410b9b25
2020-03-31 17:18:56 -04:00
Davanum Srinivas c15d16953f Move k8s.io/apiserver/pkg/util/term to k8s.io/component-base/term
Signed-off-by: Davanum Srinivas <davanum@gmail.com>

Kubernetes-commit: 1d057da2f73118893b5cc27c15d59ff03beb271e
2020-03-16 16:27:44 -04:00
Mike Spreitzer 9df60c9fe6 Renaming: "Change" -> "Add" for consistency with underlying method
Kubernetes-commit: c7b098ac6c276d65a79db6cfeb04f5f0f86eb315
2020-03-05 15:17:33 -05:00
Mike Spreitzer 8235385f97 Fix queued request accounting, extended queueset test
Kubernetes-commit: 8a1b60320986eca05cb281bcce45332e0969268e
2020-03-05 15:13:46 -05:00
Mike Spreitzer 6ae3e470a2 Make some metrics finer-grained, add dispatch counts, note immediate reject
Also add testing of metrics for queuesets.

Kubernetes-commit: f535a9c9ed4b6a0def47c354acad0ac2a8f961b0
2020-03-01 20:22:58 -05:00
Mike Spreitzer 219ab512ff Generalized NonResourcePolicyRule.NonResourceURLs impl
... to match the comment on that field.

Also generalized the test case generator to exercise the new
generality.

Kubernetes-commit: 2e97d3c8732147c3ba2f11d668f50b44e6374348
2020-03-04 00:00:39 -05:00
Mike Spreitzer f9c1780311 Hopefully plainer test strings
Kubernetes-commit: 4a4852ca9a1ffc439e2c476d7057a8be9f081055
2020-03-04 21:47:19 -05:00
Mike Spreitzer f44645645b Added non-randomized tests of matching FlowSchema rules
Kubernetes-commit: 21f78f3348736f242541f7b66e191aa1dce78c47
2020-02-27 23:36:19 -05:00
yue9944882 f452a698b0 register metrics from comp-base
Kubernetes-commit: 11656478be93d4a9e54129ec35cd2b9558e901ac
2020-02-27 17:04:17 +08:00
Jefftree 13613a1c15 Address comment and remove if condition
Kubernetes-commit: 61fa4e6c098559b65fe28c1bf55cb817697e38e5
2020-02-27 17:18:57 -08:00
Jefftree f1c9537c7b pass Dialer instead of egressselector to webhooks
Kubernetes-commit: 1b38199ea8b220be0b645af8a4cbdef4c87ce7fc
2019-12-05 17:28:59 -08:00
Jefftree aa55f94611 authentication webhook via network proxy
Kubernetes-commit: d318e52ffe0ba156a96cb5507026de6827d543ca
2019-12-03 15:20:49 -08:00
yue9944882 f93a7a8312 homogenize metrics naming
Kubernetes-commit: a1523a049ff9fc47d7dc2c4354b16b69d2eb4be2
2020-02-19 16:34:49 +08:00
Ted Yu f2eace2821 Do not dereference qcAPI which maybe nil
Kubernetes-commit: 583f804652ffff898437c80ce357e4f0c379bfb9
2020-02-14 13:30:40 -08:00
Mike Spreitzer 1ef67fe134 Version the API Priority and Fairness FieldManager values
Kubernetes-commit: b142868eaf46b24fce0e6b01e06087c924351857
2020-02-14 13:50:11 -05:00
Mike Spreitzer 1c79014daa Added API Priority and Fairness filter and config consumer
Kubernetes-commit: 73614ddd4e42728a36c7ac6b7b20f27c8032cafb
2020-01-25 19:47:12 -05:00
Mike Danese 5737088b7f refactor
Kubernetes-commit: d55d6175f8e2cfdab0b79aac72046a652c2eb515
2020-01-27 18:19:44 -08:00
Mike Spreitzer fffb0fade5 brushed up according to review
Added LockingWriteMultipleOnly and LockingWriteOnceOnly interfaces,
so that further extensions are possible (in this package or others).

Moved common SetLocked behavior into promisoid.

Made comments say things that were implied.

Kubernetes-commit: cbdd3a279e6161d73f2c4e8a2b916ae74b258621
2020-01-24 14:33:15 -05:00
Mike Spreitzer 27a36b04f5 Tweak new names
Kubernetes-commit: a65f525aed8d9f28f677028f77e2ab41313ae037
2020-01-21 20:35:45 -05:00
Mike Spreitzer 3a091e906d Simplified logic around context cancel, removing bugs
Previously, a `decisionCancel` could overwrite a `decisionReject` or
`decisionExecute`, causing confusion.  Now a request gets exactly one
decision and there is no confusion.

Also added write-once to the promise package and refactored.

Kubernetes-commit: 1c092bf635954bde9c9c363672fa156b9430206b
2020-01-09 14:03:13 -05:00
Mike Spreitzer 4fead639b7 Refactored QueueSet configuration into two phases
So that errors can be detected before resolving concurrency shares
into concurrency counts.

Kubernetes-commit: 1e170637c3ce6c4ccd378275d9e52192f4be12b7
2020-01-18 01:46:11 -05:00
Jefftree 16fa20a151 network proxy with admission wh
Kubernetes-commit: 1289bdaba41848c0d19892cc749798e540b56e8a
2019-11-12 17:35:45 -08:00
Jordan Liggitt 8c0dc1fdf9 Ensure webhook backend requests are not artificially rate-limited
Kubernetes-commit: d620493b7430c0f59d7393c3de8451d6a686c0c1
2019-12-02 11:39:16 -05:00
Ted Yu e5660b53e8 Output port as number in error message
Kubernetes-commit: c224a6de5e01455bcd89763f1483546496e41dcb
2019-11-22 13:12:59 -08:00
Mike Spreitzer d0f4b93c91 Brushed up fairqueuing package
This commit responds to the comments on PR #85192 that were not yet
addressed at the time it merged, apart from the one fixed in PR

Generalized fairqueuing to allow for zero queues, to support a
priority level that limits concurrency but does no queuing.

Kubernetes-commit: b123a43e7117e977606bacd31d77f4a30d2ed212
2019-11-13 23:34:10 -05:00
Ted Yu 82980a5db1 Correct the checking of robinIndex
Kubernetes-commit: 2bdd379a1eb9d0344df41fff0339123849682e7c
2019-11-13 20:13:29 -08:00
Mike Spreitzer cd34d8d0ce Fixed lint and staticcheck oversights
Kubernetes-commit: e10acc78dee5d90d93fc7bc0e76e97bc7bc0b3a3
2019-11-13 09:20:00 -05:00
Mike Spreitzer 63ad2ccdad Brushing up queueset
(1) Replaced random-looking assortment of counter increments and
decrements with something hopefully more principalled-looking.  Most
importantly, introduced the MutablePromise abstraction to neatly wrap
up the complicated business of unioning multiple sources of
unblocking.

(2) Improved debug logging.

(3) Somewhat more interesting test cases, and a bug fix wrt round
robin index.

Kubernetes-commit: 1c31b2bdc65377f502c2306dbdf32a802eb1afb7
2019-11-13 01:52:05 -05:00
Aaron Prindle e231e56df2 review changes - *Locked updates
Kubernetes-commit: 6619df1798859d49bbb52b1c029533035384824e
2019-11-12 09:24:56 -08:00
Aaron Prindle 572fbfc84d review changes
Kubernetes-commit: 396e2d4aa33bb7289cd8e7466e4465f56a73b7d0
2019-11-12 08:51:49 -08:00
Aaron Prindle a222f282e1 fairqueuing implementation with unit tests
Kubernetes-commit: 24065cf5be6bed995da7b7abb37ee78ff95230f0
2019-10-29 21:54:16 -07:00
yue9944882 0db66ae3d6 non-generated api models misc
rule list

rule

rule 2

Kubernetes-commit: 7c28a4b70eb90977f620ba7374ea0a511fcb9515
2019-10-23 15:17:10 +08:00
Bruce Ma 87c35dc179 address some comments
Clean up useless functions, only keep the basic function Deal
and the function DealIntoHand which will be used by Priority
and Fairness.

Improve some comments for constants and functions.

Introduce Dealer to combine parameters and methods into a whole.

Use fixed-size slice to improve performance.

Use math.Ceil and math.Log2 to calculate required entropy bits.

Make the given hand adaptive to handSize in DealIntoHand.

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>

Kubernetes-commit: 7a3ca070cdd9804a22bf5db8a99576b09fc52484
2019-10-11 20:06:31 +08:00
Mike Spreitzer a74f0d114b More work on shuffle sharding utils
Changes following up on shuffle sharding util package.

Made the validation checking function return a slice of error messages
rather than just a bit.

Replaced all the `int32` with `int` because this is intended for more
than just the priority-and-faireness feature and so should not be a
slave to its configuration datatypes.

Introduced ShuffleAndDealIntoHand, to make memory allocation the
caller's problem/privilege.

Made the hand uniformity tester avoid reflection, evaluate the
histogram against the expected range of counts, and run multiple test
cases, including one in which the number of hash values is a power of
two with four extra bits (as the validation check requires) and one in
which the deck size is not a power of two.

Kubernetes-commit: da0b647155912c6b1e6b971aa5685768915d810d
2019-08-08 14:53:40 -04:00
Bruce Ma bd6349fddb Add shuffle sharding utils and tests
Implement several shuffle sharding functions including ShuffleAndDeal,
ShuffleAndDealToSlice.

Add benchmarks and tests for shuffle sharding to test performance,
correctness and distribution uniformity.

Signed-off-by: Bruce Ma <brucema19901024@gmail.com>

Kubernetes-commit: e97eaef4f65ec2cbfebf4fd9e726c9e2a6bf5499
2019-07-29 18:01:08 +08:00
shturec b054ff44ee custom retry strategy in GenericWebhook
Kubernetes-commit: 4877b0b7b50bdc3eaaadd3f968fd846c1396b708
2019-09-27 13:04:10 +03:00
Jordan Liggitt 0ca78287c0 Propagate context to ExponentialBackoff
Kubernetes-commit: 4c686ddc1c5f9bc5c28d711dd56551b1ac003faa
2019-09-24 09:43:04 -04:00
Jordan Liggitt 80b9dc503b Plumb service port, URL port to webhook client auth resolution
Kubernetes-commit: d127042cb81cbf545332ec3124161525ef84183c
2019-09-02 22:38:36 -04:00
Jordan Liggitt 2de636a948 Search client auth with and without port
Kubernetes-commit: 2f5dde7672eaf90c7086f86a5a4ee190559f3bb2
2019-09-02 22:38:55 -04:00
Jordan Liggitt 956977bd20 Use http/1.1 in apiserver->webhook clients
Kubernetes-commit: ddc697866afd1e58cd2ee504277b405052546202
2019-08-28 13:37:50 -04:00
Haowei Cai 8d86fef522 wire up the webhook rejection metrics in webhook handlers
Kubernetes-commit: 620f5f2c587971be50cb27bb2a2d35209b3dc058
2019-08-28 17:32:07 -07:00
Jordan Liggitt 90d670a108 AdmissionReview: Allow webhook admission to dispatch v1 or v1beta1
Kubernetes-commit: dda9bcb082be058c30c83d45e757edbaac8dc65f
2019-07-12 08:44:24 -04:00
Odin Ugedal 1be6195f27 Fix file permissions for non executable files
Normal files should have permissions 644 by default,
and does not require the last bit to be
executable

Signed-off-by: Odin Ugedal <odin@ugedal.com>

Kubernetes-commit: 35cb87f9cf71776e99a970dfff751cd29ba7ebfb
2019-06-14 21:04:39 +02:00
Mike Danese da64b0b811 BoundServiceAccountTokenVolume: fix InClusterConfig
Kubernetes-commit: 4198f28855cbda6dac61408fcba6f2d576a9347c
2019-05-14 09:29:16 -07:00
Andrew Kim ef71315b08 update import of generic featuregate code from k8s.io/apiserver/pkg/util/feature -> k8s.io/component-base/featuregate
Kubernetes-commit: c91913924543e1d29f3f3d51354701df9df75def
2019-03-04 12:46:52 -05:00
Andrew Kim 8f01fd2545 move generic feature gate code from k8s.io/apiserver to k8s.io/component-base
Kubernetes-commit: b2831a686c31b5db72f3106b3688f00c40ba1b00
2019-03-04 12:35:31 -05:00
Mike Danese 84cf7582e3 webhook: support exec auth plugin
This allows webhook static kubeconfig to use an exec auth plugin to
configure authentication.

https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#authenticate-apiservers

Kubernetes-commit: 8b45296661de1f12f441736ae44895ac30f320d4
2019-04-22 19:25:11 -07:00
Mehdy Bohlool 6c13576bf2 Add port to ServiceResolvers
Kubernetes-commit: 11f37d757fc0b710245446c80a8c9578ce2c02f1
2019-03-01 16:32:50 -08:00
Mehdy Bohlool f06a9dc218 Add port to ServiceReference of Admission Webhooks, ConversionWebhooks and AuditSync with defaulter and validator
Kubernetes-commit: 404e2f7a30626f02b55180bccf6a5f16bcbbfa82
2019-03-01 14:35:42 -08:00
Marek Counts c7299d9da0 Moved flag and globalflag
Moved all flag code from `staging/src/k8s.io/apiserver/pkg/util/[flag|globalflag]` to `component-base/cli/[flag|globalflag]` except for the term function because of unwanted dependencies.

Kubernetes-commit: 7744f908306e5131be5a94815ac76a7cba6454f2
2019-02-15 10:28:13 -05:00