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.
This commit adds support to core resources to enable deferred deletion
of resources. Clients may optionally specify a time period after which
resources must be deleted via an object sent with their DELETE. That
object may define an optional grace period in seconds, or allow the
default "preferred" value for a resource to be used. Once the object
is marked as pending deletion, the deletionTimestamp field will be set
and an etcd TTL will be in place.
Clients should assume resources that have deletionTimestamp set will
be deleted at some point in the future. Other changes will come later
to enable graceful deletion on a per resource basis.
In order to support graceful deletion, the resource object will
need access to the TTL value in etcd. Also, in the future we
may want to get the creation index (distinct from modifiedindex)
and expose it to clients. Change EtcdResourceVersioner to be
more type specific (objects vs lists) and provide a default
implementation that relies on the internal API convention.
Also, rename etcd_tools.go to etcd_helper.go and split a few
things up.
We decided to get rid of boundPods. Removing this check is
a prerequisite for that. This check had some value before we had
IP-per-Pod. However, AIUI, use of HostPort is strongly discouraged
in Kubernetes. It still exists as part of a Pod spec because
of ContainerVM, where it is used. But, this change does not affect
ContainerVM, where there is no master.
If someone did create pods with HostPort using kubernetes, the following
would happen:
- The scheduler would try not to put two conflicting pods on the same
machine (pkg/scheduler/predicates.go : PodFitsPorts() )
- I'm not sure if it is currently possible for a race to occur where
the PodFitsPorts check were bypassed. Maybe it could happen.
- If the kubelet was sent conflicting pods, it would detect them in
( pkg/kubelet/kubelet.go : filterHostPortConflicts() ). It would
arbitrarily pick one pod to run and another to ignore.
- If all of the above happened and the user filed and issue on github,
we might figure out that the user used HostPort and tell the user to stop.
TODO:
- e2e test
- Several of the demos in examples/ use hostPort. Change them to
not specify hostPort and have a service instead.
Some load balancers (particularly AWS ELB) define the public endpoint
as a hostname (instead of using IP addresses).
This is a partial fix for #5224; there will also be some proxy work.
Allows POST to create a binding as a child. Also refactors internal
and v1beta3 Binding to be more generic (so that other resources can
support Bindings).
Also fix that Update was returning AlreadyExists instead of
NotFound (when create is disabled) and that Update when CreateOnUpdate
was true was not populating the returned object.
Added more tests
PUT /api/v1beta3/namespaces/default/pods/foo/status
{
"metadata": {...}, // allowed for valid values
"spec": {}, // ignored
"status": {...}, // allowed, except for Host
}
Exposes the simplest possibly change. Needs a slight refactoring
to RESTUpdateStrategy to split merging which can be done in a
follow up.
If `kube-apiserver` is started before `etcd` is reachable, `kube-apiserver`
fails to create those services.
However, in the `Create` function, an IP has already been reserved for them.
When `etcd` comes back, the `Create` function fails because it considers that
the IP is already used.
If the service couldn't be created, the reserved IP should be released.
They will still show up in etcd. They never were available
through the API.
A subsequent PR(s) will rip out all BoundPods code.
Working in small increments.
This PR will cause users on lagging cloud providers
to not get env vars in their pods if they update to this code.
They have already been warned via email.
Removed unit tests of BasicBoundPodFactory.
There is adequate coverage in pkg/kubelet/kubelet_test.go.
In some cases, when the key doesn't exist, AtomicUpdate should simply fail and
surface the error. This change adds a new function parameter "ignoreNotFound"
for this purpose.
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.
As far as I know, nobody uses it. It was replaced by PublicIPs. If I were
being very polite I would leave it in internal, but since I am 99.99% sure
nobody uses it, I am cutting it. Let's argue about it.
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.
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.
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.
# *** ERROR: *** Some files have not been gofmt'd. To fix these
# errors, run gofmt -s -w <file>, or cut and paste the following:
# gofmt -s -w pkg/kubecfg/resource_printer.go pkg/proxy/config/config.go pkg/runtime/types.go
#
# Your commit will be aborted unless you override this warning. To
# commit in spite of these format errors, delete the following line:
# COMMIT_BLOCKED_ON_GOFMT
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