Commit Graph

182 Commits (084c7fe82ae7db7887afd651f11e4e15c25241af)

Author SHA1 Message Date
Yu-Ju Hong 793a3c0c63 Use the first token of hostname for generating static pod names
This increases the readability of pods by avoiding long names.

This fixes #5936
2015-03-26 16:12:49 -07:00
Yu-Ju Hong 4e909c6cee Kubelet: no need to overwrite SelfLink for pods from the apiserver
Pods from the apiserver should already have SelfLink set. There is no need to
create one ourselves.
2015-03-25 16:34:02 -07:00
Yifan Gu 31bb11ac2a kubelet: Move pod name helpers to pkg/kubelet/container/runtime.go 2015-03-24 16:08:04 -07:00
Clayton Coleman d020ca00b8 Pass hostname to all kubelet config sources instead of os.Hostname()
Make applyDefaults be tied to the current config source.
2015-03-23 15:58:45 -04:00
Clayton Coleman b442f76961 Syntax errors in file_test were added right as validation became more strict 2015-03-23 14:43:09 -04:00
Victor Marmol 4e3c07543e Merge pull request #5784 from wojtek-t/applyDefaultsInTryDecode
Hide applyDefaults method under pkg/kubelet/config
2015-03-23 07:32:00 -07:00
Wojciech Tyczynski b395c40e19 Refactor pkg/kubelet/config 2015-03-23 10:29:46 +01: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
Wojciech Tyczynski 9c4ef28b2d Comments 2015-03-20 20:13:16 +01:00
Wojciech Tyczynski 3b367f8ab8 Refactor file_test.go 2015-03-20 20:13:16 +01:00
Wojciech Tyczynski 7a7e64331c Kubelet file read both ContainerManifest and Pod 2015-03-20 12:09:09 +01:00
Wojciech Tyczynski c5d8c391fb Refactor kubelet/config to share code 2015-03-20 09:40:52 +01:00
Victor Marmol 6f6485909e Merge pull request #5598 from wojtek-t/kubelet_http_read_pod
Kubelet read pods from http
2015-03-19 11:49:28 -07:00
Wojciech Tyczynski c512c549a1 Kubelet http read both ContainerManifest and Pod 2015-03-19 18:57:00 +01:00
Filip Grzadkowski f89f91b7bd Validate that there is at least one container in the pod 2015-03-19 12:31:53 +01:00
Yu-Ju Hong 05c61d2e47 Merge pull request #5622 from vmarmol/http
Add SelfLink to Kubelet http source.
2015-03-18 18:09:05 -07:00
Yu-Ju Hong 7b71780dfc kubelet/config/http_test: use versioned ContainerManifest 2015-03-18 17:40:40 -07:00
Victor Marmol ce96182cc3 Add SelfLink to Kubelet http source. 2015-03-18 16:38:41 -07:00
Filip Grzadkowski 1a352b74ba Periodically update pod status from kubelet. 2015-03-18 12:11:39 +01:00
Salvatore Dario Minonne 31ddefc347 Finalize fields.Selector 2015-03-17 22:55:43 +01:00
Yu-Ju Hong 929fb63b33 Sync static pods from Kubelet to the API server
Currently, API server is not aware of the static pods (manifests from
sources other than the API server, e.g. file and http) at all. This is
inconvenient since users cannot check the static pods through kubectl.
It is also sub-optimal because scheduler is unaware of the resource
consumption by these static pods on the node.

This change syncs the information back to the API server by creating a
mirror pod via API server for each static pod.

 - Kubelet creates containers for the static pod, as it would do
   normally.

 - If a mirror pod gets deleted, Kubelet will re-create one. The
   containers are sync'd to the static pods, so they will not be
   affected.

 - If a static pod gets removed from the source (e.g. manifest file
   removed from the directory), the orphaned mirror pod will be deleted.

