Commit Graph

2887 Commits

Author SHA1 Message Date
Kubernetes Publisher 53a7466644 Merge pull request #75717 from wojtek-t/reduce_critical_sections
Reduce critical sections in cacher::Watch function

Kubernetes-commit: df9e66628ce43f5fbc806bb16554bff8276fbcf1
2019-03-27 02:52:59 +00:00
Kubernetes Publisher b37a96d129 Merge pull request #75699 from smarterclayton/fast_encode
Avoid allocations when building SelfLinks and fast path escape

Kubernetes-commit: 1514bb2141d3c82830f64aa0e1f8c3650116b803
2019-03-26 22:54:34 +00:00
Han Kang 18a2d0a0ba log preshutdowndown registration error if we encounter one
Kubernetes-commit: 021f6082944496765383c7572157e9be86ed4177
2019-03-26 13:04:10 -07:00
Clayton Coleman c8f7d5017d 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.

Kubernetes-commit: 8fede0b18a81a6fb1acc1a48857f482857c25286
2019-03-25 23:33:48 -04:00
Clayton Coleman 8541248953 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).

Kubernetes-commit: 389a8436b52db4936b56e08f07984da362c91f6b
2019-03-25 18:06:57 -04:00
Kubernetes Publisher f881eae9ec Merge pull request #74321 from yastij/signal-undecorated-storage-event
use cache size to signal undecorated storage

Kubernetes-commit: ec64aef25f2fc8c7f3093d16566e6d2e40b61e4e
2019-03-24 10:52:20 +00:00
Kubernetes Publisher 5eae03fa38 Merge pull request #75570 from smarterclayton/fix_performance
Fix a regression in watch performance and reduce allocations in the GET path

Kubernetes-commit: b3824cd094f73def9d3cdb659f7fab9d855318fe
2019-03-22 22:57:53 +00:00
Clayton Coleman 78a40897c5 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
```

Kubernetes-commit: 0489d0b1cf139253b82f73b072578073bc5616d6
2019-03-21 21:00:55 -04:00
Clayton Coleman 70165311bb 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
```

Kubernetes-commit: 59b4f47b225029068bf015117ada1a06d54fbd59
2019-03-21 20:57:36 -04:00
Clayton Coleman f24566b3c2 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
```

Kubernetes-commit: 83c41eab1d6f55c9ccf61744bfc345c95d3a0664
2019-03-21 20:48:00 -04:00
Clayton Coleman 9006e59e3b 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
```

