Commit Graph

8493 Commits

Author SHA1 Message Date
Mike Danese
3f194d5b41 migrate token cache to cache.Expiring 2019-11-14 13:50:15 -08:00
Mike Danese
9167711fd1 Add an expiring cache for the caching token authenticator
And maybe the webhook authorizer cache.

This cache has two primary advantages over the LRU cache used currently:

- Cache hits don't acquire an exclusive lock.
- More importantly, performance doesn't fallover when the access pattern
  scans a key space larger than an arbitrary size (e.g. the LRU
  capacity).

The downside of using an expiring cache here is that it doesn't have a
maximum size so it's suspectible to DoS when the input is user
controlled. This is not the case for successful authentications, and
successful authentications have a natural expiry so it might be a good
fit here.

It has some a few differences compared to:

3d7318f29d/staging/src/k8s.io/client-go/tools/cache/expiration_cache.go

- Expiration is not entirely lazy so keys that are never accessed again
  are still released from the cache.
- It does not acquire an exclusive lock on cache hits.
- It supports per entry ttls specified on Set.

The expiring cache (without striping) does somewhere in between the
simple cache and striped cache in the very contrived contention test
where every iteration acquires a write lock:

```
$ benchstat simple.log expiring.log
name      old time/op    new time/op    delta
Cache-12    2.74µs ± 2%    2.02µs ± 3%  -26.37%  (p=0.000 n=9+9)
name      old alloc/op   new alloc/op   delta
Cache-12      182B ± 0%      107B ± 4%  -41.21%  (p=0.000 n=8+9)
name      old allocs/op  new allocs/op  delta
Cache-12      5.00 ± 0%      2.00 ± 0%  -60.00%  (p=0.000 n=10+10)

$ benchstat striped.log expiring.log
name      old time/op    new time/op    delta
Cache-12    1.58µs ± 5%    2.02µs ± 3%  +27.34%  (p=0.000 n=10+9)
name      old alloc/op   new alloc/op   delta
Cache-12      288B ± 0%      107B ± 4%  -62.85%  (p=0.000 n=10+9)
name      old allocs/op  new allocs/op  delta
Cache-12      9.00 ± 0%      2.00 ± 0%  -77.78%  (p=0.000 n=10+10)

$ benchstat simple.log striped.log expiring.log
name \ time/op    simple.log   striped.log  expiring.log
Cache-12          2.74µs ± 2%  1.58µs ± 5%   2.02µs ± 3%
name \ alloc/op   simple.log   striped.log  expiring.log
Cache-12            182B ± 0%    288B ± 0%     107B ± 4%
name \ allocs/op  simple.log   striped.log  expiring.log
Cache-12            5.00 ± 0%    9.00 ± 0%     2.00 ± 0%
```

I also naively replacemed the LRU cache with the expiring cache in the
more realisitc CachedTokenAuthenticator benchmarks:

https://gist.github.com/mikedanese/41192b6eb62106c0758a4f4885bdad53

For token counts that fit in the LRU, expiring cache does better because
it does not require acquiring an exclusive lock for cache hits.

For token counts that exceed the size of the LRU, the LRU has a massive
performance drop off. The LRU cache is around 5x slower (with lookups
taking 1 milisecond and throttled to max 40 lookups in flight).

```
$ benchstat before.log after.log
name                                                  old time/op    new time/op    delta
CachedTokenAuthenticator/tokens=100_threads=256-12      3.60µs ±22%    1.08µs ± 4%  -69.91%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=500_threads=256-12      3.94µs ±19%    1.20µs ± 3%  -69.57%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=2500_threads=256-12     3.07µs ± 6%    1.17µs ± 1%  -61.87%  (p=0.000 n=9+10)
CachedTokenAuthenticator/tokens=12500_threads=256-12    3.16µs ±17%    1.38µs ± 1%  -56.23%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=62500_threads=256-12    15.0µs ± 1%     2.9µs ± 3%  -80.71%  (p=0.000 n=10+10)

name                                                  old alloc/op   new alloc/op   delta
CachedTokenAuthenticator/tokens=100_threads=256-12        337B ± 1%      300B ± 0%  -11.06%  (p=0.000 n=10+8)
CachedTokenAuthenticator/tokens=500_threads=256-12        307B ± 1%      304B ± 0%   -0.96%  (p=0.000 n=9+10)
CachedTokenAuthenticator/tokens=2500_threads=256-12       337B ± 1%      304B ± 0%   -9.79%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=12500_threads=256-12      343B ± 1%      276B ± 0%  -19.58%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=62500_threads=256-12      493B ± 0%      334B ± 0%  -32.12%  (p=0.000 n=10+10)

name                                                  old allocs/op  new allocs/op  delta
CachedTokenAuthenticator/tokens=100_threads=256-12        13.0 ± 0%      11.0 ± 0%  -15.38%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=500_threads=256-12        12.0 ± 0%      11.0 ± 0%   -8.33%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=2500_threads=256-12       13.0 ± 0%      11.0 ± 0%  -15.38%  (p=0.000 n=10+10)
CachedTokenAuthenticator/tokens=12500_threads=256-12      13.0 ± 0%      10.0 ± 0%  -23.08%  (p=0.000 n=9+10)
CachedTokenAuthenticator/tokens=62500_threads=256-12      17.0 ± 0%      12.0 ± 0%  -29.41%  (p=0.000 n=10+10)
```

