Commit Graph

75 Commits (8621326a7a542605cb958a61c37b27fa80f6d12c)

Author SHA1 Message Date
Yu-Ju Hong deafa44d61 kubelet: send all recevied pods in one update
The kubelet sync loop relies on getting one update as the signal that the
specific source is ready. This change ensures that we don't send multiple
updates (ADD, UPDATE) for the first batch of pods. This is required to prevent
the cleanup routine from killing pods prematurely.
2016-03-17 14:24:35 -07:00
k8s-merge-robot 7e158006c0 Merge pull request #19940 from yujuhong/fix_update
Auto commit by PR queue bot
2016-02-01 13:35:54 -08:00
Random-Liu 488e14a5a9 Cleanup duplicated code in config.go 2016-01-28 01:04:35 -08:00
Yu-Ju Hong 0fada52788 Fix sending an empty update when the source is ready 2016-01-21 14:24:39 -08:00
k8s-merge-robot 67ac4e3838 Merge pull request #18410 from Random-Liu/reconcile-pod-status
Auto commit by PR queue bot
2016-01-12 02:17:09 -08:00
Random-Liu 5b4a210d49 Add reconcile support in kubelet 2016-01-10 01:35:07 -08:00
Yu-Ju Hong 712612c2dc Treat first-seen, non-pending pods as updates
Kubelet doesn't perform checkpointing and loses all its internal states after
restarts. It'd then mistaken pods from the api server as new pods and attempt
to go through the admission process. This may result in pods being rejected
even though they are running on the node (e.g., out of disk situation). This
change adds a condition to check whether the pod was seen before and categorize
such pods as updates. The change also removes freeze/unfreeze mechanism used to
work around such cases, since it is no longer needed and it stopped working
correctly ever since we switched to incremental updates.
2016-01-08 17:21:43 -08:00
k8s-merge-robot c2189fd60d Merge pull request #18518 from Random-Liu/fix-potential-data-race
Auto commit by PR queue bot
2015-12-16 09:45:52 -08:00
Tim Hockin 7fb8f60735 Shorten names for better reading 2015-12-10 11:48:19 -08:00
Tim Hockin 87a35047dd Move FieldPath and errors to a sub-package
This makes the naming and reading a lot simpler.
2015-12-10 11:48:16 -08:00
Random-Liu eb551f388c Fix potential data race 2015-12-10 10:35:02 -08:00
k8s-merge-robot 37d22999b4 Merge pull request #17572 from yujuhong/kubeutil
Auto commit by PR queue bot
2015-12-04 03:15:54 -08:00
Yu-Ju Hong a4816b3bcb Make kublet/util/format.go a separate package
The formatting function is used often in logging. This improves the readability
by shortening the length of the call. Also change the fomartted string to
include the pod UID.
2015-12-03 12:47:36 -08:00
Tim Hockin e6df0b1a24 Convert validation to use FieldPath
Before this change we have a mish-mash of ways to pass field names around for
error generation.  Sometimes string fieldnames, sometimes .Prefix(), sometimes
neither, often wrong names or not indexed when it should be.

Instead of that mess, this is part one of a couple of commits that will make it
more strongly typed and hopefully encourage correct behavior.  At least you
will have to think about field names, which is better than nothing.

It turned out to be really hard to do this incrementally.
2015-12-03 08:19:44 -08:00
k8s-merge-robot 431c67710b Merge pull request #17247 from thockin/airplane_validation_pt3
Auto commit by PR queue bot
2015-11-24 18:37:09 -08:00
Avesh Agarwal 3d5207fd73 This commit adds type information to events.
This addresses issue #15624.
2015-11-24 09:59:54 -05:00
Tim Hockin ceee678b29 Rename validation 'New' funcs 2015-11-23 10:01:43 -08:00
Tim Hockin 682f2a5a79 Stronger typing for validation ErrorList 2015-11-23 10:01:43 -08:00
Tim Hockin 0ff66da346 Move fielderrors into validation 2015-11-22 20:12:20 -08:00
jiangyaoguo b0f0c294d9 make reasons constants with clarity 2015-11-09 23:42:14 +08:00
k8s-merge-robot 4736adee8f Merge pull request #15621 from mesosphere/sttts-send-initial-set-to-get-seen
Auto commit by PR queue bot
2015-10-16 08:04:29 -07:00
eulerzgy ea86e66fbe Del capatical local packagename for kubeletUtil 2015-10-15 09:58:10 +08:00
Dr. Stefan Schimanski 7dddec6799 Switch to empty ADD PodUpdate for PodConfigNotificationIncremental mode 2015-10-14 15:38:44 +02:00
Dr. Stefan Schimanski 5cfeb53057 Enforce an initial empty SET PodConfig
In PodConfigNotificationIncremental PodConfig mode, when no pods are available
for a source, the Merge function correctly concluded that neither ADD, UPDATE nor
REMOVE updates are to be sent to the kubelet. But as a consequence the kubelet will
not mark that source as seen.

