Commit Graph

226 Commits (3215e8535ae8afcf850fbaac9df7ff9abe42f9e0)

Author SHA1 Message Date
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 fc3609fb5b Allow InputStreams to be returned by requests
Add additional metadata to restful services.
2015-03-24 17:25:45 -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
Piotr Szczesniak ffcf7b1866 Increased default timeout in APIServer to 2 minutes
This should for #5431
2015-03-14 06:54:31 +01:00
Clayton Coleman 4b16a87096 Simplify api_installer and setup methods 2015-03-09 14:39:31 -04: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
Alex Robinson 0d5fe5d078 Use a prometheus Histogram rather than a Summary for tracking apiserver latency. 2015-03-02 02:15:16 +00:00
nikhiljindal 905a3f7909 Updating the handlers to accept full request path rather than a trimmed one 2015-02-24 00:37:20 -08:00
Jordan Liggitt 083ce268e0 Put user in context, map requests to context above resthandler layer 2015-02-12 20:58:04 -05:00
Clayton Coleman 8f6e3607a9 Add monitoring as a filter 2015-02-11 17:07:23 -05: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 d39262d743 Consolidate the prometheus Counters into a shared CounterVec and remove
the "code" label from the latencies SummaryVec.
2015-02-10 22:47:56 +00:00
Alex Robinson 2463cff79c Basic initial instrumentation of the apiserver. This links in the
prometheus library for monitoring, which exports some basic resource
usage metrics by default, like number of goroutines, open file
descriptors, resident and virtual memory, etc. I've also started adding
in request counters and latency histograms, but have only added them to two
of our HTTP handlers. If this looks reasonable, I'll add them to the rest
in a second PR.
2015-02-10 20:44:28 +00:00
deads2k 1c9216a45e clarify api request information 2015-02-04 13:36:01 -05:00
nikhiljindal 18609e1706 Moving /watch, /proxy and /redirect registration to go-restful 2015-02-03 15:47:48 -08:00
Clayton Coleman 9263a8f627 Remove logging on apiserver startup
Now that we return errors on startup there's not much value in the
startup log for anyone except a few developers.  Nuke
2015-02-03 00:02:07 -05:00
derekwaynecarr a216cb747c Fix logic issue in register resource handlers not doing list across all namespaces in v1beta3 2015-02-02 10:26:19 -05:00
derekwaynecarr 4c33e36a88 Plumb restmapper properly through apiserver and tests 2015-02-02 10:26:19 -05:00
derekwaynecarr 71ec444d63 Make a RESTMapper scope aware 2015-02-02 10:26:19 -05:00
nikhiljindal 521728e920 Deleting OperationHandler for handling /operation endpoint on server 2015-01-28 13:13:10 -08:00
Clayton Coleman 5117189e03 Merge pull request #3707 from nikhiljindal/preOperations
Removing support for asynchronous server requests
2015-01-28 13:02:52 -05:00
deads2k 6e1f680a57 return all errors from RESTStorage registration 2015-01-28 10:31:33 -05:00
nikhiljindal de60600608 Making all operations synchronous 2015-01-27 18:47:56 -08:00
Satnam Singh 3a9e6d8f29 Switch to use Too Many Requests response code
Name the 429 status code
2015-01-27 14:54:30 -08:00
Satnam Singh 358ace610d Merge pull request #3824 from smarterclayton/allow_panic_and_error_reporting
Allow panics and unhandled errors to be sent elsewhere
2015-01-27 13:18:43 -08:00
Brendan Burns b078889360 Merge pull request #3822 from nikhiljindal/swaggerbug
Fixing a bug where Reads() was being called twice on POST routes
2015-01-27 10:01:27 -08:00
Clayton Coleman 19987612bf Replace code that eats errors with a more consistent reporting
In order to allow certain programmer error / unexpected error states
to be captured, replace sections that log and eat errors with a method
that can be centrally replaced.  This captures two common error sources,
replication errors, and apiserver code that returns invalid errors.
2015-01-26 20:54:29 -05:00
nikhiljindal 54e5d1f102 Fixing a bug where Reads() was called twice on all POST routes 2015-01-26 17:21:25 -08:00
nikhiljindal 51007cc798 Updating handleIndex in master to list all valid paths.
The list of valid paths is computed from http.ServeMux and
restful.WebService.
Adding a mux helper - wrapper over mux, that keeps track of the paths
handled by mux.
2015-01-21 13:40:01 -08:00
Clayton Coleman 90c835af47 The API server setup logging is debug specific, bump above V(4)
Reduces some chatter in test suites where we are confident this code
already works.  Also removed any logging which is obvious from swagger.