Benchmarked with changes in #84423

Bugs: #83259 #83375
2019-11-14 13:50:15 -08:00
Kubernetes Prow Robot
3b440dfd55 Merge pull request #85077 from gongguan/DeleteOptions
add DeleteOptions conversion
2019-11-14 02:55:34 -08:00
Kubernetes Prow Robot
d11374d330 Merge pull request #85258 from liggitt/fuzz-pointer-intstr
Include *intstr.IntOrString in API compatibility test fixtures
2019-11-14 00:59:43 -08:00
Kubernetes Prow Robot
84318d9f40 Merge pull request #84958 from kkmsft/disk_fixes
Azure : filter disks with ToBeDetached flag
2019-11-14 00:59:34 -08:00
Kubernetes Prow Robot
5dd641e45c Merge pull request #85115 from aramase/azure-disk-lock
azure: remove disk locks per vm during attach/detach
2019-11-13 23:13:48 -08:00
Kubernetes Prow Robot
a6f51da500 Merge pull request #80572 from knight42/fix/scale-cr
Fix missing resource version when updating the scale subresource of custom resource
2019-11-13 23:13:34 -08:00
Kubernetes Prow Robot
42273a4dbf Merge pull request #84472 from gab-satchi/windows-build-label
Adds Windows build information as a label on the node
2019-11-13 21:46:19 -08:00
Kubernetes Prow Robot
5e30d32d2c Merge pull request #83394 from bertinatto/convert_pv_no_affinity
Convert existing PVs to use volume topology in VolumeBinderPredicate
2019-11-13 21:45:56 -08:00
Jordan Liggitt
1dec736aff Include *intstr.IntOrString in API compatibility tests 2019-11-14 00:32:29 -05:00
Kubernetes Prow Robot
85bc79d81f Merge pull request #85227 from apelisse/update-smd
Update structured-merge-diff to latest version
2019-11-13 20:02:24 -08:00
Kubernetes Prow Robot
022120ccac Merge pull request #85192 from MikeSpreitzer/fq-impl
Added fair queuing for server requests
2019-11-13 20:02:12 -08:00
Kubernetes Prow Robot
346e6b5707 Merge pull request #85010 from leakingtapan/ebs-migration
Add translation logic for EBS storage class fstype parameter
2019-11-13 20:01:35 -08:00
louisgong
aaa63d7532 add DeleteOptions conversion 2019-11-14 09:56:56 +08:00
knight42
da246010c3 test(cr::update): add corresponding tests
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2019-11-14 09:50:09 +08:00
Kubernetes Prow Robot
71d563b831 Merge pull request #84771 from MikeSpreitzer/refactor-priority-config
Refactored PriorityLevelConfiguration
2019-11-13 17:28:06 -08:00
Kubernetes Prow Robot
64f4be5b32 Merge pull request #84390 from robscott/endpointslice-beta
Promoting EndpointSlices to beta
2019-11-13 17:27:50 -08:00
Anish Ramasekar
57df625069 add unit tests 2019-11-13 17:07:55 -08:00
Anish Ramasekar
3916c4a6cf remove disk locks per vm
maintain map with nodename and lock

