Commit Graph

62 Commits (0c669fe6cc48208ebcdd43fa2ff425fce3c359a0)

Author SHA1 Message Date
Clayton Coleman ca2f1b87ad
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation
and reduce the need to allocate during negotiation. Simplify the dynamic
client's logic around negotiating type. Add more tests for media type
handling where necessary.
2016-10-28 11:30:11 -04:00
Jordan Liggitt fdb7c93a97
Close websocket watch when client closes 2016-08-17 15:20:05 -04:00
lixiaobing10051267 97219275b1 Apiserver ServeHTTP() modify 2016-07-16 12:29:11 +08:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Clayton Coleman 36a5ffbe2f
Remove EncodeToStream(..., []unversioned.GroupVersion)
Was not being used.
2016-06-10 18:43:12 -04:00
k8s-merge-robot ce788c45ef Merge pull request #26085 from smarterclayton/delay_flush
Automatic merge from submit-queue

Delay flush if the watch queue has pending items

Simple deferral of flush can reduce Syscalls when watch queues build up.

Simpler version of #24768

Fixes #24729

@xiang90 @wojtek-t
2016-05-28 11:53:51 -07:00
Clayton Coleman c4bec1585f Delay flush if the watch queue has pending items
Simple deferral of flush can reduce Syscalls when watch queues build up.
2016-05-23 12:35:36 -04:00
Clayton Coleman b1a759cbbc
Avoid extra allocations in watch loop 2016-05-21 23:55:41 -04:00
Clayton Coleman e0ebcf4216
Split the storage and negotiation parts of Codecs
The codec factory should support two distinct interfaces - negotiating
for a serializer with a client, vs reading or writing data to a storage
form (etcd, disk, etc). Make the EncodeForVersion and DecodeToVersion
methods only take Encoder and Decoder, and slight refactoring elsewhere.

In the storage factory, use a content type to control what serializer to
pick, and use the universal deserializer. This ensures that storage can
read JSON (which might be from older objects) while only writing
protobuf. Add exceptions for those resources that may not be able to
write to protobuf (specifically third party resources, but potentially
others in the future).
2016-05-05 12:08:23 -04:00
Clayton Coleman 3111985564 Handle streaming serializers more consistently
Add tests to watch behavior in both protocols (http and websocket)
against all 3 media types. Adopt the
`application/vnd.kubernetes.protobuf;stream=watch` media type for the
content that comes back from a watch call so that it can be
distinguished from a Status result.
2016-04-22 11:07:24 -04:00
Clayton Coleman 3474911736 Implement a streaming serializer for watch
Changeover watch to use streaming serialization. Properly version the
watch objects. Implement simple framing for JSON and Protobuf (but not
YAML).
2016-04-11 11:22:05 -04:00
Clayton Coleman 6e0ad75a6e Change the signature of resthandler.err for upcoming watch changes
Watch will need to be able to invoke scope.err, and it will not
have access to the go-restful req/res. Change to use the raw http
type now.
2016-01-30 18:00:43 -05:00
Clayton Coleman 125ef6fbc8 Support content-type negotiation in the API server
A NegotiatedSerializer is passed into the API installer (and
ParameterCodec, which abstracts conversion of query params) that can be
used to negotiate client/server request/response serialization. All
error paths are now negotiation aware, and are at least minimally
version aware.

Watch is specially coded to only allow application/json - a follow up
change will convert it to use negotiation.

Ensure the swagger scheme will include supported serializations - this
now includes application/yaml as a negotiated option.
2016-01-22 00:12:50 -05:00
Jordan Liggitt 993ef54e12 Close web socket watches correctly 2015-12-10 14:20:46 -05:00
Wojciech Tyczynski f4d75e0a0a Support timeout in watch requests 2015-10-24 13:12:49 +02:00
Mike Danese 8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Clayton Coleman debd42a07d Cleaning up apiserver method signatures
A lot of the changes in apiserver could have been represented more
cleanly - this returns the signatures to their older behavior (and
unbreaks OpenShift).
2015-06-18 15:13:41 -04:00
Prashanth Balasubramanian 0162529ea5 Default minRequestTimeout to 1800s 2015-06-03 08:47:45 -07:00
Prashanth Balasubramanian 448867073d Pipe minRequestTimeout as an arg to the apiserver 2015-06-03 08:44:14 -07:00
Prashanth Balasubramanian 8a5445d3db Randomize apiserver watch timeouts 2015-05-21 20:52:33 -07:00
Eric Paris 6b3a6e6b98 Make copyright ownership statement generic
Instead of saying "Google Inc." (which is not always correct) say "The
Kubernetes Authors", which is generic.
2015-05-01 17:49:56 -04:00
Clayton Coleman eb0eff69fe Move watch to being a resthandler resource and expose it on LIST
GET /pods?watch=true&resourceVersion=10