Finally, rolls up InstallREST related errors all the way back to master,
which will glog.Fatalf (coding errors).
2015-01-15 14:25:58 -05:00
nikhiljindal f8db96b673 Fixing a bug in
https://github.com/GoogleCloudPlatform/kubernetes/pull/3404 which broke
swagger-ui.
Swagger-ui requires operation to be defined on all Routes.
2015-01-12 15:20:01 -08:00
Daniel Smith 6f43074143 Merge pull request #3404 from smarterclayton/method_not_allowed
Allow RESTStorage objects to not implement methods
2015-01-12 13:21:10 -08:00
Clayton Coleman d17f75f254 Remove user agent logging (doesn't add significant value)
We can reintroduce path/agent logging at a later point, this just clogs
verbose logs.
2015-01-12 13:37:37 -05:00
Clayton Coleman 22c99c98e2 Split RESTStorage into separate interfaces
Omit unimplemented interfaces from Swagger
2015-01-12 12:19:45 -05:00
nikhiljindal 7e909ed743 Changes to improve swagger ui.
- Separating out index, version and api handlers into independent web
  services. Moved the index handler to /welcome, version handler to
  /version and the api handler to /api,
2015-01-09 10:56:24 -08:00
derekwaynecarr a56087cdf8 Remove client from attributes, remove admission control interface, fix-up error codes 2015-01-07 14:42:31 -05:00
derekwaynecarr 520ae3ef27 Implement basic admission control framework 2015-01-07 14:42:31 -05:00
Brendan Burns 5c14fc610b Merge pull request #3045 from nikhiljindal/setApiVersion
Setting apiVersion in restful.WebService
2014-12-19 10:11:15 -08:00
nikhiljindal cfee8f1355 done 2014-12-18 15:38:09 -08:00
derekwaynecarr 6694a45542 Add doc for {namespace} path param, fixup and verify proxy paths 2014-12-16 15:55:48 -05:00
derekwaynecarr 7cf664439f Move namespace from query param to path part 2014-12-16 15:55:47 -05:00
Clayton Coleman b1b255f90a Prevent infinite loop in apiserver errorJSON 2014-12-12 18:23:17 -05:00
Brendan Burns 59b5546b28 Turn on node level validation, and make the validation set dynamic. 2014-12-10 22:02:45 -08:00
Brian Grant e18dcb87c4 Format JSON by default. Fixes #2243. 2014-11-25 23:11:43 +00:00
Tim Hockin ea960711ff Clean up error logs.
Use %v for errors, tidy some messages, make error messages start lowe-case
(as per go guidelines).  Just accumulated nits.
2014-11-21 09:45:26 +08:00
Brian Grant 7583e1a643 Automatic API generation by adopting go-restful 2014-11-14 16:49:19 +00:00
Clayton Coleman 21a6e96418 Merge pull request #2126 from brendandburns/validatez
Add etcd to the list of services to validate.
2014-11-10 14:53:41 -05:00
Brendan Burns d7dc20fd6a Add etcd to the list of services to validate.
Also add minions.
2014-11-05 21:22:01 -08:00
Daniel Smith 4196780eda Add self links to objects sent down the watch channel. 2014-11-05 17:22:18 -08:00
Eric Tune 1668c6f107 Authorization based on namespace, kind, readonly.
Also, pass Authorizer into master.Config.
2014-11-03 17:45:15 -08:00
Daniel Smith dca7363459 Serve API version list, test with an integration test. 2014-10-28 17:35:56 -07:00
Eric Tune 40a5ca034d Integration test on master, not just apiserver.
Moved code from cmd/apiserver to pkg/master.

test/integration/client_test made to use a master object,
instead of an apiserver.Handle.

Subsequent PRs will move more handler-installation into
pkg/master, with the goal that every http.Handler of a
standalone apiserver process can also be tested
in a "testing"-style go test.

In particular, a subsequent PR will test
authorization.
2014-10-27 09:14:58 -07:00
Daniel Smith bf942e859f remove old proxy code. 2014-10-20 11:28:12 -07:00
Haney Maxwell c0bf974871 Allow disabling non-necessary kubelet and apiserver endpoints 2014-10-09 16:49:27 -07:00
Daniel Smith 37e505601e add self linking to apiserver 2014-09-26 15:08:02 -07:00
Brendan Burns f8844ce69e Add a validator for validating components in the cluster infrastructure. 2014-09-16 13:37:01 -07:00
Jessica Forrester d82cf7dd48 Rebased and fixed test 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
Jessica Forrester 8b4ca9c2a7 Move CORS handler wrapping into cmd/apiserver and switch config flag to a list of allowed origins 2014-09-09 17:50:18 -04:00
Jessica Forrester 8723eece49 Add option to enable a simple CORS implementation for the api server 2014-09-09 17:50:18 -04:00
Brendan Burns 69b359b689 Don't stack trace on 301s 2014-09-09 14:10:46 -07:00
brendandburns 753b80c9b8 Merge pull request #1105 from lavalamp/proxy
Add a generic proxier
2014-09-08 12:51:24 -07:00
Daniel Smith 0d30a656ef Do interface{} -> runtime.Object rename everywhere 2014-09-07 22:19:24 -07:00
Daniel Smith e2b645ec15 Add a generic proxier
To proxy traffic to anything that implements ResourceLocation.
Currently, this is only services. This is easily extensible to minions
(would supercede existing mechanism) and pods.
2014-09-05 13:33:30 -07:00
Vojtech Vitek (V-Teq) 59f58cd043 Unify Godoc formatting, fix various typos
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-09-02 13:41:03 +02:00
Daniel Smith 4de254444e Add simple service redirection 2014-08-27 20:51:41 -07:00
Tim Hockin 0f97a73c1b Rename a bunch of "Make" functions to "New"
Also rename some to other names that make better reading.  There are still a
bunch of "make" functions but they do things like assemble a string from parts
or build an array of things.  It seemed that "make" there seemed fine.  "New"
is for "constructors".
2014-08-20 21:27:19 -07:00
Clayton Coleman bbf3b55e76 Extract RESTHandler and allow API groupings
Prepare for running multiple API versions on the same HTTP server
by decoupling some of the mechanics of apiserver.  Define a new
APIGroup object which represents a version of the API.
2014-08-13 10:53:34 -04:00
Clayton Coleman 0083fae453 Provide helpers and tests for common error types
Unify error handling in apiserver into a single path - RESTStorage
objects must provide appropriate errors individually.  Ensure ALL
errors which can be traced to logical faults with RESTStorage are
returned as api.Status objects.
2014-08-08 19:44:47 -04:00
Clayton Coleman a74fac7d70 Centralize path magic in apiserver into the New method
Make OperationHandler and WatchHandler properly encapsulate their
concerns and make them not depend on the global path
2014-08-08 16:33:44 -04:00
Clayton Coleman c9fc0bcf3d Decouple apiserver from codec implementation
The apiserver on initialization must be provided with a codec
for encoding and decoding all handled objects including api.Status
and api.ServerOp.  In addition, the RESTStorage Extract() method
has been changed to New(), which returns a pointer object that the
codec must decode into (the internal object).  Switched registry
methods to use pointers for Create/Update instead of values.
2014-08-07 13:35:35 -04:00
Clayton Coleman 836d2b9808 Fix proxy error condition and simplify method
Add new minion proxy test case.
2014-08-06 01:03:17 -04:00
Clayton Coleman 325f9ef005 Make create atomic on etcd for Services/ReplControllers 2014-08-05 01:12:27 -04:00
Clayton Coleman 1bdeb058e1 Slightly pause on requests to allow most to finish
Currently, every write will result in a 202 (etcd adding a few
ms of latency to each request).  This forces clients to go into
a poll loop and pick a reasonable server poll frequency, which
results in 1 + N queries to the server for the single operation
and adds unavoidable latency to each request which affects their
perception of the service.

Add a very slight (25ms by default) delay to wait for requests
to finish.  For clients doing normal writes this reduces the
requests made against the server to 1.  For clients on long requests
this has no effect.  The downside is that http connections are held
on to for a longer period in high write loads.  The decrease in
perceived latency from the kubecfg is significant.
2014-07-30 17:49:47 -04:00
Clayton Coleman e64a393e1a Move handle* methods to their respective locations
Fix names
2014-07-30 17:15:09 -04:00
Clayton Coleman fe7f611d88 Split operations code and add comments 2014-07-30 17:15:09 -04:00
Clayton Coleman 9069696514 Rename write -> writeJSON 2014-07-30 17:15:09 -04:00
Clayton Coleman b84c9f7a1c Rename methods and move parseTimeout 2014-07-30 17:15:09 -04:00
Clayton Coleman 82b78912fc Move prefix methods 2014-07-30 17:15:09 -04:00
Clayton Coleman a2c86e4c97 Simplify helpers 2014-07-30 17:15:09 -04:00
Clayton Coleman c7d311896e Shorten variable name 2014-07-30 17:15:09 -04:00
Clayton Coleman 8b511832ff Split minion 2014-07-30 17:15:09 -04:00
Clayton Coleman a46f6313bc Split interfaces 2014-07-30 17:15:09 -04:00
Clayton Coleman d5e22bfe2a Split index 2014-07-30 17:14:07 -04:00
Clayton Coleman db51ea2a17 Split async 2014-07-30 17:14:06 -04:00
Clayton Coleman b911d9265a Split watch 2014-07-30 17:14:06 -04:00
erictune a41aeeca67 Merge pull request #701 from SebastianM/misspelling
fix misspelling
2014-07-30 13:36:14 -07:00
Sebastian Müller e1172fc78c fix misspelling 2014-07-30 20:10:12 +02:00
Clayton Coleman dc6fdc423d Merge pull request #627 from lavalamp/fix
Add /version to server and check it in client.
2014-07-30 12:52:15 -04:00
brendandburns 0ad9221f5c Merge pull request #695 from danmcp/fix_golint_warnings
Fixing golint warnings
2014-07-30 06:49:27 -07:00
Dan McPherson d5fcaa1f03 Fixing golint warnings 2014-07-30 13:41:09 +02:00
Dawn Chen 8e9864e8fc Instead of apiserver panic when proxy a request to a dead minion,
print out proper message through http.Response
2014-07-28 16:40:29 -07:00
Daniel Smith 3b8488028d Add /version to server and check it in client.
Will help detect client/version skew and prevent e2e test from passing
while running a version other than the one you think it's running.
2014-07-28 15:45:25 -07:00
Dan McPherson 7bbc5e2a19 Fixing typos 2014-07-28 15:15:50 +02:00
Clayton Coleman 1047c57c6d Use http.StatusInternalServerError instead of 500 2014-07-27 15:37:03 -04:00
Clayton Coleman 30e881c3f9 Write JSON content type for API responses 2014-07-24 17:45:02 -04:00
Dawn Chen 47ad71f92d HandleIndex when URL.Path == "/" 2014-07-22 14:12:16 -07:00
Dawn Chen dc921b8c65 comment changes 2014-07-21 14:46:59 -07:00
Dawn Chen 064237a5b8 Add support to query kubelet's logs and cadvisor's stats through
apiserver by passing rawquery.

minor changes

Fixed a minor rebase issues.

Using ioutil.ReadAll instead of httputil.DumpResponse
2014-07-21 11:52:32 -07:00
Daniel Smith 69c483f620 Add APIObject for generic inclusion of API objects.
Includes test and json/yaml getters and setters.
2014-07-18 22:35:08 -07:00
Daniel Smith eda30d4f20 Add watch mechanism to apiserver
Implemented via HTTP and websocket. A test is present but this isn't
yet wired into anything.

Eventual purpose of this is to allow a scheduler to watch for new pods.
Or allow replication controller to watch for new items it controlls.
Generally, it'll be good to turn everything possible into a push instead
of a poll.
2014-07-18 16:47:17 -07:00
Clayton Coleman 0ccf1b7812 Operation server was not returning in error cases 2014-07-18 12:36:27 -04:00
Yuki Yugui Sonoda 2aa3de12d4 Make RESTful operations return 404 Not Found when the target resource
does not exist.

In the original implementation, GET, DELETE and PUT operations on
non-existent resources used to return 500 but not 404.
2014-07-18 14:16:56 +09:00
Daniel Smith 90afdb06c1 Move logger to own package; clean up apiserver to use serve mux. 2014-07-15 21:25:33 -07:00
Yuki Yugui Sonoda 5cfbed4453 Fixes golint errors in pkg/apiserver 2014-07-08 16:10:11 +09:00
Daniel Smith 3b9735d787 Test atomic PUTs, and make them work.
Improve apiserver/logger.go's interface (it's pretty cool now).