move lock map to utils
2019-11-13 17:07:55 -08:00
Kubernetes Prow Robot
8af6906d1f Merge pull request #85220 from liggitt/revert-licenses
Revert #76586, restructure LICENSES file generation
2019-11-13 14:52:11 -08:00
Kubernetes Prow Robot
63a5cb37dd Merge pull request #85202 from RainbowMango/pr_add_Reset_API_to_component-base
Add Reset() API to stability framework
2019-11-13 14:51:28 -08:00
Kubernetes Prow Robot
570572b387 Merge pull request #85152 from mikedanese/tokbench
report cache misses in cached token authenticator benchmark
2019-11-13 14:51:08 -08:00
Kubernetes Prow Robot
02af1dd62c Merge pull request #85004 from deads2k/dynamic-agg-cert
dynamic reload cluster authentication info for aggregated API servers
2019-11-13 14:50:54 -08:00
Rob Scott
a7e589a8c6 Promoting EndpointSlices to beta 2019-11-13 14:20:19 -08:00
Kubernetes Prow Robot
1057f3a82a Merge pull request #85158 from andyzhangx/vmss-dirty-cache
fix vmss dirty cache issue
2019-11-13 13:04:49 -08:00
Kubernetes Prow Robot
f501d8e59a Merge pull request #85138 from liggitt/webhook-config-v1
Promote apiserver.config.k8s.io/v1, kind=WebhookAdmissionConfiguration
2019-11-13 13:03:54 -08:00
Kubernetes Prow Robot
b49afbfa64 Merge pull request #85098 from liggitt/admission-config-v1
Promote apiserver.config.k8s.io/v1, kind=AdmissionConfiguration
2019-11-13 13:02:40 -08:00
Kubernetes Prow Robot
21df24cc06 Merge pull request #84292 from RainbowMango/pr_add_metrics_flag_to_apiserver
Allow show hidden metrics in kube-apiserver
2019-11-13 13:02:09 -08:00
Antoine Pelisse
4f0346530d Update structured-merge-diff to latest version 2019-11-13 10:31:01 -08:00
Kubernetes Prow Robot
c5609071d8 Merge pull request #84971 from robscott/endpointslice-iptypes
Splitting IP address type into IPv4 and IPv6 for EndpointSlices
2019-11-13 09:26:36 -08:00
Kubernetes Prow Robot
c10d29ba88 Merge pull request #84356 from verb/pid-ga
Promote PodProcessNamespaceSharing feature to GA
2019-11-13 09:25:42 -08:00
Kubernetes Prow Robot
b9030ff666 Merge pull request #84194 from jackkleeman/describe-netpol
Fix incorrect message on describe netpol
2019-11-13 09:25:26 -08:00
Mike Danese
c5bfea65b9 report cache mises in cached token authenticator benchmark 2019-11-13 08:45:57 -08:00
Mike Spreitzer
f9bc2bcf62 Refactored PriorityLevelConfiguration
.. so that concurrency limitation can be done without queuing
(like the existing max-in-flight filter does).
2019-11-13 16:05:52 +00:00
Jordan Liggitt
cd4474ae4f Revert "76093 restructure LICENSES file generation"
This reverts commit d39ac98cc5.
2019-11-13 10:24:32 -05:00
Kubernetes Prow Robot
be1658e08c Merge pull request #85048 from shaloulcy/label_selector_requires_exact_match
add RequiresExactMatch for label.Selector
2019-11-13 07:01:13 -08:00
Mike Spreitzer
e10acc78de Fixed lint and staticcheck oversights 2019-11-13 09:20:00 -05:00
Fabio Bertinatto
dcb8c78e38 Expand unit tests for topology translation in csi-translation-lib 2019-11-13 14:01:01 +01:00
Fabio Bertinatto
4e77a27908 Convert zones to volume topology in CSI translation lib 2019-11-13 14:01:01 +01:00
David Eads
3aede35b3b dynamic reload cluster authentication info for aggregated API servers 2019-11-13 07:54:27 -05:00
shaloulcy
5a23bffd42 add RequiresExactMatch for label.Selector
Signed-off-by: shaloulcy <lcy041536@gmail.com>
2019-11-13 20:52:27 +08:00
Kubernetes Prow Robot
e45e6e5f20 Merge pull request #83836 from RainbowMango/pr_hide_common_deprecated_metrics
Hide metrics that have been deprecated
2019-11-13 04:35:12 -08:00
RainbowMango
ea40540f5c Add Reset() API to stability framework 2019-11-13 19:52:40 +08:00
MikeSpreitzer
8c2807319d Added overlooked BUILD files 2019-11-13 09:46:44 +00:00
Mike Spreitzer
1c31b2bdc6 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.
2019-11-13 09:24:31 +00:00
Kubernetes Prow Robot
c558e7f1f2 Merge pull request #84211 from misterikkit/create-idempotent
vsphere: check if volume exists before create
2019-11-13 00:24:12 -08:00
knight42
34de08a3c9 feat(scale): update CR in UpdatedObjectInfo impl 2019-11-13 14:31:50 +08:00
RainbowMango
0b48386e1a Hide metrics that have been deprecated in 1.14 2019-11-13 11:04:48 +08:00
RainbowMango
0efb642fec Add common flag validation functionality shared by kube-binaries 2019-11-13 10:32:43 +08:00
Jonathan Basseri
131668a03f vsphere: check if volume exists before create
Sometimes, volume creation can succeed right as the request times out,
causing k8s to interpret it as a failure. When the request is retried,
we want it to succeed. When trying this in vSphere, the second create
request failed with "already exists" and it never recovered.

This adds a check to the in-tree vsphere storage plugin that checks if a
VMDK exists before trying to create it. The check is done BEFORE create.

Tested: manual only )-:
2019-11-12 17:51:35 -08:00