Commit Graph

6043 Commits

Author SHA1 Message Date
fansong.cfs
c676e234cc add timeout suuport for watch 2019-03-31 15:57:09 +08:00
Kubernetes Prow Robot
312eb890e6 Merge pull request #75760 from wojtek-t/follow_comment_from_critical_sections
Add explanation about forgetFunc in cacher
2019-03-27 18:41:26 -07:00
Kubernetes Prow Robot
a519e91256 Merge pull request #75748 from smarterclayton/request_scope_as_pointer
Make RequestScope be a pointer consistently for better memory use
2019-03-27 18:41:11 -07:00
Kubernetes Prow Robot
a8cbb22506 Merge pull request #74747 from liggitt/quota-deadlock
quota controller fixes
2019-03-27 09:04:48 -07:00
Clayton Coleman
8fede0b18a Make RequestScope be a pointer consistently for better memory use
RequestScope is a large struct and causes stack growth when we pass
it by value into multiple stack levels. Avoid the allocations for
this read only struct by passing a pointer.
2019-03-27 11:09:42 -04:00
wojtekt
605522b0c7 Add explanation about forgetFunc in cacher 2019-03-27 08:24:45 +01:00
Clayton Coleman
316a87ce7d Avoid allocating the watch shim object more than once
We can reset and reuse this object repeatedly without triggering an
allocation.
2019-03-26 23:36:49 -04:00
Jordan Liggitt
0f9ebe5e16 Generated files 2019-03-26 23:15:39 -04:00
Jordan Liggitt
6eb082d6b0 Generate networkpolicies extensions/v1beta1 client 2019-03-26 23:15:39 -04:00
Kubernetes Prow Robot
42770799d3 Merge pull request #75743 from logicalhan/preshutdownerror
log preshutdowndown registration error if we encounter one
2019-03-26 19:27:00 -07:00
Kubernetes Prow Robot
feb9bb151c Merge pull request #75730 from wojtek-t/minor_perf_improvements
Avoid allocations in ByIndex() function
2019-03-26 18:11:16 -07:00
Kubernetes Prow Robot
df9e66628c Merge pull request #75717 from wojtek-t/reduce_critical_sections
Reduce critical sections in cacher::Watch function
2019-03-26 18:11:02 -07:00
Kubernetes Prow Robot
4b3eb60081 Merge pull request #75531 from dims/add-new-staging-repository-for-cri-api
New staging repository for cri-api
2019-03-26 18:10:49 -07:00
Davanum Srinivas
33081c1f07 New staging repository for cri-api
Change-Id: I2160b0b0ec4b9870a2d4452b428e395bbe12afbb
2019-03-26 18:21:04 -04:00
Kubernetes Prow Robot
1514bb2141 Merge pull request #75699 from smarterclayton/fast_encode
Avoid allocations when building SelfLinks and fast path escape
2019-03-26 15:10:29 -07:00
Kubernetes Prow Robot
531dbd409f Merge pull request #75445 from shinytang6/enhance/fmt
Replace all time.Now().Sub with time.Since
2019-03-26 13:55:17 -07:00
Han Kang
021f608294 log preshutdowndown registration error if we encounter one 2019-03-26 13:04:10 -07:00
Kubernetes Prow Robot
b0158cea16 Merge pull request #75399 from sttts/sttts-initial-bulk-openapi-merge
apiextensions: merge OpenAPI specs once after cache sync
2019-03-26 12:34:03 -07:00
Kubernetes Prow Robot
11d472ea01 Merge pull request #72179 from WanLinghao/sa_controller
Migrate the controller to use TokenRequest and rotate token periodically
2019-03-26 12:33:19 -07:00
Kubernetes Prow Robot
152f0a150e Merge pull request #75693 from smarterclayton/speed_up_time_json
Reduce allocations in metav1.Time JSON serialization
2019-03-26 11:17:33 -07:00
Clayton Coleman
389a8436b5 Avoid allocations when building SelfLinks and fast path escape
A self link should only require one allocation, and we should skip
url.PathEscape() except when the path actually needs it.

Add a fuzz test to build random strings and verify them against
the optimized implementation. Add a new BenchmarkWatchHTTP_UTF8 that
covers when we have unicode names in the self link.

