Commit Graph

85867 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
27067540ff
Merge pull request #85246 from robscott/endpointslice-dualstack-proxy
Updating kube-proxy to support new EndpointSlice address types
2019-11-14 13:31:58 -08:00
Kubernetes Prow Robot
97225e2742
Merge pull request #85230 from oomichi/add-todo-issue81245
Add TODOs for removing invalid e2e dependencies
2019-11-14 13:31:41 -08:00
Kubernetes Prow Robot
24334444b4
Merge pull request #85175 from liggitt/golang-org-comments
Add comments to explain golang.org replace directives
2019-11-14 13:31:27 -08:00
Kubernetes Prow Robot
bfb99d809a
Merge pull request #85117 from hwdef/fix-staticcheck10
pkg/kubeapiserver: fix staticcheck warning
2019-11-14 13:31:15 -08:00
Kubernetes Prow Robot
acfc88d66e
Merge pull request #84752 from seans3/json_yaml_printers
Move json,yaml,jsonpath printers to correct locations
2019-11-14 13:31:04 -08:00
Kubernetes Prow Robot
5c772f5933
Merge pull request #84674 from hwdef/fix-staticcheck4
pkg/client: fix staticcheck warning
2019-11-14 13:30:45 -08:00
Kubernetes Prow Robot
e03d6e2311
Merge pull request #84660 from mkimuram/refactor-block-lock
Refactor block volume's descriptor lock logic
2019-11-14 13:30:30 -08:00
Jordan Liggitt
114e71b9de Avoid constructing table printer on every componentstatus request 2019-11-14 16:30:12 -05:00
Kubernetes Prow Robot
55cef8048c
Merge pull request #84439 from danielqsj/f-apparmor
refactor apparmor utils in e2e
2019-11-14 13:30:08 -08:00
Kubernetes Prow Robot
37c7c904e1
Merge pull request #84227 from soltysh/fix_scale_doc
Drop job from scale description
2019-11-14 13:29:51 -08:00
Kubernetes Prow Robot
7f7f99b7b5
Merge pull request #83964 from Jefftree/bdd-conformance
Initial Implementation for kubetestgen for Conformance.
2019-11-14 13:29:37 -08:00
Jordan Liggitt
a5760dee81 Add support for --runtime-config=api/beta=false, --feature-gates=AllBeta=false
Allow disabling all beta features and APIs
2019-11-14 14:37:55 -05:00
Kubernetes Prow Robot
9b75e36436
Merge pull request #85294 from ahg-g/ahg-15k
Rename PluginConfigArgs to AlgorithmConfigArgs
2019-11-14 11:20:11 -08:00
Kubernetes Prow Robot
547fdcc164
Merge pull request #85174 from zhouya0/add_table_convertor_componentstatus
add table convertor to componentstatus
2019-11-14 11:20:01 -08:00
Kubernetes Prow Robot
567b13487f
Merge pull request #85162 from apelisse/strip-nullable
Strip nullable for Server-side apply
2019-11-14 11:19:48 -08:00
Kubernetes Prow Robot
ba9f7419f9
Merge pull request #84732 from khenidak/fix-disable-dualstack
Fix a CM panic when ipam tries to lock an out of range pre existing cidr
2019-11-14 11:19:35 -08:00
Boyil (Elliot) Li
9b9562837f update pd csi driver controller manifests 2019-11-14 11:11:30 -08:00
Rob Scott
77df6bc9a8
Ensuring EndpointSlice controller does not start when feature gate or
API are disabled
2019-11-14 10:52:09 -08:00
Jordan Liggitt
7eb4838a61 Use CSINodes v1 API in scheduler 2019-11-14 13:40:50 -05:00
Boyil (Elliot) Li
f7bba28dab Enable snapshottable e2e test for csi pd driver
- add pd driver manifests
- modify snapshottable test case
2019-11-14 10:27:39 -08:00
Kenichi Omichi
aef8355358 Move RegisterNodeFlags() to e2e_node test
RegisterNodeFlags() is called in e2e_node test package only, so this
moves the function for making e2e core framework small and simple.
2019-11-14 18:11:21 +00:00
Kubernetes Prow Robot
78d2e52dee
Merge pull request #84859 from denkensk/move-volumebind-behind-permit
Move pod bindVolumes behind RunPermitPlugins
2019-11-14 10:05:48 -08:00
Kubernetes Prow Robot
979688b5cd
Merge pull request #84335 from mrkm4ntr/fix-node-evaluation
Add unit test to catch scheduler's node order evaluation regressions
2019-11-14 10:05:35 -08:00
Jordan Liggitt
0ac8345d3a Fix --resource-version handling in kubectl 2019-11-14 12:33:14 -05:00
Abdullah Gharaibeh
05606bb6e4 rename PluginConfigArgs to AlgorithmConfigArgs 2019-11-14 11:30:59 -05:00
Kubernetes Prow Robot
77e110fcef
Merge pull request #84046 from bclau/tests/agnhost-guestbook-replacement
Tests/agnhost guestbook replacement
2019-11-14 08:29:34 -08:00
Masaki Kimura
560d9c56eb Change mount.NewOSExec to utilexec.New 2019-11-14 15:58:27 +00:00
Masaki Kimura
8a09460c2f Change getDeviceMajorMinor to use unix.Stat 2019-11-14 15:58:27 +00:00
Masaki Kimura
aee875a855 Fix error messages in operation_generator.go 2019-11-14 15:58:27 +00:00
Masaki Kimura
a2cbc028f4 Remove remaining empty file in unmapBindMountDevice 2019-11-14 15:58:27 +00:00
Masaki Kimura
dd945424e1 Rename IsBindMountExist to IsDeviceBindMountExist 2019-11-14 15:58:26 +00:00
Masaki Kimura
bee6514d79 Remove klog for output error instead return err with context 2019-11-14 15:58:26 +00:00
Masaki Kimura
7abb704e7b Improve comments for volume path hanlder and volume.go 2019-11-14 15:58:26 +00:00
Masaki Kimura
5a351e3014 Check and return error first in IsSymlinkExist and IsBindMountExist 2019-11-14 15:58:26 +00:00
Masaki Kimura
8a159d7253 Move MapBlockVolume call to operation_generator and add UnmapBlockVolume 2019-11-14 15:58:26 +00:00
Masaki Kimura
68be3947b8 Make descriptor lock per pod and release it per pod
This change is needed to avoid unmapVolumeFunc for one pod blocked,
when the lock for the same volume is taken for another pod.
2019-11-14 15:58:26 +00:00
Masaki Kimura
2ecdc5e8d1 Change globalMapPath to bind mount from symlink
This change is needed to make descriptor lock per pod, in the next commit.
If losetup is called for symlink, path in the output for losetup is resolved,
as a result, we can't distinguish which path the lock is taken.
2019-11-14 15:58:26 +00:00
Ted Yu
7bafa7d8f5 Check error return from closing connection 2019-11-14 07:36:30 -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
Dan Winship
ca32fd23cc Update debian-iptables image digests for v12.0.1 build 2019-11-14 09:59:27 -05:00
Dan Winship
ffe93b3979 Update debian-iptables iptables-wrapper script
The debian-iptables v12.0.0 build didn't work because of another
previously-undiscovered iptables 1.8.x bug. Work around it for now and
bump the version to v12.0.1; we can revert back to the original
version of the script once iptables 1.8.4 is available in
buster-backports.
2019-11-14 09:57:57 -05:00
Dan Winship
8a646d2634 Update debian-iptables image digests for v12.0.0 build 2019-11-14 09:57:57 -05:00
Dan Winship
fed582333f Add mode-detecting iptables wrappers to the debian-iptables image 2019-11-14 09:57:57 -05:00
Dan Winship
ee681f7bd3 Update debian-base image digests for v2.0.0 build 2019-11-14 09:57:56 -05:00
Tim Hockin
573a99ea51 Bump debian-base to buster 2019-11-14 09:57:56 -05:00
Kubernetes Prow Robot
3b440dfd55
Merge pull request #85077 from gongguan/DeleteOptions
add DeleteOptions conversion
2019-11-14 02:55:34 -08:00
zhouya0
7302a98560 add table convertor to componentstatus 2019-11-14 17:31:37 +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