Commit Graph

664 Commits (98e6d2c1e552120f20d7d726c5779ecfcb7145e5)

Author SHA1 Message Date
Ken Robertson fff8a7c371 kubelet: Update engine version parsing to handle semantic versioning
This updates the dockertools.dockerVersion to use a semantic versioning
library to more gracefully support engine versions which include
additional version fields.

Previously, go-dockerclient's APIVersion struct was use which only
handles plain numeric x.y.z version strings. With #19675, the library
was now used on the Docker engine string, however it is possible for the
engine string to include include additional information for beta, rc, or
distro specific builds.

This PR also enables the TestDockerRuntimeVersion test which was
previously just a FIXME and updates it to pass, and be used to test the
version string that cause #20005.

This negates the need for fsouza/go-dockerclient#451, since even with
that change, if a user was running Docker 1.10.0-rc1, this would cause
the kubelet to report it as simply 1.10.0.
2016-01-22 13:18:52 -08:00
Yu-Ju Hong 25f2c6f330 Improve mirror pod creation/deletion
- Ignore the "not found" error on deletion.
 - Recognize the "already exists" error on creation and check if the existing
   pod meets requirement. If so, don't report an error.
 - Immediately create a mirror pod after a successful deletion, if needed.
2016-01-21 16:01:14 -08:00
Ken Robertson a7b07c01df Update container runtime to properly report the engine and version
This address a TODO when collecting the node version information so it
will properly report the configured runtime and its version. Previously,
this was hardcoded to "docker://" and the docker version, and would show
"docker://1.9.1" even when the kubelet was configured to use rkt.

With this change, it will use the runtime's Type() and Version() data.

This also changes the container.Runtime interface to add an APIVersion()
method. This can be used when the runtime has separate versions for the
engine and the API, such as with Docker. The Docker minimum version
validation has been updated to use APIVersion(), and
DockerManager.Version() now returns the engine version.
2016-01-20 16:42:25 -08:00
Mike Danese 9745d1cbf0 Merge pull request #19626 from mikedanese/kubelet-labels
kubelet: use ConfigurationMap instead of json
2016-01-14 14:08:53 -08:00
Mike Danese 35a3785cf6 kubelet: use ConfigurationMap instead of json 2016-01-14 09:32:42 -08:00
k8s-merge-robot 5462a37dfe Merge pull request #17700 from yujuhong/status_cache
Auto commit by PR queue bot
2016-01-13 22:47:57 -08:00
Yu-Ju Hong b56ed1a8c2 Support populating the runtime cache in PLEG
This changes does not turn on this feature (cache) for kubelet.
2016-01-13 10:19:47 -08:00
Sami Wagiaalla f650648aae Add fsGroup to SetUp and SetUpAt 2016-01-13 10:37:10 -05:00
Tim St. Clair e2ffd007f7 Implement node Allocatable
Add `kube-reserved` and `system-reserved` flags for configuration
reserved resources for usage outside of kubernetes pods. Allocatable is
provided by the Kubelet according to the formula:
```
Allocatable = Capacity - KubeReserved - SystemReserved
```

Also provides a method for estimating a reasonable default for
`KubeReserved`, but the current implementation probably is low and needs
more tuning.
2016-01-12 17:00:43 -08:00
Mike Danese bf763bba95 Merge pull request #19498 from pwittrock/nodelabels
Node labels: Remove node-labels-file command line option.  Change --n…
2016-01-12 15:12:57 -08:00
Phillip Wittrock f1c8384ff4 Node labels: Remove node-labels-file command line option. Change --node-label format from key=value to key:value to be consitent with how the header key:value is specified on command line. 2016-01-12 12:57:12 -08:00
k8s-merge-robot c255181509 Merge pull request #18248 from resouer/images-dev
Auto commit by PR queue bot
2016-01-11 23:53:43 -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
harry zhang 27ca7dc71e Expose image list in node status
Change image manager to use repotag
2016-01-08 17:01:31 +08:00
Madhusudan.C.S 059c2aa799 Mitigate node out of disk status oscillation by delaying it.
Implement a flag that defines the frequency at which a node's out of
disk condition can change its status. Use this flag to suspend out of
disk status changes in the time period specified by the flag, after
the status is changed once.

Set the flag to 0 in e2e tests so that we can predictably test out of
disk node condition.

