Commit Graph

2272 Commits (6af7d2cb1a2dd0d9ab7c3c9f2d9650959e4533d4)

Author SHA1 Message Date
Clayton Coleman a81dc44fc6 Revert "Stream support for k8s client request"
This reverts commit 755b598a7d.
2014-10-01 19:39:08 -04:00
Clayton Coleman 67ef24b410 Merge pull request #1506 from jhadvig/upstream_k8_stream
Stream support for client request
2014-10-01 19:32:27 -04:00
jhadvig 755b598a7d Stream support for k8s client request 2014-10-02 01:07:43 +02:00
Clayton Coleman ff2eca97d9 Refactor the client (again) to better support auth
* Allows consumers to provide their own transports for common cases.
* Supports KUBE_API_VERSION on test cases for controlling which
  api version they test against
* Provides a common flag registration method for CLIs that need
  to connect to an API server (to avoid duplicating flags)
* Ensures errors are properly returned by the server
* Add a Context field to client.Config
2014-10-01 15:23:37 -04:00
derekwaynecarr 02e1a2e79d Update unit tests to pass a context on client create 2014-09-30 14:27:56 -04:00
derekwaynecarr b7b1193919 Add context object to kubecfg/client 2014-09-30 14:27:19 -04:00
Brendan Burns 621df0da32 Merge pull request #1455 from lavalamp/selfLink
Start setting SelfLink
2014-09-26 17:34:18 -07:00
Brendan Burns 17c82606eb Second step in decoupling the service controller, use the apiserver for writes too. 2014-09-26 16:44:25 -07:00
Daniel Smith b972f72248 convert multiple return values into a struct, add SelfLinker 2014-09-26 14:52:16 -07:00
Clayton Coleman 4e56dafecc Introduce some default log verbosity control
Move a lot of common error logging into better buckets:

glog.Errorf() - Always an error
glog.Warningf() - Something unexpected, but probably not an error
glog.V(0) - Generally useful for this to ALWAYS be visible
            to an operator
            * Programmer errors
            * Logging extra info about a panic
            * CLI argument handling
glog.V(1) - A reasonable default log level if you don't want
            verbosity
            * Information about config (listening on X, watching Y)
            * Errors that repeat frequently that relate to conditions
              that can be corrected (pod detected as unhealthy)
glog.V(2) - Useful steady state information about the service
            * Logging HTTP requests and their exit code
            * System state changing (killing pod)
            * Controller state change events (starting pods)
            * Scheduler log messages
glog.V(3) - Extended information about changes
            * More info about system state changes
glog.V(4) - Debug level verbosity (for now)
            * Logging in particularly thorny parts of code where
              you may want to come back later and check it
2014-09-25 16:30:14 -04:00
Dawn Chen 0e6ec3cbfc Convert existing kubernetes system to use ContainerStatus, instead of
docker.Container directly.

Conflicts:
	pkg/kubelet/dockertools/docker.go
	pkg/registry/pod/rest.go
2014-09-24 11:16:46 -07:00
Clayton Coleman b0b7f13ade Merge pull request #1404 from lavalamp/scheduler
Add error type to watch.
2014-09-23 11:28:29 -04:00
Abhishek Gupta 002a5c6c29 Added test case 2014-09-22 17:40:18 -07:00
Abhishek Gupta 7c662ff065 Adding GetEndpoints method to the client EndpointsInterface 2014-09-22 17:40:18 -07:00
Daniel Smith f211e46f20 handle watch errors everywhere 2014-09-22 17:37:12 -07:00
Daniel Smith 248f49fb7c Merge pull request #1340 from smarterclayton/cleanup_watch_embedding
Cleanup watch encoding w/ RawExtension
2014-09-22 14:52:50 -07:00
Brendan Burns 3346c68d33 Merge pull request #1389 from lavalamp/scheduler
make watch actually return an error when there's an error
2014-09-22 13:59:57 -07: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
Eric Paris a32400f47f Remove all code dealing with cadvisor Percentiles
This was removed upstream beween cadvisor 0.3.0 and 0.4.0
2014-09-22 14:22:40 -04:00
Daniel Smith 4d7c6e2657 Treat super short watches with no items received the same as watches that error immediately 2014-09-19 18:09:40 -07:00
Brendan Burns 8dff6f12d7 Add authenticated TLS support to the client. 2014-09-19 15:43:23 -07:00
Clayton Coleman 5483333e29 Allow server and client to take api version as argument
* Defaults to v1beta1
* apiserver takes -storage_version which controls etcd storage version
  and the version of the client used to connect to other apiservers