Note that because events are associated with UID, and the mirror pod has
a different UID than the original static pod, the events will not be
shown for the mirror pod when running `kubectl describe pod
<mirror_pod>`.
2015-03-17 08:45:56 -07:00
Filip Grzadkowski 18b728ff44 Revert "Periodically update pod status from kubelet." 2015-03-17 13:51:45 +01:00
Filip Grzadkowski 336525a27d Periodically update pod status from kubelet. 2015-03-16 23:03:03 +01:00
Victor Marmol bdc1981eb5 Merge pull request #5433 from wojtek-t/remove_bound_pods
Remove BoundPods from Kubelet
2015-03-16 13:38:24 -07:00
Wojciech Tyczynski 5d95e9e671 Remove BoundPods from Kubelet 2015-03-16 19:17:21 +01:00
Dawn Chen 34e9c82c70 Convert RestartPolicy to string for v1beta3.
Fixed #3607 and spiritually support #5475
2015-03-13 18:38:07 -07:00
Wojciech Tyczynski 9f2f10d6db Make scheduler to watch PodSpec.Host instead Status.Host 2015-03-12 13:38:58 +01:00
Eric Tune ac7bf05079 Kubelet has not even heard of etcd. 2015-03-11 16:29:31 -07:00
Paul Morie a486ab078f Fix selfLink issues in integration test 2015-03-10 14:40:16 -04:00
nikhiljindal 916ca9cc68 Changing v1beta3 field selectors to be camelCased 2015-03-09 18:01:01 -07:00
Clayton Coleman 0f87337667 Kubelet tests broken on Macs with uppercase names
Hostname behavior across operating systems is inconsistent (Macs can
have uppercase host names, so can some other systems).  In general,
always strings.ToLower(os.Hostname()).
2015-03-08 23:44:32 -04:00
Yu-Ju Hong fe70be9261 kubelet: revamp the pod/container naming scheme
There are two main goals for this change.

 1. Fix the naming scheme in kubelet so that it accepts DNS subdomain
    name/namespaces correctly (#4920). The design is discussed in #3453.

 2. Prepare for syncing the static pods back to the apiserver(#4090). This
    includes

  - Eliminate the source component in the internal full pod name (#4922). Pods
    no longer need sources as they will all be sync'd via apiserver.

  - Changing the naming scheme for the static (file-, http-, and etcd-based)
    pods such that they are distinguishable when syncing back to the apiserver.

The changes includes:
  *	name = <pod.Name>-<hostname>
  * namespace = <cluster_namespace> (i.e. "default" for now).
  * container_name = k8s_<contianer_name>.<hash_of_container>_<pod_name>_<namespace>_<uid>_<random>

Note that this is not backward-compatible, meaning the kubelet won't recognize
existing running containers using the old naming scheme.
2015-03-06 13:14:45 -08:00
Yu-Ju Hong 32fd331e73 Revert "Split up kubelet "source seen" logic"
We want to sync pods from file/http/etcd sources to the apiserver, hence
differentiating sources is no longer desired.

This reverts commit 110ab6f1bd.
2015-03-06 12:57:48 -08:00
Paul Morie 02b18edac6 Allow multiple sources to be used with record package 2015-03-05 13:54:29 -05:00
Tim Hockin fdea7252a4 Merge pull request #5001 from brendandburns/api3
Embed VolumeSource in v1beta3 and internal.
2015-03-04 09:50:14 -08:00
Brendan Burns fb90b56bf6 Embed VolumeSource in v1beta3 and internal. 2015-03-04 02:25:40 -08: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
Daniel Smith 554b1c847c add occasional polling to reflector 2015-02-27 16:59:14 -08:00
nikhiljindal 48e7945f65 Versioning the field selectors 2015-02-27 16:10:59 -08:00
Tim Hockin 607b736a3f Rename volume source types to be consistent. 2015-02-23 12:39:57 -08:00
Wojciech Tyczynski 25c8f07c67 Batch updates of multiple Pods. 2015-02-18 16:46:16 +01:00
derekwaynecarr c0ce15c588 Make list watch take a ListFunc and WatchFunc, provide default funcs from client 2015-02-15 22:26:05 -05:00
Abhishek Shah febf8c9b2c Fixed formattting issues in etcd.go 2015-02-10 12:03:40 -08:00
Abhishek Shah f136886dde Updated logging. If etcd-pod-dir-fetch fails because dir was absent, an info message is logged. 2) For all other reasons, the regular error message is logged. 2015-02-09 18:03:58 -08: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
Dan Mace 5ee943d683 Support namespacing in cache.Store implementations
Support namespacing in cache.Store by framing the interface functions
around interface{} and providing a key function to each Store implementation.

Implementation of a fix for #2294.
2015-01-29 17:39:49 -05:00
Dawn Chen b0bcee7b40 Increase timeout for all testcases in file_test.go 2015-01-28 11:27:15 -08:00
Tim Hockin d63162b7e7 Make kubelet's HTTP source go through conversion 2015-01-22 14:09:37 -08:00
Tim Hockin 4ff2865cd1 Make kubelet's file source go through conversion
See comments for details.  Same problem exists in HTTP source, but I want to
float this for review first.
2015-01-22 13:10:59 -08:00
Tim Hockin ffb2b62726 Merge pull request #3725 from dchen1107/cleanup
Generate pod.Name when pod.Name == "" for both HTTP and file sources.
2015-01-22 13:10:27 -08:00
Dawn Chen ec77507915 Generate pod.Name when pod.Name == "" for both HTTP and file sources.
Fix #3584
2015-01-22 12:53:30 -08:00
Tim Hockin 30219f8dfa Merge pull request #3664 from thockin/pull-if
Pull if
2015-01-21 13:05:28 -08:00
Tim Hockin 81343aac63 Change PullPolicy constants to match 2015-01-21 12:48:56 -08:00
Tim Hockin 819803b79f Make VolumeSource not be a pointer
There's no reason for it to be a pointer.
2015-01-20 17:54:04 -08:00
Brian Grant dd45246150 Merge pull request #3587 from dchen1107/image
Clean up Kubernetes PullPolicy
2015-01-20 17:18:26 -08:00
Tim Hockin 60ec08db93 Rename HostDir to HostPath in v1beta3 2015-01-20 15:56:44 -08:00
Dawn Chen aec4594a8d Introduce validatePullPolicyWithDefault to validation. 2015-01-20 11:54:22 -08:00
Daniel Smith 46f8a56dba Merge pull request #3376 from erictune/channel_api
Kublet watches Pods.
2015-01-15 14:48:12 -08:00
Eric Tune 2e002b1095 Add second pod to test. 2015-01-15 13:36:49 -08:00
saadali b57cc6a11c Increase timeout for TestEtcdSourceExistingBoundPods test 2015-01-14 17:06:04 -08:00
Daniel Smith 46827720b3 Merge pull request #3493 from saad-ali/testFor3467
Add test case for EtcdSource ExistingBoundPods
2015-01-14 16:35:26 -08:00
saadali a1c287ede9 Add test case for EtcdSource ExistingBoundPods 2015-01-14 16:15:08 -08:00
Tim Hockin 1be3de895c Move util.UID to pkg/types 2015-01-14 15:22:21 -08:00
Daniel Smith c13ae34b02 Merge pull request #3445 from saad-ali/fix3172
Remove CONDITION from event object completely
2015-01-14 15:03:06 -08:00
Daniel Smith 8a764c02d5 Merge pull request #3478 from thockin/uid_type
Use a strong type for UID fields
2015-01-14 14:20:22 -08:00
saadali 90dfdcecd5 Remove CONDITION from event object completely
# *** 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
2015-01-14 14:17:16 -08:00
Dawn Chen 009c5e1129 Using ExtractObj instead of ExtractToList since BoundPods is not a List type 2015-01-14 14:05:47 -08:00
Tim Hockin e86d4cd3c6 Use a strong type for UID fields 2015-01-14 13:53:43 -08:00
saadali 826b61c76d Address nits from PR #3423 2015-01-13 23:34:37 -08:00
saadali 110ab6f1bd Split up kubelet "source seen" logic 2015-01-12 21:48:55 -08:00
Daniel Smith 55653568ae Merge pull request #3385 from erictune/source_api
Added kubelet config source from apiserver.
2015-01-12 15:47:15 -08:00
Eric Tune 18bcef5235 Added kubelet config source from apiserver. 2015-01-12 15:29:16 -08:00
Tim Hockin 905514a12b Ensure Namespace and UID are set in kubelet
Make all kubelet config sources ensure that UID and Namespace are defaulted, if
need be.

We can *almost* disable the "if blank" logic for UID, except for tests that
call APIs that do not run through SyncPods.  We really ought to be enforcing
invariants better.
2015-01-12 14:27:34 -08:00
saadali e1917cf900 Fix "Kubelet doesn't kill old pods when BoundPods is empty" issue 2015-01-12 12:39:47 -08: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
Dawn Chen 2b91c1417c Create selfLink for pods from config files and indicate hostname as part of event source. 2015-01-06 16:08:20 -08:00
Tim Hockin 8b42534f77 Fix kubelet config tests 2015-01-06 13:02:41 -08:00
Tim Hockin 88fe5c6f46 Never set pod.Name in kubelet config code
I think it is time to tighten up input requirements.  The validation code will
reject a pod that has an empty name field.
2015-01-06 11:14:19 -08:00
Brendan Burns 7da0378f3c Track the sources that the kubelet has seen, and only delete pods
when every source has been seen at least once.
2014-12-17 13:08:43 -08:00
Sam Ghods 9a9a1e0939 Move from go-yaml/yaml to ghodss/yaml 2014-12-02 16:24:05 -08:00
Eric Tune 7d3e00c679 Remove never-needed return value.
Make some types private.
2014-11-21 15:11:45 -08: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
Dawn Chen 8ffbced280 Introduce terminationMessagePath to Container, and update conversion code
to assign the default path.

Move default setting for terminationMessagePath to conversion
from validation. Addressed other comments.
2014-11-10 10:55:56 -08:00
markturansky bd7643c033 refactor services to v1beta3 2014-11-04 14:23:53 -05:00
Deyuan Deng acf9d23b32 Stop httptest server. 2014-10-30 21:37:08 -04:00
Clayton Coleman 644eb70085 Refactor tests to split ObjectMeta from TypeMeta 2014-10-24 11:22:21 -04:00
Clayton Coleman bb77a5d15f Rename ID -> Name 2014-10-22 15:00:26 -04:00
Clayton Coleman 3f8d30881c Sort of pods in test case was incorrect 2014-10-20 17:45:01 -04:00
Tim Hockin 87b0b3ad67 Better config-file logging in kubelet 2014-10-20 08:49:55 -07:00
derekwaynecarr d590af2ce5 Fixup kubelet handlePodInfo to be namespace aware 2014-10-17 14:42:46 -04:00
Clayton Coleman 26cff8b9bf Rename the etcd path for pods to be /registry/nodes/<>/boundpods 2014-10-16 19:29:08 -04:00
Clayton Coleman 892942af8f Read BoundPods from etcd instead of ContainerManifestList
There are three values that uniquely identify a pod on a host -
the configuration source (etcd, file, http), the pod name, and the
pod namespace. This change ensures that configuration properly
makes those names unique by changing podFullName to contain both
name (currently ID in v1beta1, Name in v1beta3) and namespace.

The Kubelet does not properly handle information requests for
pods not in the default namespace at this time.
2014-10-16 19:29:08 -04:00
Dawn Chen 33ef0ca159 Make watching error logging message less severe since it is expected.
Fix #1653
2014-10-14 16:42:28 -07: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 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
Daniel Smith bb0cd95a83 fix non-gofmt'd things 2014-09-24 14:27:10 -07:00
Daniel Smith f211e46f20 handle watch errors everywhere 2014-09-22 17:37:12 -07:00
Dave Bailey 14fcf68edc Improve error detection for URL manifests, and skip parsing if content unchanged. 2014-09-17 17:43:44 +00: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