This is usually not a problem for the apiserver source. But it is a problem for
an empty "file" source, e.g. by passing an empty directory to the kubelet for
static pods. Then the file source will never be seen and the kubelet will stay
in its special not-all-source-seen mode.
2015-10-14 14:22:44 +02:00
Yu-Ju Hong a3e60cc32e Rename imported package local name kubeletTypes to kubetypes
According to the naming guidelines, package name should not include mixedCaps.
2015-10-09 10:24:31 -07:00
k8s-merge-robot 45cca144cb Merge pull request #15167 from yujuhong/sources_seen
Auto commit by PR queue bot
2015-10-09 08:35:40 -07:00
Yu-Ju Hong 098ab05997 kubelet: move common types to kubelet/types
This would faciliate tasks such as moving code in pkg/kubelet to sub packages.
2015-10-08 14:38:01 -07:00
Yu-Ju Hong 5abdfcdfe6 kubelet: fix all sources ready condition
The current implementation considers a source seen when it receives a SET at
kubelet/config/config.go. However, the main kubelet sync loop may not have
received the pod update from the source via the channel. This change ensures
that kubelet would consider all sources are ready only after the sync loop has
seen all the sources.
2015-10-06 10:13:04 -07:00
Salvatore Dario Minonne 32f56619a7 Partial fix for issue #14263 2015-09-25 15:29:00 +02:00
Nikhil Jindal 9e5ed1dc69 Merge pull request #13880 from yujuhong/fix_annotations
Fix source annotation in kubelet
2015-09-17 23:28:41 -07:00
Yu-Ju Hong fb270779b5 kubelet: fix the config unit tests 2015-09-14 11:07:27 -07:00
Tamer Tas 6908790410 Add a default value to PodConfigNotificationMode 2015-09-14 15:00:01 +03:00
Yu-Ju Hong 69c3aa0872 Fix source annotation in kubelet
kubelet relies on source annotation to distinguish pods from different sources.
It should always annotate the source when receiving the pod to avoid any
confusion. This commit fixes that and also make sure we don't overwrite the
first seen time.
2015-09-11 14:52:16 -07:00
Daniel Smith 15b30b8b09 Move version agnostic parts of client
pkg/client/unversioned/cache -> pkg/client/cache
pkg/client/unversioned/record -> pkg/client/record
2015-09-10 17:17:59 -07:00
tummychow 78ce5da988 Move util.StringSet into its own package
A lot of packages use StringSet, but they don't use anything else from
the util package. Moving StringSet into another package will shrink
their dependency trees significantly.
2015-09-10 12:04:15 -07:00
Pedro Roque Marques bf170a688c Update annotations in the kubelet.
When the pod annotations are updated in the apiserver, update the pod.
Annotations may be used to convey attributes that are required to the
pod execution, such as networking parameters.
2015-08-28 15:50:13 -07:00
Yu-Ju Hong b906e34576 kubelet: trigger pod workers independently
Currently, whenever there is any update, kubelet would force all pod workers to
sync again, causing resource contention and hence performance degradation.

This commit flips kubelet to use incremental updates (as opposed to snapshots).
This allows us to know what pods have changed and send updates to those pod
workers only. The `SyncPods` function has been replaced with individual
handlers, each handling an operation (ADD, REMOVE, UPDATE). Pod workers are
still triggered periodically, and kubelet performs periodic cleanup as well.

This commit also spawns a new goroutine solely responsible for killing pods.
This is necessary because pod killing could hold up the sync loop for
indefinitely long amount of time now user can define the graceful termination
period in the container spec.
2015-08-25 17:52:01 -07:00
Clayton Coleman f5c4a3e7a6 Handle graceful termination in the Kubelet
Supports pods that are gracefully deleted on the server being
handled in the Kubelet

preStop is limited to the grace period of the pod in execution.
2015-08-21 10:18:21 -04:00
Robert Bailey 08e6a43c1d Revert "Merge pull request #9165 from smarterclayton/graceful"
This reverts commit 4f856b595d, reversing
changes made to d78525a83b.

Conflicts:
	pkg/kubelet/status_manager.go
2015-08-18 17:34:49 -07:00
Kris Rousey ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Clayton Coleman b842a7dd15 Revert "Revert "Gracefully delete pods from the Kubelet""
This reverts commit 98115facfd.
2015-08-18 08:57:02 -04:00
jiangyaoguo 9ab4a46b9d Keep event reason in kubelet consistent with others 2015-08-12 19:00:09 +08:00
Kris Rousey 565189f5b8 Correcting all go vet errors 2015-08-11 13:55:37 -07: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
Yu-Ju Hong f7fd7e9687 Kubelet: add and modify some logging messsages
This helps debug #6651
2015-06-24 16:29:19 -07:00
Yu-Ju Hong f96a8d0935 Kubelet: record the initial pod processing latency
Add a new latency metric for the time from seeing the pod for the first time
to starting a pod worker for it.

Also, change PodStartLatency to include this initial processing latency.
2015-06-19 12:07:55 -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