* Changed signature of client.New to add version parameter
* All controller code and component code prefers the oldest (most common)
  server version
2014-09-18 23:27:28 -04:00
Joe Beda 4487f311ab Merge pull request #1326 from lavalamp/scheduler
Fix cache to use the "List then Watch" pattern.
2014-09-18 09:00:52 -07:00
Brendan Burns 99586b4da4 Fix a problem where if a minion went missing, we still thought the pod was running.
Also convert some tests to table driven.
2014-09-17 18:16:52 -07:00
Daniel Smith b1169ed91e Fix cache to use the "List then Watch" pattern. 2014-09-16 16:17:15 -07: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
Clayton Coleman fe614aeda2 Simple refactor for ease of readability
runtime.DefaultCodec -> latest.Codec
2014-09-16 16:12:35 -04:00
csrwng 6551f4e0f0 Use codec to encode/decode api objects in client and kubecfg parser 2014-09-09 08:45:53 -04:00
Daniel Smith fc09f988b4 Make tests pass again 2014-09-07 22:26:42 -07:00
Daniel Smith 48ce23ac91 Make client use pointers 2014-09-07 22:19:24 -07:00
Daniel Smith 0d30a656ef Do interface{} -> runtime.Object rename everywhere 2014-09-07 22:19:24 -07:00
Daniel Smith 1c2b65788d Rename Codec and ResourceVersioner to add Default in front, to allow for types of those names 2014-09-07 22:19:24 -07:00
Daniel Smith 7790961011 Rename Object to EmbeddedObject 2014-09-05 14:43:35 -07:00
Joe Beda 3c0a736908 Fix/expand kubecfg unit tests 2014-09-04 13:25:39 -07:00
Clayton Coleman 01e668187c Services and Endpoints weren't properly sync'ing
They need incremental changes and a resync on start.
2014-09-03 16:04:55 -04:00
derekwaynecarr ca3f5a9f46 Fixup name vs ID terminology 2014-09-03 10:27:33 -04:00
Daniel Smith d20264351b Merge pull request #1077 from brendandburns/service
Step #1 in migrating the service controller away from the apiserver.
2014-09-02 14:03:52 -07:00
Daniel Smith a63966e73c Combine pkg/apitools and pkg/api/common and call the result pkg/runtime 2014-09-02 11:15:44 -07:00
Daniel Smith 099c8fd36f Propagate rename; tests pass again. 2014-09-02 10:42:06 -07:00
Brendan Burns fee2b90608 Step #1 in migrating the service controller away from the apiserver.
Start using the API server for listing services.
2014-09-02 10:25:04 -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 aa9b9b9fa8 Invert api and api/v1beta1 dependencies
This is some cleanup that has been needed for a while.
There's still one more step that could usefully be done, which is to
split up our api package into the part that provides the helper
functions and the part that provides the internal types. That can come
later.

The v1beta1 package is now a good example of what an api plugin should
do to version its types.
2014-08-29 12:15:30 -07:00
Clayton Coleman 818f357128 Client should validate the incoming host value
Convert host:port and URLs passed to client.New() into the proper
values, and return an error if the value is invalid.  Change CLI
to return an error if -master is invalid.  Remove Client.rawRequest
which was not in use, and fix the involved tests. Add NewOrDie