Also, use util.Clock interface for all time related functionality in
the kubelet. Calling time functions in unversioned package or time
package such as unversioned.Now() or time.Now() makes it really hard
to test such code. It also makes the tests flaky and sometimes
unnecessarily slow due to time.Sleep() calls used to simulate the
time elapsed. So use util.Clock interface instead which can be faked
in the tests.
2016-01-04 12:23:38 -08:00
Ravi Sankar Penta d0dd6c844b Allow node IP to be passed as optional config for kubelet
In case of multiple IPs on the node, this will allow admin to
specify desired IP to be used for the node.
2016-01-03 09:29:07 -08:00
k8s-merge-robot 674e24a16e Merge pull request #18617 from mqliang/OSImage
Auto commit by PR queue bot
2015-12-17 08:50:48 -08:00
Tim St. Clair 89bc7992f9 Refactor kubelet server into its own package
Refactor Kubelet's server functionality into a server package. Most
notably, move pkg/kubelet/server.go into
pkg/kubelet/server/server.go. This will lead to better separation of
concerns and a more readable code hierarchy.
2015-12-15 10:20:38 -08:00
mqliang a21dd8a32b replace OsImage to OSImage 2015-12-12 15:53:34 +08:00
k8s-merge-robot 23baca87b5 Merge pull request #18232 from pwittrock/fsacct
Auto commit by PR queue bot
2015-12-11 00:48:09 -08:00
k8s-merge-robot caf4b1e47f Merge pull request #18191 from thockin/ingress-egress-annotations
Auto commit by PR queue bot
2015-12-10 23:01:26 -08:00
Phillip Wittrock c67ce887f2 Volume Metrics Interface and base implementation.
- Add volume.MetricsProvider function to Volume interface.
- Add volume.MetricsDu for providing metrics via executing "du".
- Add volulme.MetricsNil for unsupported Volumes.
2015-12-09 16:06:24 -08:00
deads2k 2ee3dfe415 update testapi to eliminate redundant fields 2015-12-07 15:54:26 -05:00
Fabio Yeon 5457f5ace2 Merge pull request #18240 from timstclair/readiness
Update PodReady condition when updating container readiness
2015-12-07 10:43:22 -08:00
Abhi Shah bb3f49e526 Merge pull request #18089 from ArtfulCoder/oneNSAgain
SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst
2015-12-07 10:20:29 -08:00
Random-Liu 3cbdf79f8c Change original PodStatus to APIPodStatus, and start using kubelet internal PodStatus in dockertools 2015-12-04 17:37:39 -08:00
Tim St. Clair 2430454eea Update PodReady condition when updating container readiness 2015-12-04 15:40:33 -08:00
Tim Hockin 29a2fded52 Revert "Change to alpha/beta for bandwidth annotations"
This reverts commit 2f4c3035be.
2015-12-03 17:20:23 -08:00
Abhishek Shah 6c3a88cb3a SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst 2015-12-02 10:26:49 -08:00
Fabio Yeon 7100d278e3 Revert "SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst" 2015-12-01 20:58:27 -08:00
k8s-merge-robot 4602220ad0 Merge pull request #15645 from ArtfulCoder/oneNS
Auto commit by PR queue bot
2015-12-01 13:51:37 -08:00
jiangyaoguo f4c5d00b0c Implement a cachedNodeInfo in predicates 2015-11-27 21:49:14 +08:00
Abhishek Shah 015df14a4a SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst 2015-11-25 15:02:40 -08:00
Aaron Levy 3dc7c64ce9 kubelet: report NodeReady last in status list
Addresses a version skew issue where the last condition status is always
evaluated as the NodeReady status. As a workaround force the NodeReady
condition to be the last in the list of node conditions.

ref: https://github.com/kubernetes/kubernetes/issues/16961
2015-11-25 11:53:31 -08:00
Rohith c2526c93fa - adding the -node-label flag to the kubelet which allows for a initial tagging / labelling of the node on cluster registration
- the labels can come from a series of key=pair value or file:///path_to_file which contains key pairs
2015-11-18 23:20:58 +00:00
Jeff Lowdermilk 70d89a3541 Merge pull request #13571 from yujuhong/lifecycle_v0
kubelet: add a generic pod lifecycle event generator
2015-11-16 14:59:40 -08:00
k8s-merge-robot 7fa85d430b Merge pull request #16614 from pmorie/ro-managed
Auto commit by PR queue bot
2015-11-16 10:46:44 -08:00
k8s-merge-robot 081b21687e Merge pull request #16261 from zhengguoyong/update_condition
Auto commit by PR queue bot
2015-11-16 02:34:18 -08:00
Paul Morie 911757486d Refactor volume.Builder.IsReadOnly() to volume.Builder.GetAttributes() 2015-11-13 23:34:48 -05:00
Yu-Ju Hong bc6414a873 kubelet: add a generic pod lifecycle event generator
This change introduces pod lifecycle event generator (PLEG), and adds a generic
PLEG. The generic PLEG relies on relisting to discover container events, and is
container-runtime-agnostic. Both docker and rkt are changed to use generic
PLEG.
2015-11-13 09:55:36 -08:00
k8s-merge-robot e88593d788 Merge pull request #14542 from vishh/kubelet-refactor
Auto commit by PR queue bot
2015-11-12 15:24:22 -08:00
Vishnu kannan b1770537ab Make cadvisor startup synchronous with container runtime initialization.
This is hopefully a temporary workaround.

