Commit Graph

138 Commits

Author SHA1 Message Date
Jerzy Szczepkowski
f09a08d15a Refactoring of get etcd tests.
Refactoring of get etcd tests: introudced new generic resttest, TestGet; Converted all etcd tests to use it.
2015-08-13 12:14:04 +02:00
Mike Danese
17defc7383 run gofmt on everything we touched 2015-08-05 17:52:56 -07:00
Mike Danese
8e33cbfa28 rewrite go imports 2015-08-05 17:30:03 -07:00
Wojciech Tyczynski
3cbbe72f9f Move etcd storage to pkg/storage/etcd 2015-07-30 15:42:06 +02:00
Wojciech Tyczynski
99d6b0e9f4 Rename storage interfaces 2015-07-30 10:34:57 +02:00
Wojciech Tyczynski
d17985f1ad Move StorageInterface to pkg/storage. 2015-07-30 09:32:04 +02:00
Wojciech Tyczynski
9d943df397 Private EtcdHelper 2015-07-27 09:20:13 +02:00
nikhiljindal
221ae4d63b Allow update without resource version 2015-06-23 00:16:08 -07:00
Prashanth Balasubramanian
9ed9bd1c4f Add a generation number to the object meta of all objects, and status of rcs 2015-06-19 14:32:08 -07:00
Filip Grzadkowski
98115facfd Revert "Gracefully delete pods from the Kubelet" 2015-06-02 23:40:05 +02:00
Clayton Coleman
72ee028cab Gracefully delete pods from the Kubelet
This commit wires together the graceful delete option for pods
on the Kubelet.  When a pod is deleted on the API server, a
grace period is calculated that is based on the
Pod.Spec.TerminationGracePeriodInSeconds, the user's provided grace
period, or a default.  The grace period can only shrink once set.
The value provided by the user (or the default) is set onto metadata
as DeletionGracePeriod.

When the Kubelet sees a pod with DeletionTimestamp set, it uses the
value of ObjectMeta.GracePeriodSeconds as the grace period
sent to Docker.  When updating status, if the pod has DeletionTimestamp
set and all containers are terminated, the Kubelet will update the
status one last time and then invoke Delete(pod, grace: 0) to
clean up the pod immediately.
2015-06-01 19:23:59 -04: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
Karl Beecher
a7623ca6cc Adds ability to define a prefix for etcd paths
The API server can be supplied (via a command line flag) with a custom
prefix that is prepended to etcd resources paths.