Improve apiserver's error reporting to clients.

Improve client's handling of errors from apiserver.

Make failed PUTs return 409 (conflict)-- http status codes are amazingly
well defined for what we're doing!
2014-07-02 15:42:05 -07:00
Dawn Chen 85152fc137 Add a FileServer for master's logs 2014-06-30 16:33:54 -07:00
Daniel Smith afd13edd6a Address comments; also, demonstrate one more property in test. 2014-06-26 11:36:15 -07:00
Daniel Smith 59a6489e84 Add tracked operations to apiserver 2014-06-26 10:33:21 -07:00
Tim Hockin 9f9e75f508 Switch to glog for logging, bridge logging to glog.
1) imported glog to third_party (previous commit)
2) add support for third_party/update.sh to update just one pkg
3) search-and-replace:
  s/log.Printf/glog.Infof/
  s/log.Print/glog.Info/
  s/log.Fatalf/glog.Fatalf/
  s/log.Fatal/glog.Fatal/
4) convert glog.Info.*, err into glog.Error*

Adds some util interfaces to logging and calls them from each cmd, which
will set the default log output to write to glog.  Pass glog-wrapped
Loggers to etcd for logging.

Log files will go to /tmp - we should probably follow this up with a
default log dir for each cmd.

The glog lib is sort of weak in that it only flushes every 30 seconds, so
we spin up our own flushing goroutine.
2014-06-24 20:51:57 -07:00
Daniel Smith ee75bb8dbe Address comments; Also internally start using JSONBase instead of reflect.Value of JSONBase. 2014-06-23 09:54:17 -07:00
Daniel Smith 41534c1cc5 Encode/decode working everywhere now. 2014-06-23 09:54:17 -07:00
Daniel Smith 14361e336a Make apiserver work with new encode/decode 2014-06-23 09:54:17 -07:00
Daniel Smith fb991fb84e Change type to []byte 2014-06-23 09:54:17 -07:00
Daniel Smith 5de9071b5c Add improved logging: record latency & call stack on error 2014-06-22 11:17:23 -07:00
Daniel Smith 466be48c74 Merge pull request #166 from brendandburns/sync
Part #1 of synchronous requests: Add channels and a mechanism for waiting
2014-06-19 16:40:25 -07:00
Brendan Burns 2640de5c02 Part #1 of synchronous requests: Add channels and a mechanism for waiting on them 2014-06-19 16:13:13 -07:00
Daniel Smith bc02b3c21a Rename [label] query to selector 2014-06-19 13:31:42 -07:00
Daniel Smith 246db91cb5 Merge pull request #135 from brendandburns/lb
Add load balancing support to services.
2014-06-17 18:40:42 -07:00
Justin Huff 3072ccf088 When the apiserver panics, log a stacktrace. 2014-06-17 14:59:37 -07:00
Brendan Burns 2759b2367f Add load balancing support to services. 2014-06-17 12:37:39 -07:00
Daniel Smith 154ec0db1e apiserver builds again 2014-06-16 22:05:12 -07:00
Daniel Smith 3ab2f8a3a2 First piece of improving labels 2014-06-16 22:05:11 -07:00
Daniel Smith 6d3af1f8ff Make success status public so it will actually get sent to clients 2014-06-16 22:05:11 -07:00
Daniel Smith b3ab658c71 consistent filenames 2014-06-15 23:30:58 -07:00