Signed-off-by: Vishnu kannan <vishnuk@google.com>
2015-11-11 15:20:13 -08:00
Vishnu kannan 4ad3d6f5fe Move container manager into a separate package.
Inject container manager into Kubelet. This lets us stub out container
manager during integration testing.
2015-11-11 15:00:37 -08:00
Vishnu kannan 89c3cb2f43 refactor podCIDR handling in kubelet to runtime state 2015-11-11 15:00:37 -08:00
Vishnu kannan 5f4570b764 handling locks and update tests. Fail node if network is not initialized 2015-11-11 15:00:37 -08:00
Vishnu kannan cf56f7a8ef Refactoring kubelet to separate object creation from object logical initialization. 2015-11-11 15:00:34 -08:00
Lantao Liu d6b93cdfe1 Move active deadline check into main syncLoop of kubelet. 2015-11-11 10:05:04 -08:00
eulerzgy 3f630d8ad7 when pod has successed, update condition to PodCompleted 2015-11-10 15:37:44 +08:00
k8s-merge-robot fb571e3e2e Merge pull request #16545 from timstclair/mirrorpods
Auto commit by PR queue bot
2015-11-05 02:56:23 -08:00
Tim St. Clair 858126b42a Clean up static/mirror pod status logic
- status.Manager always deals with the local (static) pod, but gets the
  mirror pod when syncing
  - This lets components like the probe workers ignore mirror pods
2015-11-04 11:42:25 -08:00
Yu-Ju Hong b734155954 Clean up housekeeping routine in kubelet
Now that kubelet checks sources seen correctly, there is no need to enforce the
initial order of pod updates and housekeeping. Use a ticker for housekeeping to
simplify the code.
2015-11-04 08:12:18 -08:00
Yu-Ju Hong 2eb17df46b kubelet: independent pod syncs and backoff on error
Currently kubelet syncs all pods every 10s. This is not preferred because
 * Some pods may have been sync'd recently.
 * This may cause all the pods to be sync'd at once, causing undesirable
   CPU spikes.

This PR replaces the global syncs with independent, periodic pod syncs. At the
end of syncing, each pod worker will enqueue itslef with a future timestamp (
current time + sync interval), when it will be due for another sync.
 * If the pod worker encoutners an sync error, it may requeue with a different
   timestamp to retry sooner.
 * If a sync is triggered by the update channel (events or spec changes), the
   pod worker would enqueue a new sync time.

This change is necessary for moving to long or no periodic sync period once pod
lifecycle event generator is completed. We will still rely on the mechanism to
requeue the pod on sync error.

This change also makes sure that if a sync does not succeed (either due to
real error or the per-container backoff mechanism), an error would be propagated
back to the pod worker, which is responsible for requeuing.
2015-11-03 13:29:08 -08:00
Dawn Chen a39e1e96dc Mark NodeNotReady for docker version below 1.6.2 2015-10-30 13:48:51 -07:00
Sami Wagiaalla 1d352a16b8 Support volume relabling for pods which specify an SELinux label 2015-10-28 09:26:58 -04:00
Daniel Smith 8524d392bf Merge pull request #16178 from madhusudancs/kubelet-out-of-disk-no-master
Report node out of disk condition in the kubelet.
2015-10-27 14:28:03 -07:00
k8s-merge-robot 0a7a9f3535 Merge pull request #16340 from timstclair/flaky-prober
Auto commit by PR queue bot
2015-10-27 12:10:22 -07:00
k8s-merge-robot df265b2d6e Merge pull request #15510 from aveshagarwal/master-selflink-objref
Auto commit by PR queue bot
2015-10-27 00:37:21 -07:00
Tim St. Clair 17b0a964f4 Always resync after resyncInterval 2015-10-26 18:50:57 -07:00
Madhusudan.C.S 9c4424f0bd Report out of disk as a node condition when node goes out of disk.
Define a new out of disk node condition and use it to report when node
goes out of disk.

Make a copy of loop range clause variable in node listers so that it
is available outside the for loop.

Also update/implement unit tests.
2015-10-26 15:01:20 -07:00
Tim Hockin 42c7fec490 Add a cloud-provider hook to scrub DNS for pods
GCE needs this hook and it seems general enough to include.
2015-10-23 17:01:49 -07:00
Abhishek Shah ba6469d478 kubelet manages /etc/hosts file 2015-10-22 13:27:05 -07:00
k8s-merge-robot 6dc3dcf36a Merge pull request #15414 from thockin/exp-beta-annotations
Auto commit by PR queue bot
2015-10-20 17:45:32 -07:00
Tim St. Clair a263c77b65 Refactor liveness probing
This commit builds on previous work and creates an independent
worker for every liveness probe. Liveness probes behave largely the same
as readiness probes, so much of the code is shared by introducing a
probeType paramater to distinguish the type when it matters. The
circular dependency between the runtime and the prober is broken by
exposing a shared liveness ResultsManager, owned by the
kubelet. Finally, an Updates channel is introduced to the ResultsManager
so the kubelet can react to unhealthy containers immediately.
2015-10-19 15:15:59 -07:00
k8s-merge-robot 09a3871506 Merge pull request #15755 from zhengguoyong/del_capatical_packagename_for_cadvisorApi2
Auto commit by PR queue bot
2015-10-18 04:04:11 -07:00
Dawn Chen 6f46780cbf Add tests to reproduce the issue and verify the fix. 2015-10-16 15:16:07 -07:00
eulerzgy 31c09bdcb8 Del capatical local packagename for cadvisorApi 2015-10-16 11:03:50 +08:00
Tim Hockin 2f4c3035be Change to alpha/beta for bandwidth annotations 2015-10-14 15:33:19 -07:00
Yu-Ju Hong 2c76c55bb9 kubelet: move PodManager and MirrorClient to a subpackage
This change moves pod_manager.go and mirror_client.go to a separate package.
Also made necessary, minor changes to facilitate testing.
2015-10-12 16:34:18 -07:00
Avesh Agarwal 8e4a8b7260 Addresses issue #6596.
Removes ForTesting_ReferencesAllowBlankSelfLinks.
Fixes controller's persistentvolumes unit tests.
2015-10-12 19:21:48 -04: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
Tim St. Clair 551eff63b8 Use strong type for container ID
Change all references to the container ID in pkg/kubelet/... to the
strong type defined in pkg/kubelet/container: ContainerID