will now function equivalent to GET /watch/pods.
2015-03-27 15:03:58 -04:00
Clayton Coleman 1618c39a46 Convert List query parameters via object conversion
Convert url.Values -> an object, with appropriate versioning. ListOptions
should also expose parameter names to swagger.
2015-03-27 15:03:57 -04:00
Clayton Coleman d46087db50 Move REST* interfaces into pkg/api/rest
Dependency chain is now api -> api/rest -> apiserver.  Makes the
interfaces much cleaner to read, and cleans up some inconsistenties
that crept in along the way.
2015-03-23 16:52:21 -04:00
Brendan Burns 6d763dce2b start normalizing error handling in watch. 2015-03-17 21:04:55 -07:00
Daniel Smith 05ea93f985 Merge pull request #5147 from a-robinson/func
Re-add the defer statements around the monitor() calls in the apiserver.
2015-03-06 15:31:45 -08:00
Alex Robinson 60f0e9d673 Fix the broken calls to the monitor() by having it take arguments as pointers.
This is needed for the changes to various labels from later in the function
to be picked up.
2015-03-06 23:16:44 +00:00
Daniel Smith c4822dc060 Revert "Revert "Adding converter functions to convert field label selectors to internal version before matching""
This reverts commit 5f35a67002.
2015-03-02 15:00:09 -08:00
Zach Loafman 5f35a67002 Revert "Adding converter functions to convert field label selectors to internal version before matching" 2015-02-28 11:42:49 -08:00
nikhiljindal 48e7945f65 Versioning the field selectors 2015-02-27 16:10:59 -08:00
nikhiljindal 905a3f7909 Updating the handlers to accept full request path rather than a trimmed one 2015-02-24 00:37:20 -08:00
Daniel Smith ca5a73ac6b remove redundant func() 2015-02-17 15:58:18 -08:00
Clayton Coleman d167c11b59 Remove layers of indirection between apiinstaller and resthandler
Make the RESTHandler feel more go-restful, set the stage for adding
new types of subresource collections.
2015-02-11 16:26:06 -05:00
Alex Robinson ab62b689a5 Add monitoring instrumentation for the remaining HTTP handlers in the apiserver. 2015-02-10 23:19:49 +00:00
deads2k 1c9216a45e clarify api request information 2015-02-04 13:36:01 -05:00
Clayton Coleman 22c99c98e2 Split RESTStorage into separate interfaces
Omit unimplemented interfaces from Swagger
2015-01-12 12:19:45 -05:00
Clayton Coleman 31fc19efe9 Watching on invalid label/field selectors should error 2015-01-07 14:38:38 -05:00
derekwaynecarr 7cf664439f Move namespace from query param to path part 2014-12-16 15:55:47 -05:00
Eric Paris 4e95104953 update code.goole.com/p/go.net to golang.org/x/net
https://groups.google.com/forum/#!topic/golang-nuts/eD8dh3T9yyA
2014-11-16 22:10:24 -05:00
Daniel Smith 4196780eda Add self links to objects sent down the watch channel. 2014-11-05 17:22:18 -08:00
derekwaynecarr dda19071e3 Fix watch by namespace 2014-10-30 12:56:50 -04:00
Clayton Coleman 82bcdd3b3b Make ResourceVersion a string internally instead of uint64
Allows us to define different watch versioning regimes in the future
as well as to encode information with the resource version.

This changes /watch/resources?resourceVersion=3 to start the watch at
4 instead of 3, which means clients can read a resource version and
then send it back to the server. Clients should no longer do math on
resource versions.
2014-10-07 19:00:26 -04:00
derekwaynecarr 3e685674e7 Add context object to interfaces 2014-09-26 11:50:34 -04:00
Clayton Coleman e3da2ba2c8 Cleanup watch encoding (remove dupe Encoding)
Move standard watch encode / decode streams to use
runtime.RawExtension and embed API decoding based on
a provided codec.
2014-09-22 16:03:07 -04:00
Jessica Forrester f2732f18a7 Match any Connection header that contains the Upgrade token for websockets 2014-09-18 09:26:21 -04:00
Clayton Coleman 61e3ce7ddc Make runtime less global for Codec
* Make Codec separate from Scheme
* Move EncodeOrDie off Scheme to take a Codec
* Make Copy work without a Codec
* Create a "latest" package that imports all versions and
  sets global defaults for "most recent encoding"
  * v1beta1 is the current "latest", v1beta2 exists
  * Kill DefaultCodec, replace it with "latest.Codec"
  * This updates the client and etcd to store the latest known version
* EmbeddedObject is per schema and per package now
* Move runtime.DefaultScheme to api.Scheme
* Split out WatchEvent since it's not an API object today, treat it
like a special object in api
* Kill DefaultResourceVersioner, instead place it on "latest" (as the
  package that understands all packages)
* Move objDiff to runtime.ObjectDiff
2014-09-16 16:26:43 -04:00
Jessica Forrester 0f2b8f4f9f Create passthroughLogger when LogOf is called and request has no logger 2014-09-11 16:48:06 -04:00
Jessica Forrester 0cac1c5f79 Switch LogOf from panicking when logger is missing to creating logger with the defaults.
Update CORS tests to a table-based test and cover more cases.
2014-09-09 17:50:18 -04:00
Jessica Forrester becf6ca4e7 Move RecoverPanics to be the top level wrapped handler. Add new method to be sure a logger has been generated instead of assuming one has. Move regexp list compilation into a utility and pass regexp list into CORS. 2014-09-09 17:50:18 -04:00
Daniel Smith 0d30a656ef Do interface{} -> runtime.Object rename everywhere 2014-09-07 22:19:24 -07:00