```
> before
BenchmarkGet-12          	   10000	    118863 ns/op	   17482 B/op	     130 allocs/op
BenchmarkWatchHTTP-12    	   30000	     38346 ns/op	    1893 B/op	      29 allocs/op

> after
BenchmarkGet-12               	   10000	    116218 ns/op	   17456 B/op	     130 allocs/op
BenchmarkWatchHTTP-12         	   50000	     35988 ns/op	    1571 B/op	      26 allocs/op
BenchmarkWatchHTTP_UTF8-12    	   50000	     41467 ns/op	    1928 B/op	      28 allocs/op
```

Saves 3 allocations in the fast path and 1 in the slow path (the
slow path has to build the buffer and then call url.EscapedPath
which always allocates).
2019-03-26 11:38:47 -04:00
wojtekt
7d46e27db1 Avoid allocations in ByIndex() function 2019-03-26 14:14:42 +01:00
Dr. Stefan Schimanski
a7f9ffd39f apiextensions: merge OpenAPI specs once after cache sync 2019-03-26 11:01:29 +01:00
wojtekt
010cb44808 Reduce critical sections in watchache 2019-03-26 08:44:51 +01:00
Kubernetes Prow Robot
e7eb742c19 Merge pull request #75657 from guilhermeoki/docs/sample-controller
sample-controller: update README
2019-03-25 17:45:00 -07:00
Clayton Coleman
b405cdf85b Reduce allocations in metav1.Time JSON serialization
Time has a limited set of allowed characters and so can bypass part of
the expensive checking done for valid JSON characters.

```
BenchmarkGet-12          	   10000	    111846 ns/op	   17273 B/op	     130 allocs/op
BenchmarkWatchHTTP-12    	   50000	     37830 ns/op	    1886 B/op	      29 allocs/op

BenchmarkGet-12          	   20000	    115917 ns/op	   17344 B/op	     130 allocs/op
BenchmarkWatchHTTP-12    	   50000	     36741 ns/op	    1775 B/op	      24 allocs/op
```

Can improve CRD watch performance by 5-10% for small objects.
2019-03-25 18:17:04 -04:00
Kubernetes Prow Robot
0fd410c4fc Merge pull request #75486 from misterikkit/metrics-client
Fix fake clientsets in metrics.k8s.io.
2019-03-25 12:10:46 -07:00
WanLinghao
244b244f9d Migrate the controller to use TokenRequest and rotate token periodically 2019-03-25 14:54:22 +08:00
Guilherme Oki
54e3f0f8a9 sample-controller: update README 2019-03-25 00:12:53 -03:00
Kubernetes Prow Robot
ec64aef25f Merge pull request #74321 from yastij/signal-undecorated-storage-event
use cache size to signal undecorated storage
2019-03-24 03:21:05 -07:00
Kubernetes Prow Robot
9f15368c5c Merge pull request #75576 from smarterclayton/bad_2
Remove use of `%#v` in frequently accessed code
2019-03-22 23:59:05 -07:00
Kubernetes Prow Robot
206ecb4ab8 Merge pull request #71326 from shomron/issue-71277-polluntil-leak
Fix goroutine leak in pkg/util/wait PollUntil()
2019-03-22 20:57:06 -07:00
Kubernetes Prow Robot
3312da83c9 Merge pull request #75602 from smarterclayton/kubelet_proto
Kubelet should request protobuf from the apiserver
2019-03-22 15:46:34 -07:00
Kubernetes Prow Robot
994582965d Merge pull request #75496 from andrewsykim/area-cloudprovider-label
add area/cloudprovider label for changes in pkg/cloudprovider & k8s.i…
2019-03-22 15:46:21 -07:00
Clayton Coleman
0489d0b1cf Unify runtime.SerializerInfo with negotiate.AcceptedMediaTypes
There was no reason to have two types and this avoids ~10% of allocations
on the GET code path.

```
BenchmarkGet-12          	  100000	    109045 ns/op	   17608 B/op	     146 allocs/op

BenchmarkGet-12          	  100000	    108850 ns/op	   15942 B/op	     132 allocs/op
```
2019-03-22 13:24:25 -04:00
Clayton Coleman
59b4f47b22 Avoid 3 object creations when no dryRun parameter is provided
These allocations should only occur rarely.