Preserves the behavior of the client to not auth when a non-https
URL is passed (although in the future this should be corrected).
2014-08-28 13:47:36 -04:00
Vojtech Vitek (V-Teq) 5500bbade6 Fix typos in pkg docs
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-08-28 11:43:35 +02:00
Daniel Smith 0766e7a411 Merge pull request #1058 from vishh/add_list_minions
Adding ListMinions() API to pkg/client.
2014-08-27 14:19:57 -07:00
Vishnu Kannan 180e9ed493 Add unit tests for pkg/client.ListMinions() 2014-08-27 21:07:22 +00:00
Clayton Coleman 9006eadcfe kube-proxy can read config from the apiserver
All clients that talk to a "master" as a host:port or URL
(scheme://host:port) parameter.  Add tests.
2014-08-27 15:49:01 -04:00
Vishnu Kannan a4b00e33e0 Adding ListMinions() API to pkg/client. 2014-08-27 18:57:29 +00:00
csrwng 938548a9fb Break up API client into per-resource client and common code 2014-08-25 07:54:35 -04:00
Clayton Coleman 1c68247954 Merge pull request #909 from lavalamp/scheduler3
Scheduler plugin v1
2014-08-21 19:04:51 -04:00
Dawn Chen df260c830f Merge pull request #905 from erictune/cleanup6
Dereference string* before printing it with "%s%".
2014-08-21 09:23:19 -07:00
Daniel Smith 3d47c8bad1 Fix up client tests now that we check the query in FakeHandler 2014-08-20 16:50:02 -07:00
Clayton Coleman 493863eb93 Return immediately when controllers/pods are committed
Add client waiting conditions.
2014-08-20 18:46:10 -04:00
Daniel Smith 4c4ca59050 Add poller to cache. 2014-08-20 15:32:49 -07:00
Daniel Smith 4c3f509d94 Make cache.Reflector more injectable. Add test for resource version state keeping. 2014-08-20 15:32:49 -07:00
Clayton Coleman 13c3efbc4c The default client poll interval is extremely long
Most operations complete much more quickly than 20s, and those that
do take longer are going to be fixed to make them take less time
(#353)
2014-08-18 13:40:35 -04:00
Clayton Coleman 82b0ec5115 Replace pkg/kubecfg#FakeKubeClient with the fake in pkg/client 2014-08-15 17:15:53 -04:00
Eric Tune 3d02700cc8 Dereference string* before printing it with "%s%".
Suggested by "go vet".
2014-08-14 14:06:09 -07:00
Daniel Smith 5dd130a350 Prevent accidental setting of sync or timeout 2014-08-08 14:09:14 -07:00
Daniel Smith 85ff1d3e7f Add fake client to make testing easier. 2014-08-08 14:09:13 -07:00
Daniel Smith 097147545c Allow more general parameters to be made by client. Also fix style and comments. 2014-08-08 14:09:13 -07:00
Sean Borman 1fc29e20cc Corrected a typo. 2014-08-05 13:53:52 -07:00
Daniel Smith 860050b507 Merge pull request #745 from smarterclayton/add_structured_reason
Evolve the api.Status object with Reason/Details
2014-08-05 13:28:19 -07:00
Clayton Coleman 4f88b778a6 Evolve the api.Status object with Reason/Details
Contains breaking API change on api.Status#Details (type change)

Turn Details from string -> StatusDetails - a general
bucket for keyed error behavior.  Define an open enumeration
ReasonType exposed as Reason on the status object to provide
machine readable subcategorization beyond HTTP Status Code. Define
a human readable field Message which is common convention (previously
this was joined into Details).

Precedence order: HTTP Status Code, Reason, Details. apiserver would
impose restraints on the ReasonTypes defined by the main apiobject,
and ensure their use is consistent.

There are four long term scenarios this change supports:

1. Allow a client access to a machine readable field that can be
   easily switched on for improving or translating the generic
   server Message.

2. Return a 404 when a composite operation on multiple resources
   fails with enough data so that a client can distinguish which
   item does not exist.  E.g. resource Parent and resource Child,
   POST /parents/1/children to create a new Child, but /parents/1
   is deleted.  POST returns 404, ReasonTypeNotFound, and
   Details.ID = "1", Details.Kind = "parent"

3. Allow a client to receive validation data that is keyed by
   attribute for building user facing UIs around field submission.
   Validation is usually expressed as map[string][]string, but
   that type is less appropriate for many other uses.

4. Allow specific API errors to return more granular failure status
   for specific operations.  An example might be a minion proxy,
   where the operation that failed may be both proxying OR the
   minion itself.  In this case a reason may be defined "proxy_failed"
   corresponding to 502, where the Details field may be extended
   to contain a nested error object.

At this time only ID and Kind are exposed
2014-08-05 16:17:53 -04:00
brendandburns bf40981197 Merge pull request #758 from lavalamp/clientCache
Watch based client cache
2014-08-05 11:46:22 -07:00
Clayton Coleman babb7528ce httptest.NewTLSServer is ~0.2s of setup per test
We're not exercising anything TLS related in client and request,
set these back to NewServer.  Should add a new TLS end-to-end
test for hack/test-cmd.sh with real (test) certs.
2014-08-05 00:59:42 -04:00
Daniel Smith 041d56f3d0 finish testing client/cache 2014-08-04 14:50:01 -07:00
Daniel Smith a47b65bf8a Add cache package. 2014-08-04 14:50:01 -07:00
Clayton Coleman f7149926c0 Remove expectNoError from client, kubelet, and util 2014-08-04 09:39:06 -04:00
Brendan Burns 1101c00014 Make updates atomic from the client side. 2014-08-01 16:47:25 -07:00
Brendan Burns 490bb28bf9 Add TCP socket based health checking. 2014-08-01 14:13:56 -07:00
Clayton Coleman 28d42a79a4 Merge pull request #719 from csrwng/list_replication_controllers
Add a method to list replication controllers
2014-07-31 14:34:58 -04:00
Dawn Chen 2e8020be8c Update the entire cAdvisor package. There is a version mismatch issue
which cause #707
2014-07-31 10:11:25 -07:00
csrwng a3476fcbca Add a method to list replication controllers 2014-07-31 12:37:02 -04: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
Brendan Burns bf5ae4bb9d Fork API types. 2014-07-24 21:47:08 -07:00
Jonathan Boulle c43035088b assorted formatting and typo fixes 2014-07-24 15:10:36 -07:00
Daniel Smith 91375f4c04 Split httpWatcher into watch.StreamWatcher and tools.APIEventDecoder. 2014-07-21 16:07:58 -07:00
Daniel Smith dbd0d419df Add watch capability to our client.
Next steps: Make an etcd watcher... decide on a state field for pods...
move the scheduler to its own binary.
2014-07-21 16:07:58 -07:00
Daniel Smith 05f01a3654 Revert "assorted formatting and typo fixes" 2014-07-18 17:16:30 -07:00
Daniel Smith 211f6b312f Merge pull request #520 from jonboulle/master
assorted formatting and typo fixes
2014-07-18 17:15:30 -07:00
Jonathan Boulle 9e63c3a633 assorted formatting and typo fixes 2014-07-18 13:02:59 -07:00
Clayton Coleman a17f0d04d4 PodInfo should indicate when a pod is not found
Client should react.  Also, dial down the chattiness of errors for
pods which do not exist and stop processing NotFound earlier in
the podinfo chain
2014-07-18 13:32:10 -04:00
Nan Deng 564a58722c Retrieve machine spec from cAdvisor 2014-07-17 15:21:47 -07:00
Nan Deng 6878f105c0 add a client to get container info from kubelet 2014-07-16 01:08:56 -04:00
Andrew Gerrand a9fdf1f6b5 rename client.ClientInterface to client.Interface 2014-07-11 09:51:34 +10:00
brendandburns 0748ac39e8 Merge pull request #374 from yugui/feature/show-progress
Periodically shows message while waiting for completion of REST operations
2014-07-09 23:15:05 -07:00
Yuki Yugui Sonoda 602f7d8112 Use glog instead of printing to stderr. 2014-07-10 14:59:56 +09:00
Yuki Yugui Sonoda 325c5cd47e Fixes golint errors in pkg/client 2014-07-08 16:15:41 +09:00
Brendan Burns e3838e1153 Make poll period and timeout configurable.
Make poll period short for integration testing.
2014-07-07 10:13:27 -07:00
Brendan Burns 2f5eeee1f6 Make sync false by default. Works around timeout/retry issues. 2014-07-03 21:23:21 -07: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
Daniel Smith 11d6451d2a Change kublet to serve podInfo instead of containerInfo. Plumb through system. 2014-07-01 16:41:10 -07:00
Daniel Smith 049bc6b6d4 Fix interface{} in api/types.go; plumb through system. 2014-07-01 16:41:09 -07:00
Brendan Burns a391b2ff03 Implement sync behavior for controllers. 2014-06-26 19:44:28 -07:00
Daniel Smith fd5e3b0b04 Implement client polling. 2014-06-26 16:10:38 -07:00
Daniel Smith c9246dc130 Implement required sync changes everywhere.
Make requests sync by default, so that usage of them doesn't have to
change.
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
Brendan Burns 84e5c37f74 Several small fixes. 2014-06-24 15:30:14 -07:00
Brendan Burns 8b50e45dcc Update the proxy server. 2014-06-24 11:25:45 -07:00
Daniel Smith 175e998258 Fix nil/[]byte{} consistency, and other review comments. 2014-06-24 10:07:51 -07:00
Daniel Smith 72809f8e67 catch 202 early 2014-06-24 09:38:22 -07:00
Daniel Smith 5ce54bb77b Use new method. 2014-06-24 09:38:22 -07:00
Daniel Smith 61a494d303 First step of combination. 2014-06-24 09:38:22 -07:00
Daniel Smith b850d36166 Fix boilerplate everywhere 2014-06-23 11:32:11 -07:00
Brendan Burns b84cc9c895 Deflake a test w/ go1.3 random maps. 2014-06-20 10:41:15 -07:00
Johan Euphrosine fe589a3f64 pkg/client: refactor tests 2014-06-19 23:12:27 -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 3ab2f8a3a2 First piece of improving labels 2014-06-16 22:05:11 -07:00
Brendan Burns 32071289e6 Add some documentation 2014-06-15 22:42:19 -07:00
Daniel Smith 229ccb0fa3 Merge pull request #110 from jbeda/test-fix
Stable comparison of stuff that transits through map.
2014-06-14 16:05:30 -07:00
Joe Beda c6dd6cb410 Stable comparison of stuff that transits through map.
There are probably more of these in the codebase.  Looks like this happens with the go tip via travis.
2014-06-14 14:42:00 -07:00
Daniel Smith 5626703634 Add a new e2e test; fix some bugs/usability problems 2014-06-13 16:30:26 -07:00
Brendan Burns 164160adef Address package level comments for readability. 2014-06-12 20:26:12 -07:00
Johan Euphrosine 4f6bed03ae gofmt -s pkg/ cmd/ 2014-06-12 14:16:19 -07:00
Brendan Burns 5cb4444176 Task -> Pod #4, the final chapter 2014-06-08 23:00:12 -07:00
Brendan Burns 6018497174 Task -> Pod part #3 2014-06-08 22:38:45 -07:00
Brendan Burns 66e2575f2b More Task -> Pod 2014-06-08 21:43:17 -07:00
Brendan Burns c8d493f532 Part one of the grand rename: Task -> Pod 2014-06-08 21:17:53 -07:00
Joe Beda 2c4b3a562c First commit 2014-06-06 16:40:48 -07:00