The motivation for this change is to make the format of the ID
unambiguous, specifically whether or not it includes the runtime
prefix (e.g. "docker://").
2015-10-07 10:58:05 -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
Paul Morie 227dd82119 Add PodSecurityContext and backward compatibility tests 2015-10-05 21:05:27 -04:00
Tim St. Clair 52ece0c34e Refactor readiness probing
Each container with a readiness has an individual go-routine which
handles periodic probing for that container. The results are cached, and
written to the status.Manager in the pod sync path.
2015-10-02 15:37:10 -07:00
nikhiljindal b99d225d19 Setting PodReadyCondition.LastTransitionTime 2015-09-29 17:23:32 -07:00
Vishnu kannan 77be271ed0 Linux container manager initialization will now fail if cpu and memory cgroups are not mounted. 2015-09-24 15:34:42 -07:00
Eric Tune de38de0c1a Merge pull request #14064 from brendandburns/flakes
Increase a bunch of timeouts to reduce flakes
2015-09-23 12:56:27 -07:00
Brendan Burns 77fd388485 Increase a bunch of timeouts to reduce flakes 2015-09-23 11:09:03 -07:00
gmarek 66ca7fcc92 Functionally revert #12894 2015-09-23 12:15:38 +02:00
Eric Tune f92da0c714 Merge pull request #14323 from brendandburns/flakes2
Fix a flake in the kubelet test.
2015-09-22 13:36:22 -07:00
Brendan Burns e845c6a4e6 Fix a flake in the kubelet test. 2015-09-21 16:45:21 -07:00
Yu-Ju Hong 077158ef86 Rebase to use unversioned api 2015-09-21 11:14:14 -07:00
Yu-Ju Hong 7bdf9bfdfa Revert "Move and fix nodeManager related unit tests"
This reverts commit 865dc19957.
2015-09-21 10:58:54 -07:00
nikhiljindal 6523ec142b Adding more fields to PodCondition 2015-09-18 05:26:13 -07:00
Daniel Martí 586cb9126a Move pkg/util.Time to pkg/api/unversioned.Time
Along with our time.Duration wrapper, as suggested by @lavalamp.
2015-09-17 17:51:27 -07:00
k8s-merge-robot 7cee028497 Merge pull request #13778 from smarterclayton/unready_endpoints
Auto commit by PR queue bot
2015-09-17 11:36:17 -07:00
Clayton Coleman bf2decce81 Add NotReadyAddresses to Endpoints
In many cases clients may wish to view not ready addresses for endpoints
in order to do set membership prior to a pod being ready. For instance,
a pod that uses the service endpoints to connect to other pods under
the same service, but does not want to signal ready before it has
contacted at least a minimal number of other pods.

This is backwards compatible with old servers and clients. There is
an additional cost in size of endpoints before services ramp up, which
will add minor CPU and memory use for services that have a significant
number of pods which have not become ready.
2015-09-17 09:41:56 -04:00
Yu-Ju Hong 865dc19957 Move and fix nodeManager related unit tests 2015-09-16 17:41:40 -07:00
k8s-merge-robot f6fb0a58b6 Merge pull request #13874 from timstclair/status-manager
Auto commit by PR queue bot
2015-09-16 00:46:01 -07:00
gmarek 4b8ddf3d7e Add information about ports opened by Kubelet to API 2015-09-15 14:24:55 -04:00
k8s-merge-robot 6f01200188 Merge pull request #13727 from jiangyaoguo/fix-reason-reporting-in-kubelet
Auto commit by PR queue bot
2015-09-11 12:32:20 -07:00
Tim St. Clair 1f91fffb57 Move kubelet.statusManager to status.Manager
This refactor is in preparation for moving more state handling to the
status manager. It will become the canonical cache for the latest
information on running containers and probe status, as part of the
prober refactoring.
2015-09-11 12:22:01 -07:00
jiangyaoguo 62c0c35307 Fix reporting reason in kubelet
1. Make reason field of StatusReport objects in kubelet in CamelCase format.
2. Add Message field for ContainerStateWaiting to describe detail about Reason.
3. Make reason field of Events in kubelet in CamelCase format.
4. Update swagger,deep-copy and so on.
2015-09-11 10:01:08 +08: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
Bobby Abbott 9a5f43e16d Kubelet#GetNode now uses GetNodeInfo instead of List
Both GetNode and the cache.ListWatch listfunc in the
kubelet package call List unnecessary.

