Commit Graph

85682 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
d1e8702d36
Merge pull request #85201 from fabriziopandini/add-retry-to-etcd
kubeadm: add retry to etcd calls
2019-11-14 07:07:34 -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
fabriziopandini
0573a2227f add retry to etcd operations 2019-11-14 09:27:03 +01: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
72bcec4e4d
Merge pull request #84832 from gnufied/update-csi-version
bump CSI version to 1.2.0
2019-11-13 21:46: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
1ae9713f7f
Merge pull request #83839 from RainbowMango/pr_hide_proxy_deprecated_metrics
Turn off proxy metrics that have been deprecated
2019-11-13 21:46:11 -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
Kubernetes Prow Robot
b2a2ade1a1
Merge pull request #82878 from adelina-t/fix_82876
Check for terminated reason appropriate for containerD and dockershim
2019-11-13 21:45:49 -08:00
Kubernetes Prow Robot
cb7cd5d7c6
Merge pull request #82031 from codenrhoden/mount-comments
Additional mount comments
2019-11-13 21:45:34 -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
c98d9b6fab
Merge pull request #85149 from oomichi/move-util-4
Move functions from e2e/framework/util.go Part-4
2019-11-13 20:01:58 -08:00
Kubernetes Prow Robot
ed7a6b6ed6
Merge pull request #85129 from timyinshi/master
modify istio url:https://istio.io/news/2018/announcing-0.8/
2019-11-13 20:01:49 -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
fa1ca34550
Merge pull request #85236 from liu-cong/metrics-bucket
Update bucket for scheduler framework latency histograms.
2019-11-13 17:29:17 -08:00
Kubernetes Prow Robot
c6a38a9700
Merge pull request #85229 from liggitt/kubeadm-imports
guard kubeadm dependencies on k8s.io/kubernetes
2019-11-13 17:29:05 -08:00
Kubernetes Prow Robot
f5f024452b
Merge pull request #85226 from alculquicondor/flake/stable_cluster
Wait for terminating pods to be deleted
2019-11-13 17:28:49 -08:00
Kubernetes Prow Robot
565566f4b2
Merge pull request #85153 from codenrhoden/mount-no-exec-int
Retire mount.Exec for k8s.io/utils/exec
2019-11-13 17:28:32 -08:00
Kubernetes Prow Robot
072cf5bd58
Merge pull request #85023 from MrHohn/svc-lb-ga
Promote service load balancer finalizer to GA
2019-11-13 17:28:21 -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
Kubernetes Prow Robot
d3593c07de
Merge pull request #83057 from bclau/windows/containerd
Windows: Fixes termination-file mounting support for containerd
2019-11-13 17:27:36 -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
e9ce31bcb3
Merge pull request #85219 from mm4tt/lease_cache_size
Increase cache size for leases
2019-11-13 14:52:00 -08:00
Kubernetes Prow Robot
d85103b185
Merge pull request #85217 from kaoskater08/kaoskater08/fix-golint-pkg-apis-extensions
fixed golint errors in pkg/apis/extensions register.go and types.go
2019-11-13 14:51:46 -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
ce0e9ba8a0
Merge pull request #85194 from hwdef/fix-link
fix wrong link
2019-11-13 14:51:17 -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
Cong Liu
8995c1e030 Update bucket for scheduler framework latency histograms. 2019-11-13 16:35:59 -05:00
Travis Rhoden
367f879131
Retire mount.Exec for k8s.io/utils/exec
This patch removes mount.Exec entirely and instead uses the common
utility from k8s.io/utils/exec.

The fake exec implementation found in k8s.io/utils/exec differs a bit
than mount.Exec, with the ability to pre-script expected calls to
Command.CombinedOutput(), so tests that previously relied on a callback
mechanism to produce specific output have been updated to use that
mechanism.
2019-11-13 14:09:57 -07:00
Kubernetes Prow Robot
c466fd9eaf
Merge pull request #85180 from k-toyoda-pi/use_log_e2e_storage_utils
Use log functions of core framework on e2e/storage/utils
2019-11-13 13:05:30 -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
209c025144
Merge pull request #85157 from alculquicondor/refactor/selector
Store topology spread constraints in metadata with labels.Selector
2019-11-13 13:04:35 -08:00
Kubernetes Prow Robot
f5df681b80
Merge pull request #85156 from chuckha/remove-infinte-poll
[kubeadm] Remove nested retries
2019-11-13 13:04:23 -08:00
Kubernetes Prow Robot
7d1580270a
Merge pull request #85151 from hypnoglow/scheduler-default-algo-source
scheduler: make algorithm source an option
2019-11-13 13:04:09 -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
d0f021524e
Merge pull request #85109 from rajansandeep/prepcorednsfor1.17-kube-up
Bumps CoreDNS to 1.6.5 and updates manifest for kube-up
2019-11-13 13:03:30 -08:00