Kubernetes-commit: 58fb665646aa4c1b63f1322a50e3af7a60e39886
2019-03-21 20:43:26 -04:00
Clayton Coleman dd5dd7ec7e 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
```

Kubernetes-commit: 2e1506558ac2c82e83cbef469a6e1e845cfc9235
2019-03-21 20:45:19 -04:00
Kubernetes Publisher 0b35c22017 Merge pull request #75214 from deads2k/health
provide verbose output when health check fails

Kubernetes-commit: 1e184775aab958378bacc6e20723a20571e4ad19
2019-03-22 14:53:32 +00:00
Kubernetes Publisher b663bdd6e2 Merge pull request #75270 from justincormack/uuid4
Use UUIDv4 not UUIDv1

Kubernetes-commit: 83d467c22e428fdb685fff3608e467531615d143
2019-03-22 10:55:51 +00:00
Joe Betz 4cc45f82fc Add resourceVersion=0 paginated list integration test for disabled and enabled watch cache
Kubernetes-commit: e5a4f09ab3ac15815ceb039fbc7f546266855fd6
2019-03-21 11:25:07 -07:00
fansong.cfs c302cc97dd delivery event non blocking firstly
Kubernetes-commit: 8910abfdf3d13faf2bf415dc1019006fb06cbc9f
2019-03-21 17:11:58 +08:00
Kubernetes Publisher be70ee9701 Merge pull request #75264 from smarterclayton/optimize_rbac_visit
Avoid allocating when performing VisitRulesFor on service accounts

Kubernetes-commit: ed4258e5c0d722425b1c7744b2bf09ad0d9fbfea
2019-03-21 02:58:03 +00:00
Kubernetes Publisher e401ca3b79 Merge pull request #75279 from danielqsj/admission-metrics
remove the deprecated admission metrics

Kubernetes-commit: 5229bce04fc7d632f9349480267807a1d41fedf8
2019-03-20 14:53:29 +00:00
Kubernetes Publisher d5ae2df97a Merge pull request #71548 from smarterclayton/watch_converted
Support Table and PartialObjectMetadata on watch

Kubernetes-commit: 6f9bf5fe98bcc3b436fea4d6dd345a1502d20778
2019-03-20 06:55:11 +00:00
Kubernetes Publisher 7845c0df69 Merge pull request #73409 from yue9944882/bugfix/compatible-with-nil-authorizer
Fixes authz compatibility w/ nil authorizer in apiserver

Kubernetes-commit: a6677d6f3e2bf66299bf96a8737f2babf0327212
2019-03-20 02:51:46 +00:00
Joe Betz f90442e3fb Paginate List call performed by Reflector's ListAndWatch call
Kubernetes-commit: 84723c2d3ef5ff5d30aadd1ad72068bf2254358c
2019-03-14 13:26:19 -07:00
Kubernetes Publisher 39e839dff0 Merge pull request #75289 from dims/update-http2-dep-go-1.12
Update golang.org/x/net/... dependencies to release-branch.go1.12

Kubernetes-commit: e7d09ceb5019153831b4921ff35a170e46f634d2
2019-03-13 12:07:55 +00:00
Kubernetes Publisher 12dc5a8c75 Merge pull request #75277 from jennybuckley/fix-ints
Fix server side apply int/float bug

Kubernetes-commit: 93402fc8e85dd980af2ca2007232065bb9cf0d5d
2019-03-13 04:00:33 +00:00
Kubernetes Publisher 91bbfdf08d Merge pull request #74040 from ajatprabha/issue_73648
add ResourceVersion to DeleteOptions.Preconditions

Kubernetes-commit: cc8afb25fcfbb2a12ef43300db89d724b284e3e3
2019-03-13 00:00:49 +00:00
Kubernetes Publisher 71c2b3645e Merge pull request #75157 from aaron-prindle/version-check-apply
Added version check between patch and live object in server side apply

Kubernetes-commit: 0977ab69ade1fb9e286fe8cc6075fe1ac00ef3ca
2019-03-12 23:59:57 +00:00
Davanum Srinivas aa150a0715 Update to go 1.12 version of golang.org/x/net
Change-Id: I3f2fa5d7b6811c9eca58992318d19e44ec9131fd

Kubernetes-commit: 2aa1348e6cf4d51f91025c41d41bb7e3b9b9384d
2019-03-12 09:16:45 -04:00
Kubernetes Publisher c1d3c7c86e Merge pull request #72942 from caesarxuchao/expose-storage-version-hash
Populate the storage version hash

Kubernetes-commit: eb6a1b651c43aa74d2dfcf2ca6115f77cb06b6ce
2019-03-12 07:58:40 +00:00
jennybuckley aabe804197 Fix int/float apply bug
Kubernetes-commit: 10259c959e9f20668659f7e20251a217b51c6355
2019-03-11 23:07:21 -07:00
danielqsj 1de9bb3580 remove the deprecated admission metrics
Kubernetes-commit: b31a3403c4b60d421900d9ddef3a27d23ea9c4c6
2019-03-12 14:06:38 +08:00
Justin Cormack bd2409decf Use UUIDv4 not UUIDv1
UUIDv1 has several disadvantages:
 - it encodes the MAC address of the host, which is a potential privacy issue
 - it uses the clock of the host, which reveals time information
 - the clock is very coarse, hence the complex code handling duplicates

UUIDv4 is simply a 122 bit random number encoded into the UUID format, which
has no problems with duplicates or locking.

Use the google/uuid library, as newer versions of pborman/uuid just wrap the
Google upstream.

Note that technically a random UUID might fail, but Go ensures that this
should not take place, as it will block if entropy is not available.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>

Kubernetes-commit: 0fb4b81c3f5139d09208b63a62574d0eb85e0390
2019-03-11 20:30:20 +00:00
Clayton Coleman 49ac3bd853 Avoid allocating when performing VisitRulesFor on service accounts
Service account authorization checks are done frequently and were
observed to perform 7% of allocations on a system running e2e tests.
The allocation comes from when we walk the authorization rules to
find matching service accounts.

Optimize the check for service account names to avoid allocating.

Kubernetes-commit: 4c87a14e6b1809359fcb6566d883a169ff0db259
2019-03-11 11:50:44 -04:00
David Eads 121f70dcfd provide verbose output when health check fails
Kubernetes-commit: 3874e43550385c0f4adddc4ccbedf12478233692
2019-03-08 15:49:29 -05:00
Aaron Prindle a595f8c602 Added version check between patch and live object in server side apply
What is the problem being solved?
https://github.com/kubernetes/kubernetes/pull/75135
Currently version compatibility is not being checked in server side apply between the patch object and the live object.  This is causing a merge that will error to be run and the apiserver returns a 500 error.  The request should fail if the apiVersion provided in the object is different from the apiVersion in the url, but it should fail before trying to merge, and be a 4xx error. Probably a bad request error.

Why is this the best approach?
The approach of serializing the patch byte array and then checking for version equality with the already serialized live object is the simplest and most straightforward solution.

Kubernetes-commit: d5bd17cda0c134e5ef5c03c3eac79a9ce4e18003
2019-03-07 16:52:26 -08:00
ajatprabha 9f2ef664a0 update testDeleteWithResourceVersion
Kubernetes-commit: fe3b9f486fe988cf6b6cd83c54c2be77892fa123
2019-02-25 22:43:28 +05:30
Yassine TIJANI 72bd8c7a64 use cache size to signal undecorated storage
Kubernetes-commit: 8261d3d9a63f0972453f6503b62299a96ecee657
2019-02-20 22:15:24 +01:00
wojtekt 6ef883ed27 Reduce critical sections in watchache
Kubernetes-commit: 010cb4480825b54afb85c9fa97e2edc950a6d185
2019-02-20 10:41:50 +01:00
ajatprabha ad205f8388 add ResourceVersion check to Preconditions#Check
Kubernetes-commit: 3135cea2cce02bc8c6796e97f4579d538f357f74
2019-02-15 12:30:34 +05:30
ajatprabha e6793285a2 check for ResourceVersion conflict in separate if block
Kubernetes-commit: 42f0a36f44bac33f4230fdea9f3dcc4bfb645a0a
2019-02-15 04:37:18 +05:30
wojtekt aa009934a5 Add API for watch bookmarks
Kubernetes-commit: 2a76b82394a8853298f64bfe83df1015a05259e6
2019-02-14 12:59:56 +01:00
ajatprabha 10074505ca add ResourceVersion to DeleteOptions.Preconditions
Kubernetes-commit: 8f48d762717dfe1f479cfabaabc4fb9261a1bc8f
2019-02-14 04:09:12 +05:30
zhoulin xie 77ddb0c208 remove redundant words 'the' in comment
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>

Kubernetes-commit: 77ba845e6d2f0cba81993621531ae5915e7c072b
2019-02-13 22:40:34 +08:00
yue9944882 95755841db fixes compatibility w/ nil authorizer in apiserver
Kubernetes-commit: 2486174142023ef785f196afee69bbcb78ae1f52
2019-01-29 00:38:57 +08:00
Chao Xu 22170dcd1d generated BUILD
generated proto

Kubernetes-commit: 887cb93d8d74ac6491df850edef051bf607fceb6
2019-01-15 13:41:53 -08:00
Chao Xu d99ef88606 Expose storage version hash
Kubernetes-commit: 3b618af0d435628feedf06f97bd1c69340d07d95
2019-01-14 19:31:25 -08:00
Kubernetes Publisher 7ec69625ac sync: update godeps 2019-03-11 16:10:03 +00:00
Kubernetes Publisher a7b2fc7349 Merge pull request #75151 from jennybuckley/fix-conversion-bug
Fix apply conversion bug

Kubernetes-commit: 92b66c5c0251a2258c5a7092086306570fc0085b
2019-03-09 15:15:26 -08:00
jennybuckley 2deaad0322 Fix version converter
Kubernetes-commit: f9e57744d3e760b1473cb22e655d20c254af03b6
2019-03-07 17:44:21 -08:00
Kubernetes Publisher e0e99f3706 Merge pull request #74760 from apelisse/add-mangerfield-flag
Add "fieldManager" to flag to PATCH/CREATE/UPDATE

Kubernetes-commit: 0b4275b6c7ecd55cfd9916dbef8fe48ae4a8c733
2019-03-09 17:27:41 +00:00
Antoine Pelisse 46d98f52ff Add "fieldManager" to flag to PATCH/CREATE/UPDATE
And add a corresponding flag in kubectl (for apply), even though the
value is defaulted in kubectl with "kubectl".

The flag is required for Apply patch-type, and optional for other PATCH,
CREATE and UPDATE (in which case we fallback on the user-agent).

Kubernetes-commit: eb904d8fa89da491f400614f99458ed3f0d529fb
2019-02-16 20:16:11 -08:00
Kubernetes Publisher d80a467281 Merge pull request #75201 from joelsmith/secdoc
Update embargo doc link in SECURITY_OWNERS and change PST to PSC

Kubernetes-commit: 8bde75e63f9313fdc1d4f9a806b4b3a8ea128565
2019-03-08 23:56:52 +00:00