GetNodeInfo is sufficient for GetNode and makes looping
through a list of nodes to check for a matching name
unnecessary.

resolves #13476
2015-09-10 10:50:41 -07:00
k8s-merge-robot 2e2def36a9 Merge pull request #13581 from caesarxuchao/APIGroup-testapi-2
Auto commit by PR queue bot
2015-09-04 20:38:45 -07:00
Chao Xu 9fc79e9d99 refactor testapi and test scripts to prepare for multiple API groups. 2015-09-04 18:01:32 -07:00
James DeFelice de064f4254 fix kubelet syncLoop busy loop upon close of updates chan 2015-09-04 17:56:02 +00:00
Brendan Burns ac958e5320 Merge pull request #12513 from brendandburns/tc2
integrate bandwidth shaping and the kubelet.
2015-09-02 09:44:10 -07:00
deads2k 7e180c258d update testclient for delegating reaction chain 2015-09-01 12:58:35 -04:00
Brendan Burns 9f3ef68ebc integrate bandwidth shaping and the kubelet. 2015-08-30 22:24:09 -07:00
k8s-merge-robot 4a7115d272 Merge pull request #11955 from pedro-r-marques/flag_resolv_conf
Auto commit by PR queue bot
2015-08-30 21:03:54 -07:00
Yu-Ju Hong 697197d383 Kubelet: do not remove pod directory if any container is still running
If there are any running container in the pod, we cannot remove the volume.
Therefore, we should not attempt to remove the pod directory.
2015-08-27 18:19:13 -07:00
Pedro Roque Marques 99b1da848d Add kubelet '--resolv-conf' flag.
Allow the user to specify the resolver configuration file that is used
to determine the default DNS parameters. This defaults to the system's
/etc/resolv.conf.
2015-08-26 15:41:36 -07:00
Yu-Ju Hong c237ac4c84 Merge pull request #13003 from yujuhong/decouple_workers
kubelet: trigger pod workers independently
2015-08-26 09:53:25 -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
Yu-Ju Hong 3bc2157889 Merge pull request #13100 from pweil-/cap-priv-sources
use privileged source object
2015-08-25 16:10:50 -07:00
Nikhil Jindal 8846c841a8 Merge pull request #12648 from samsabed/crashloop
back off restarts of crashlooping containers
2015-08-24 18:54:13 -07:00
Paul Weil 709e654686 use privileged source object 2015-08-24 16:53:43 -04:00
Sam Abed 995cb15bb6 back off restarts of crashlooping containers
Signed-off-by: Sam Abed <samabed@gmail.com>
2015-08-24 21:43:17 +10:00
Yu-Ju Hong 0c84b837cf kubelet: switch to using pod UID as the key in status manager
We chose to use podFullName (name_namespace) as key in the status manager
because mirror pod and static pod share the same status. This is no longer
needed because we do not store statuses for static pods anymore (we only
store statuses for their mirror pods). Also, reviously, a few fixes were
merged to ensure statuses are cleaned up so that a new pod with the same
name would not resuse an old status.