```
BenchmarkGet-12          	  100000	    108013 ns/op	   17732 B/op	     149 allocs/op

BenchmarkGet-12          	  100000	    109045 ns/op	   17608 B/op	     146 allocs/op
```
2019-03-22 13:24:24 -04:00
Clayton Coleman
83c41eab1d Avoid an allocation on all requests when checking for an old user agent
ReplaceAllStrings always allocates, while scanning a relatively short
regex twice is slightly more CPU immediately but less later.

```
BenchmarkGet-12          	  100000	    108824 ns/op	   17818 B/op	     152 allocs/op

BenchmarkGet-12          	  100000	    108013 ns/op	   17732 B/op	     149 allocs/op
```
2019-03-22 13:24:24 -04:00
Clayton Coleman
58fb665646 IsListType uses reflection and is expensive for hot paths
IsListType was causing ~100 allocations for a non list object. It is
used in a wide range of code, so perform a more targeted check.

The use of `%#v` in a hot return path for `fmt.Errorf()` was the main
victim.

Replace `%#v` with a typed error and create a cache of types that are
lists with a bounded size (probably not necessary, but safer).

```
BenchmarkGet-12          	  100000	    119635 ns/op	   20110 B/op	     206 allocs/op
BenchmarkWatchHTTP-12    	  100000	     65761 ns/op	    7296 B/op	     139 allocs/op

BenchmarkGet-12          	  100000	    109085 ns/op	   17831 B/op	     152 allocs/op
BenchmarkWatchHTTP-12    	  200000	     33966 ns/op	    1913 B/op	      30 allocs/op
```
2019-03-22 13:24:24 -04:00
Clayton Coleman
7d53ad1fb0 Kubelet should request protobuf from the apiserver
The kubelet was not asking for application/vnd.kubernetes.protobuf
on list and get calls. It looks like we lost that code when we
moved to cert rotation. Clean up the client initialization path
and make sure that all non-dynamic clients use protobuf by default.
2019-03-22 12:42:20 -04:00
Clayton Coleman
2e1506558a Add benchmark for naive endpoint Get so we can measure it
Baseline:

```
BenchmarkGet-12          	  100000	    119635 ns/op	   20110 B/op	     206 allocs/op
BenchmarkWatchHTTP-12    	  100000	     65761 ns/op	    7296 B/op	     139 allocs/op
```
2019-03-22 11:43:39 -04:00
Kubernetes Prow Robot
e739b55374 Merge pull request #75585 from tiffanyfay/cache
Updated client-go expiration cache to take in expiration policies
2019-03-22 07:06:20 -07:00
Kubernetes Prow Robot
1e184775aa Merge pull request #75214 from deads2k/health
provide verbose output when health check fails
2019-03-22 05:22:31 -07:00
tiffany jernigan
bc226a2a89 Updated client-go expiration cache to take in expiration policies 2019-03-22 07:38:35 +00:00
Kubernetes Prow Robot
ab35bd0668 Merge pull request #75577 from mars1024/bugfix/use_add_in_enqueue
replace AddRateLimited with Add in enqueue func
2019-03-22 00:04:57 -07:00
Kubernetes Prow Robot
83d467c22e Merge pull request #75270 from justincormack/uuid4
Use UUIDv4 not UUIDv1
2019-03-22 00:04:17 -07:00
Bruce Ma
0335867b56 replace AddRateLimited with Add in enqueue func 2019-03-22 11:40:23 +08:00
Clayton Coleman
435db312e1 Avoid using %#v for errors when %T is more informative
`%#v` may have significant performance costs in frequently invoked code.
2019-03-21 22:54:06 -04:00
Clayton Coleman
ecd43f13cf Avoid using %#v for errors when %T or %s would be more accurate
`%#v` may have significant performance costs in frequently invoked code.
2019-03-21 22:53:43 -04:00
Clayton Coleman
082aee343e Avoid using %#v for errors when %T is clearer
`%#v` may have significant performance costs in frequently invoked code.
2019-03-21 22:53:07 -04:00
Jonathan Basseri
ab7e2ff136 Fix fake clientsets in metrics.k8s.io.
The generated fake clientsets were using the API group "metrics" instead
of "metrics.k8s.io". This patch includes a test that fails without the
fix.

The `+groupName` annotation needed to be copied to the v1alpha1 and
v1beta1 packages to fix it.

As a result, tests using this fake clientset work as expected.
2019-03-21 10:41:57 -07:00