Commit Graph

18 Commits

Author SHA1 Message Date
Wojciech Tyczyński 697d456e35 Minor cleanup in watch handlers
Kubernetes-commit: d907062308563b1a9e52152c48f4240a6e11aade
2023-11-29 22:31:05 +01:00
Wojciech Tyczyński 3bcdefc0fd Refactor transformers for watch to implement Encoder interface
Kubernetes-commit: 160589a0edb2038f2e22e376b6a0b71a24d21f22
2023-08-11 21:43:49 +02:00
Tim Hockin 1431da0154 Replace uses of diff.ObjectDiff with cmp.Diff
ObjectDiff is already a shim over cmp.Diff, so no actual output or
behavior changes

Kubernetes-commit: 29c0b73d640b6e50c4f2dfeee7b07ca66a530dbd
2023-03-23 11:29:01 -07:00
Maciej Borsz 49647f7386 Add benchmark for caching object
Kubernetes-commit: e577a77eb8160a5f70668a5d538ab5a1498ba0db
2022-10-25 12:57:24 +00:00
tanjing2020 4785d0d3e4 fix staticcheck failures on vendor/k8s.io/apiserver/pkg/endpoints
Kubernetes-commit: c38a06bca6bb360caf9bc679ba19a5a4be662bd1
2020-12-11 14:23:30 +08:00
knight42 5c23eb937e test(endpoints): deflake TestWatchHTTPTimeout
Signed-off-by: knight42 <anonymousknight96@gmail.com>

Kubernetes-commit: 50e8287e6df67428ab5871af530fb10f6eee19de
2020-08-12 01:58:07 +08:00
Jordan Liggitt 2e70c9ff51 client-go dynamic client: add context to callers
Kubernetes-commit: b7c2faf26c2a25427794478c6265e6d55e8acb5a
2020-03-06 10:17:41 -05:00
chenjun.cj d1465bc6c3 fix potential memory leak issue in processing watch request
Kubernetes-commit: b911aa6471a83b1d2b4ea346e5c6b442dfa9b53b
2019-11-18 16:43:15 +08:00
chenjun.cj 455e205726 use context to check client closed instead of http.CloseNotifier in processing watch request
Kubernetes-commit: 1daa08c5c8634af762b0352ff4a49bdef6924c5f
2019-11-18 21:27:05 +08:00
Clayton Coleman 26a8fb1b92 test: Watch should fail immediately on negotiate errors
Instead of returning an error on the watch stream, if we can't properly
negotiate a watch serialization format we should error and return that
error to the client.

Kubernetes-commit: 9aad6aa54d824ba93a6670cd5a0cab6ad337e9f0
2019-11-03 15:08:22 -05:00
haoshuwei 5bce489f18 fix some ineffassigns
Signed-off-by: haoshuwei <haoshuwei24@gmail.com>

Kubernetes-commit: aaed9daf9b44757e767d93bd45d1bb0412c00243
2019-09-09 18:52:17 +08: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
Clayton Coleman 8d7b330c4c Support Table and PartialObjectMetadata on watch
Clean up the code paths that lead to objects being transformed and output with negotiation.
Remove some duplicate code that was not consistent. Now, watch will respond correctly to
Table and PartialObjectMetadata requests. Add unit and integration tests.

When transforming responses to Tables, only the first watch event for a given type will
include the columns. Columns will not change unless the watch is restarted.

Add a volume attachment printer and tighten up table validation error cases.

Disable protobuf from table conversion because Tables don't have protobuf because they
use `interface{}`

Kubernetes-commit: 3230a0b4fd14a6166f8362d4732e199e8779c426
2018-11-28 23:50:12 -05:00
Clayton Coleman 4e305103fd Dynamic client watchers should be able to handle ERROR gracefully
Watch can return type "ERROR" and a metav1.Status object. We need to
handle that during wait, and make it easy to handle the status object.

Kubernetes-commit: 5a8afa073f6b8cbb8b09f997f6db747c39dffb6e
2018-10-03 14:16:44 -04:00
deads2k aa72cc77b2 remove dead code
Kubernetes-commit: 0801ded4252684c47d8a50700f9f5ff8ff88b964
2017-07-16 04:08:41 +00:00
Dr. Stefan Schimanski a372fcad62 Mechanical fixup imports: pkg/genericapiserver 2017-02-13 07:36:41 -05:00
Dr. Stefan Schimanski f3c3e07241 Mechanical move: pkg/genericapiserver -> k8s.io/apiserver 2017-02-13 07:36:41 -05:00