This change cleans up the code by using UID as key so that the code would
become less brittle.
2015-08-18 14:39:02 -07:00
Kris Rousey ae6c64d9bb Moving everyone to unversioned client 2015-08-18 10:23:03 -07:00
Clayton Coleman 01f3785426 Add status.podIP as a valid downward API target
Getting the public IP a container is supposed to use is O(hard),
and usually involves ugly gyrations in python or with interfaces.
Using the downward API means that the IP Kube is announcing to
other endpoints is also visible inside the container for pods to
identify themselves.
2015-08-14 17:51:55 -04:00
Kris Rousey 565189f5b8 Correcting all go vet errors 2015-08-11 13:55:37 -07:00
Marek Grabowski 5f9cefc1d8 Merge pull request #12441 from vlajos/typofixes-vlajos-20150807
typofix - https://github.com/vlajos/misspell_fixer
2015-08-10 16:33:52 +02:00
Marek Grabowski 8580e17ff1 Merge pull request #12374 from wulonghui/wulonghui-patch-1
Add NodeInternalIP for Node's Addresses when cloud provider is nil
2015-08-10 15:01:00 +02:00
Veres Lajos 9f77e49109 typofix - https://github.com/vlajos/misspell_fixer 2015-08-08 22:31:48 +01:00
Satnam Singh bee48f4ce5 Merge pull request #12035 from AnanyaKumar/requests
Add support for request
2015-08-07 14:27:34 -07:00
wulonghui b50e736184 Add NodeInternalIP for Node's Addresses when cloud provider is nil 2015-08-07 09:08:56 +08:00
Ananya Kumar ef1e576810 Add support for request 2015-08-05 19:00:19 -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
deads2k 182885e897 make testclient more precise 2015-08-04 13:35:59 -04:00
Mike Danese 1b84fb7d74 make testclient threadsafe by guarding internal state with accessors 2015-07-29 16:17:17 -07:00
nikhiljindal 274792d7bb Stop exposing v1beta3 by default 2015-07-01 14:38:02 -07:00
Dawn Chen 6ddfa512de Revert "Revert "Fix the race between configuring cbr0 and restarting static pods""
This reverts commit fd0a95dd12.
2015-06-24 11:10:10 -07:00
Piotr Szczesniak fd0a95dd12 Revert "Fix the race between configuring cbr0 and restarting static pods" 2015-06-24 09:56:49 +02:00
Dawn Chen 23200d303f Fix several issues on running syncPods until network is configured.
Also fixed unittests and compiling.
2015-06-23 12:11:19 -07:00
Abhishek Shah 3556993179 Augmented kubelet healthz with syncLoop check.
Monit uses read-only port for health monitoring.
2015-06-19 18:14:01 -07:00
Yifan Gu 40e46bbb37 kubelet: Remove newTestKubeletWithFakeRuntime() and other depreciated functions.
This cleans up the kubelet tests. Almost no docker specified tests now.
2015-06-19 10:28:27 -07:00
Yifan Gu 91e198cb70 kubelet: Move TestSyncPodWithTerminationLog() to dockertools package.
Update the fakeOptionGenerator to create the pod container directory,
so that fake docker client can see and record the termination log path.
2015-06-19 10:28:27 -07:00
Yifan Gu 6ddffdd736 kubelet: Move TestPortForwardNoSuchContainer() to dockertools package.
Also refactor TestPortForward() to be neutral to container runtime.
2015-06-19 10:28:27 -07:00
Justin Santa Barbara 27b02d0913 Fix kubelet unit test; populate NodeName
When we build a Kubelet directly we need to populate NodeName
as well as hostname, because we bypass the functions that normally
do this for us.
2015-06-18 12:40:55 -07:00
Dawn Chen ca95eb75e9 Configured resource-only container /docker-daemon with 70% of node memory
capacity. This is a workaround to docker memory leakage issue.
2015-06-17 11:40:30 -07:00
Dawn Chen 14f78b74cc Fix the unittests cause by applying oom_score_adj (0) to the user containers. 2015-06-15 16:16:34 -07:00
Abhi Shah 928971cea4 Merge pull request #9710 from mesosphere/public-get-phase
export kubelet.GetPhase
2015-06-12 13:46:35 -07:00
James DeFelice 3cf7739b42 export kubelet.GetPhase 2015-06-12 11:11:53 +00:00
Prashanth Balasubramanian b5ed0e9b13 Dont generatePodStatus twice for new pods 2015-06-11 17:18:16 -07:00
Yifan Gu f197a9db4e kubelet: Minor refactors.
Remove some TODOs.
Unexport DockerManager.Puller and DockerManager.PodInfraContainerImage.
Add "docker" for all "go-dockerclient" imports.
2015-06-04 16:08:45 -07:00
Yu-Ju Hong 64aa958efb Make PodList span multiple lines for readability 2015-06-02 15:03:38 -07:00
Yu-Ju Hong 55f7b9b9b1 Adapt most CommandRunner tests to use FakeRuntime 2015-06-02 15:03:38 -07:00
Yu-Ju Hong b3197bb49b Switch more tests from newTestKubelet to newTestKubeletWithFakeRuntime 2015-06-02 15:03:38 -07:00
Yu-Ju Hong d4034f9c43 Move more docker-specific tests to dockertools/manager_test.go 2015-06-02 15:03:33 -07:00
Filip Grzadkowski 98115facfd Revert "Gracefully delete pods from the Kubelet" 2015-06-02 23:40:05 +02:00
Brian Grant 0a28edf6e7 Merge pull request #8698 from vmarmol/with-limits
Reserve node resources for node services
2015-06-02 13:05:29 -07: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
Victor Marmol 7283e662b5 Introduce SystemContainer to Kubelet ContainerManager.
This generalizes the handling of containers in the
ContainerManager.