Refs: #3476
2015-04-24 12:12:39 +02:00
Clayton Coleman
e6e034af4f Rename PodTemplate.Spec to PodTemplate.Template 2015-04-22 12:54:27 -04:00
Daniel Smith
1a2e4f8e1d Merge pull request #6616 from brendandburns/default
Default replica controller selector and labels using pod template.
2015-04-10 13:33:43 -07:00
Brendan Burns
fded23a777 Default replica controller nodeSelector using pod template.
Add default labels from pod if not present.
2015-04-09 20:50:37 -07:00
Brendan Burns
5d4f1cf8da Add Validate in addition to ValidateUpdate to validation for most resources. 2015-04-08 20:15:49 -07:00
Clayton Coleman
51db3bd654 Create a new testclient package that can be backed by disk files
Standardize how our fakes are used so that a test case can use a
simpler mechanism for providing large, complex data sets, as well
as represent queries over time.
2015-04-07 14:56:15 -04:00
Daniel Smith
34b399ca02 Fix incorrect reference to name in v1beta3 API. 2015-04-03 14:10:47 -07:00
Andy Goldstein
d7c5f427cb Pass ctx to Validate, ValidateUpdate
Pass ctx to Validate/ValidateUpdate. This is useful so strategies can
access data such as the current user.
2015-03-30 17:33:08 -04:00
Piotr Szczesniak
768c733bed Merge pull request #5971 from bprashanth/rc_watch_fields
Add the ability to watch fields of a replication controller
2015-03-27 10:19:41 +01:00
Tim Hockin
0f36c68244 Add REST PrepareForUpdate() hook
As per discussion with @snmarterclayton.  I implemented this for most
types in the "obvious" way.  I am not sure how to implement
this for a couple types, though.
2015-03-26 13:48:41 -07:00
Tim Hockin
b2687c1a84 rename ResetBeforeCreate to PrepareForCreate 2015-03-26 13:48:34 -07:00
Prashanth Balasubramanian
b0068d05f8 Add the ability to watch fields of an rc 2015-03-26 11:01:56 -07:00
Prashanth Balasubramanian
ef6601646d Migrate replication controllers to generic etcd 2015-03-23 17:59:25 -07:00
Clayton Coleman
9bb797fe93 Rename NewREST -> NewStorage to align on terminology 2015-03-23 16:52:21 -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
Clayton Coleman
65425f690c Move field errors to pkg/util/fielderrors
Allows pkg/api to take a reference to labels.Selector and fields.Selector
2015-03-22 17:43:34 -04:00
Dawn Chen
34e9c82c70 Convert RestartPolicy to string for v1beta3.
Fixed #3607 and spiritually support #5475
2015-03-13 18:38:07 -07:00
Prashanth Balasubramanian
6193608e9b Add an rc strategy, start delta validating updates 2015-03-13 13:09:03 -07:00
Prashanth Balasubramanian
28d9260c0b Sync replication count with the api server on pod creation/deletion. 2015-03-11 13:29:20 -07:00
Salvatore Dario Minonne
925fa6baf8 Adding fields selector 2015-03-10 22:13:10 +01:00
Daniel Smith
3ef3777192 Make unexported fields panic (informatively)
...Also fix some incorrect calls to semantic.DeepEqual, and a bug where
it returned true incorrectly.
2015-03-05 21:40:37 -08:00
Mike Danese
5cbf89c060 plumb through changes on ReplicationController and Service 2015-03-04 10:38:42 -08:00
Tim Hockin
ea548b8260 Rename type Port to ContainerPort
Sadly I had to do this by hand - I just could not get gorename to fix up
users of it.
2015-02-27 21:05:59 -08:00
Daniel Smith
650f6cb826 Revert "Multi-port Endpoints" 2015-02-23 13:53:21 -08:00
Tim Hockin
e0fd83096c Rename type Port to ContainerPort
Sadly I had to do this by hand - I just could not get gorename to fix up
users of it.
2015-02-21 22:26:38 -08:00
Clayton Coleman
26f08b7807 RESTStorage should not need to know about async behavior
Also make sure all POST operations return 201 by default.
Removes the remainder of the asych logic in RESTStorage and
leaves it up to the API server to expose that behavior.
2015-02-11 16:26:08 -05:00
Yu-Ju Hong
4a72addaeb Factor out API defaulting from validation logic
Currently, the validation logic validates fields in an object and supply default
values wherever applies. This change factors out defaulting to a set of
defaulting callback functions for decoding (see #1502 for more discussion).

 * This change is based on pull request 2587.

 * Most defaulting has been migrated to defaults.go where the defaulting
   functions are added.

 * validation_test.go and converter_test.go have been adapted to not testing the
   default values.

 * Fixed all tests with that create invalid objects with the absence of
   defaulting logic.
2015-02-03 00:55:42 -08:00
Clayton Coleman
1588970ec4 Turn 409 into 500 Try Again Later when using generateName
If a client says they want the name to be generated, a 409 is
not appropriate (since they didn't specify a name). Instead, we
should return the next most appropriate error, which is a 5xx
error indicating the request failed but the client *should* try
again.  Since there is no 5xx error that exactly fits this purpose,
use 500 with StatusReasonTryAgainLater set.

This commit does not implement client retry on TryAgainLater, but
clients should retry up to a certain number of times.
2015-02-02 14:46:25 -05:00
Clayton Coleman
a7c9a12286 Add name generation and normalize common create flows
Adds `ObjectMeta.GenerateName`, an optional string field that defines
name generation behavior if a Name is not provided.

Adds `pkg/api/rest`, which defines the default Kubernetes API pattern
for creation (and will cover update as well). Will allow registries
and REST objects to be merged by moving logic on api out of those places.

Add `pkg/api/rest/resttest`, which will be the test suite that verifies
a RESTStorage object follows the Kubernetes API conventions and begin
reducing our duplicated tests.
2015-02-02 14:44:53 -05:00
Brian Grant
0345211e0c Merge pull request #3921 from nikhiljindal/OperationClean
Some more operations code cleanup
2015-01-29 14:54:05 -08:00
nikhiljindal
dc92d3c7a2 Cleaning up the operations code in client 2015-01-28 21:04:16 -08:00
Tim Hockin
a480794efc Tighten validation of Name and Namespace 2015-01-27 17:04:59 -05:00
Tim Hockin
e86d4cd3c6 Use a strong type for UID fields 2015-01-14 13:53:43 -08:00
Clayton Coleman
22c99c98e2 Split RESTStorage into separate interfaces
Omit unimplemented interfaces from Swagger
2015-01-12 12:19:45 -05:00
Daniel Smith
35f54addca Update more packages, tests, binaries for quantity
make etcd registry pass test
fix kubelet config for quantity
fix openstack for quantity
fix controller for quantity
fix last tests for quantity
wire into binaries
fix controller manager
fix build for 32 bit systems
2015-01-07 15:21:35 -08:00
Brian Grant
9b539262a8 Count only non-dead pods in replicationController current state replicas count. 2014-12-12 22:23:14 +00:00
Deyuan Deng
76552423f9 Move watch filter into storage level 2014-12-04 20:15:27 -05:00
derekwaynecarr
15701ff403 Set uid during object create 2014-11-13 15:25:49 -05:00
Clayton Coleman
94c873e7a4 Remaining refactor for PodTemplateSpec and fixing test cases 2014-11-11 17:03:20 -05:00
Brendan Burns
a624630112 Add some blocking so that we don't generate identical UUIDs for API objects. 2014-11-03 13:27:59 -08:00
Clayton Coleman
d5ee171410 Allow clients to determine the difference between create or update on PUT
PUT allows an object to be created (http 201).  This allows REST code to
indicate an object has been created and clients to react to it.

APIServer now deals with <-chan RESTResult instead of <-chan runtime.Object,
allowing more data to be passed through.
2014-10-24 14:41:15 -04:00
Clayton Coleman
644eb70085 Refactor tests to split ObjectMeta from TypeMeta 2014-10-24 11:22:21 -04:00
Clayton Coleman
09800643e2 Change validation now that namespace is on ObjectMeta 2014-10-24 11:22:20 -04:00
Clayton Coleman
bb77a5d15f Rename ID -> Name 2014-10-22 15:00:26 -04:00
deads2k
34b5861b60 add unit tests for rejection of conflicting namespaces 2014-10-21 15:57:02 -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
Clayton Coleman
d3e51a0f24 Rename JSONBase -> TypeMeta in preparation for v1beta3
Will make subsequent refactor much easier
2014-10-07 11:12:16 -04:00
derekwaynecarr
6625e58a20 Updates to review comments 2014-10-01 10:57:50 -04:00
derekwaynecarr
0312d80ffa Update test cases to use default context 2014-10-01 10:57:50 -04:00
derekwaynecarr
e4ec49ee6b Require namespace on controller, pod, service objects 2014-10-01 10:57:50 -04:00
derekwaynecarr
09365fed8d Add ctx to registry interfaces 2014-09-26 15:18:42 -04:00
derekwaynecarr
ee19ba186d Update to use api.Context 2014-09-26 11:50:34 -04:00
derekwaynecarr
be85ad7a3d Add context object in test cases flows 2014-09-26 11:50:34 -04:00
derekwaynecarr
3e685674e7 Add context object to interfaces 2014-09-26 11:50:34 -04:00
Daniel Smith
212f5305a8 Fix type cast problems now that watch can pass errors 2014-09-25 11:42:58 -07:00
Daniel Smith
4e9cf2ccb4 Add field selector to List, implement for pods. 2014-09-16 16:17:16 -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
Brendan Burns
e7625c8d91 Add current state to replica controller. 2014-09-09 16:19:18 -07:00
Brendan Burns
4ba4762827 Insert the current state of a replica controller. 2014-09-09 15:23:34 -07:00
Daniel Smith
759c3f9033 Rename all XStorage types to REST for clarity 2014-09-08 15:19:13 -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
Clayton Coleman
34c40e4e48 Errors should be part of api/errors, not apiserver
Renames constructor methods to be errors.New<name> which changed a few
places.
2014-09-03 17:16:00 -04: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
Vojtech Vitek (V-Teq)
42c656501c Add several missing pkg Godoc files
Signed-off-by: Vojtech Vitek (V-Teq) <vvitek@redhat.com>
2014-09-02 13:41:11 +02:00
Clayton Coleman
bafc422ac0 Add the resource version to api.*List items from etcd
Allows clients to watch more easily (can invoke Get, then
Watch).
2014-08-28 23:17:00 -04:00
Clayton Coleman
52923a1348 Return validation errors from storage create/update 2014-08-26 13:30:55 -04:00
Brendan Burns
5839378adc Add a validation that replicaSelector matches PodTemplate.Labels 2014-08-21 22:18:55 -07:00
brendandburns
1bd4ae0c62 Merge pull request #943 from smarterclayton/only_wait_for_acceptance
Clients must wait for completion of actions
2014-08-20 21:01:21 -07:00
Clayton Coleman
493863eb93 Return immediately when controllers/pods are committed
Add client waiting conditions.
2014-08-20 18:46:10 -04:00
Brendan Burns
a198bbb0ae Switch api.Status to *api.Status in a bunch of places. 2014-08-20 10:21:49 -07:00
Daniel Smith
4b2867fd8a Standardize watch usage in registry/storage objects. Fix up extremely confusing pod test object. 2014-08-16 19:07:41 -07:00
Paul Morie
c69160059b Change CreationTimestamp to a util.Time and set in each storage implementation
Because time.Time doesn't work correctly with our YAML package, it is necessary
to introduce a type, util.Time, which serializes correctly to JSON and YAML.

Eventually we would like timestamping to cut across storage implementations;
for now, we set it in each storage.
2014-08-14 16:26:29 -04:00
Kelsey Hightower
c21a0ca39f Breakup the registry package into separate packages.
Currently all registry implementations live in a single package,
which makes it bit harder to maintain. The different registry
implementations do not follow the same coding style and naming
conventions, which makes the code harder to read.

Breakup the registry package into smaller packages based on
the registry implementation. Refactor the registry packages
to follow a similar coding style and naming convention.

This patch does not introduce any changes in behavior.
2014-08-11 20:58:09 -07:00