Also introduces the ability to determine how much
resources are reserved for those system containers.
2015-05-29 17:32:34 -07:00
Chao Xu 2f6e5e2e08 Update ContainerState.Termination to ContainerState.Terminated in pkg/api/types.go and pkg/api/v1/types.go 2015-05-28 17:18:24 -07:00
Tim Hockin 4318ca5a8b Rename 'portal IP' to 'cluster IP' most everywhere
This covers obvious transforms, but not --portal_net, $PORTAL_NET and
similar.
2015-05-28 16:10:44 -07:00
Tim Hockin 081ab3abac Merge pull request #8853 from caesarxuchao/HostToNodeName
update PodSpec.Host to PodSpec.NodeName
2015-05-28 15:50:12 -07:00
Tim Hockin 3830c068b9 Merge pull request #8883 from yujuhong/kubelet_unittest2
Kubelet: clean up more unit tests
2015-05-28 15:00:02 -07:00
Chao Xu 9c1153322e update PodSpec.Host to PodSpec.NodeName in /pkg/api/types.go and /pkg/api/v1beta3/types.go 2015-05-28 14:10:06 -07:00
Daniel Smith ddcd2c89de remove RO port from kubelet test 2015-05-27 13:46:32 -07:00
Yu-Ju Hong d9339fedbe Modify more tests to use FakeRuntime in kubelet_test.go 2015-05-27 13:01:45 -07:00
Yu-Ju Hong 697312bcd7 Migrate more docker-specific tests to dockertools/manager_test.go 2015-05-27 12:42:59 -07:00
Yu-Ju Hong 044894665d Delete TestSyncPodsDeletes in kubelet_test.go
This test verifies that kubelet doesn't kill non-kubelet-managed containers.
This is obsolete now since container runtime provides only the KillPod
function, and has no support for killing a container.
2015-05-27 10:02:52 -07:00
Yu-Ju Hong ef5bef914f Kubelet: switch cadvisor-related unit tests to use FakeRuntime 2015-05-27 09:58:50 -07:00
Paul Morie 8b338860aa Make kubelet expand var refs in cmd, args, env 2015-05-27 00:13:57 -04:00
Yu-Ju Hong 9a71fb9373 Kubelet: clean up kubelet_test.go
* Start using FakeRuntime to replace FakeDockerClient in unit tests.
 * Move and adapt docker-specific tests (e.g. creating/deleting infra
   containers) to manager_test.go in dockertools.
2015-05-26 17:11:24 -07:00
Robert Bailey 3302628db3 Fix kubelet tests for systems without functional dns to look up localhost. 2015-05-22 14:32:51 -07:00
Dawn Chen 677a4aa1a7 Merge pull request #8164 from cjcullen/cloudprovider
Route creation reconciler loop.
2015-05-22 12:27:50 -07:00
Dawn Chen 017fb6a818 Merge pull request #8575 from yifan-gu/kube_refactor
Minor kubelet/rkt refactors
2015-05-21 09:37:31 -07:00
CJ Cullen bf646abf8d Revert "Revert "Modify nodes to register directly with the master.""
This reverts commit c53786ab31.
2015-05-20 14:21:03 -07:00
Quinton Hoole c53786ab31 Revert "Modify nodes to register directly with the master." 2015-05-20 13:47:51 -07:00
Yifan Gu 6a5681e0fe kubelet: Move HashContainer to kubelet/container package. 2015-05-20 12:08:32 -07:00
Robert Bailey 01467e0bb8 Modify nodes to register directly with the master.
- Delete nodes when they are no longer ready and don't exist in the
cloud provider.
 - Label each node with it's hostname.
 - Add flag to skip node registration.
 - Add a test for registering an existing node.
2015-05-19 09:55:07 -07:00
Brian Grant 2c81050e6f Merge pull request #8457 from davidopp/master
Fix stylistic isues with #5547. Closes #4910.
2015-05-19 07:43:21 -07:00
David Oppenheimer 44b1e1ca0c Fix stylistic isues with #5547. Closes #4910. 2015-05-18 23:32:06 -07:00
Victor Marmol c5da035d51 Merge pull request #8421 from yujuhong/active_deadline
Kubelet: move active deadline check to per pod worker
2015-05-18 17:42:21 -07:00
Yu-Ju Hong 2bf0646c76 Kubelet: do not remove directories of terminated pods
We recently changed `SyncPods` to filter out terminated pods at the beginning
for two reasons:

 * performance: kubelet no longer keeps goroutines to checks containers for
   terminated pods.
 * correctness: kubelet relies on inspecting dead containers to generate
   pod status. Because dead containers may get garbage collected and
   kubelet does not have checkpoints yet, syncing terminated pod could
   lead to modifying the status of a terminated pod.

However, even though kubelet should not *sync* the terminated pods, it
should not attempt to remove the directories and volumes for such
pods as long as they have not been deleted. This change fixes aggresive
directory removal by passing all pods (including terminated pods) to the
cleanup functions.
2015-05-18 13:23:49 -07:00
Victor Marmol 45874d5f76 Merge pull request #5547 from gmarek/client3
Add a resource specifying number of Pods that are allowed to run on Kubelet.
2015-05-18 11:11:43 -07:00
Yu-Ju Hong 050b8ba60b Kubelet: move active deadline check to per pod worker
Per-pod workers have sufficient knowledge to determine whether a pod has
exceeded the active deadline, and they set the status at the end of each sync.
Move the active deadline check to generatePodStatus so that per pod workers
can update the pod status directly. This eliminates the possibility of a race
condition where both SyncPods and the pod worker are updating the status, which
could lead to temporary erratic pod status behavior (pod phase: failed ->
running -> failed).
2015-05-18 10:52:41 -07:00
Yu-Ju Hong 25668ccc11 Kubelet: remove the getPodstatus method
Pod statuses are periodically writtien to the status manager, and status
manager sets the start time of the pod. All non-status-modifying code should
perform cache lookup and should not attempt to generate pod status on its own.
2015-05-18 10:52:36 -07:00
derekwaynecarr 8216332611 Kubelet kills a pod that exceeds ActiveDeadlineSeconds 2015-05-15 16:33:37 -04:00
gmarek 27d660d0ac Add a resource specifying number of Pods that are allowed to run on Kubelet. 2015-05-15 10:57:46 +02:00
Yu-Ju Hong 4b40db3367 Remove /podInfo endpoint on kubelet
Kubelet sends pod status updates to the API server now. This endpoint is no
longer needed.
2015-05-14 17:51:26 -07:00
Victor Marmol 67eab52b9e Merge pull request #8146 from yifan-gu/runtime_opt
kubelet/container: Refactor RunContainerOptions.
2015-05-13 11:09:56 -07:00
Yifan Gu 2617cb26b8 kubelet/container: Add tests for kubelet.makePortMappings(). 2015-05-13 10:01:01 -07:00
Yifan Gu d164ac0ba0 kubelet/container: Refactor RunContainerOptions.
Make Envs, Mounts, PortMappings more generic.
Also add default name for PortMapping if it's not specified.
2015-05-13 10:01:00 -07:00
Brendan Burns 3f49c556e6 Second try at implementing prestop. 2015-05-12 17:17:03 -07:00
Victor Marmol 40ec627cd4 Merge pull request #8108 from rjnagal/kubelet
Handle out of disk situation on kubelet.
2015-05-12 15:49:31 -07:00
Paul Morie 6ac55002d8 Improve kubelet test for env vars 2015-05-12 17:14:32 -04:00
Rohit Jnagal 2cf0dfb79d Handle out of disk situation on kubelets.
Kubelet will stop accepting new pods if it detects low disk space on root fs or fs holding docker images.
Running pods are not affected. low-diskspace-threshold-mb is used to configure the low diskspace threshold.
2015-05-12 18:23:09 +00:00
Victor Marmol 43029345f9 Merge pull request #7973 from dchen1107/podstatus
Add kubectl log --previous support to view last terminated container log
2015-05-11 17:08:45 -07:00
Victor Marmol 1465475401 Merge pull request #8079 from yifan-gu/rm_command_runner
kubelet/container: Move prober.ContainerCommandRunner to container.
2015-05-11 16:05:25 -07:00
Yifan Gu 7831b7da72 kubelet/container: Move prober.ContainerCommandRunner to container.
Also include the ContainerCommandRunner in Runtime interface, but
still keep the ContainerCommandRunner interface for testability.
2015-05-11 15:32:51 -07:00
Dawn Chen 86479cc56c Add support to pull log for last terminated container 2015-05-11 12:54:04 -07:00
Yifan Gu 52af792852 kubelet: Fix racy kubelet tests.
Add fakePodWorkders to run syncPod() in serial for testing.
2015-05-11 12:50:33 -07:00
Deyuan Deng 2f7183cba5 Check Pod privileged container 2015-05-09 17:30:35 -04:00
Yu-Ju Hong d185bfd56a Record failure reason for image pulling 2015-05-08 17:37:11 -07:00
Victor Marmol 35c644a45f Merge pull request #7870 from yifan-gu/rkt_volume
Add volumeGetter to rkt.
2015-05-07 08:58:00 -07:00
Wojciech Tyczynski e26da316dc Set NodeReady=False when docker is dead 2015-05-07 09:30:25 +02:00
Yifan Gu 8715c54bd3 kubelet/container: Move kubelet.volumeMap to container.VolumeMap.
This is a quick fix to solve circular dependency problem when
rkt references volume maps.
2015-05-06 16:50:57 -07:00
Paul Morie e949a623ff Change EnvVarSource.FieldPath -> FieldRef and add example 2015-05-04 18:41:09 -04:00
Yu-Ju Hong 1ad4dd7803 Kubelet: replace DockerManager with the Runtime interface
This change instructs kubelet to switch to using the Runtime interface. In order
to do it, the change moves the Prober instantiation to DockerManager.

Note that most of the tests in kubelet_test.go needs to be migrated to
dockertools. For now, we use type assertion to convert the Runtime interface to
DockerManager in most tests.
2015-05-04 10:19:46 -07: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
Victor Marmol 3b9eba2c1b Add SyncPod() to DockerManager and use in Kubelet.
This allows us to abstract away the logic of syncing a pod by the
runtime. It will allow other runtimes to perform their own sync as well.
2015-05-01 11:03:08 -07:00
Yu-Ju Hong b37f23f1eb Add KillContainerInPod in DockerManager
This changes adds one of the functions that DockerManager needs to implement
the Runtime interface.
2015-04-30 16:23:39 -07:00