Commit Graph

779 Commits (109c3f2b056a682a93fb1ab0f8c44d49302843ec)

Author SHA1 Message Date
Yu-Ju Hong ba1140a54f Merge pull request #7480 from vmarmol/runtime-syncpod
Move ComputePodChanges to the Docker runtime
2015-04-29 16:05:20 -07:00
Victor Marmol 209b4fcbef Merge pull request #6718 from vishh/sys_oom1
Adding system oom events from kubelet
2015-04-29 14:29:38 -07:00
Victor Marmol fe4600ba17 Move ComputePodChanges to DockerManager.
This logic is specific to the Docker runtime. This move is the first
step towards making syncPod() runtime-agnostic.
2015-04-29 14:00:37 -07:00
Vishnu Kannan 020950fd0f Adding events for system ooms.
Kubelet will continuously watch for system OOMs and generate events whenever it
encounters a system OOM.
2015-04-29 11:19:11 -07:00
Victor Marmol f38c607285 Move Prober to its own subpackage.
This will allow it to be reused by the runtimes.
2015-04-29 10:11:28 -07:00
Yu-Ju Hong 33b8f487f6 Merge pull request #7449 from vmarmol/runtime-network-plugins
Move network plugin TearDown to DockerManager
2015-04-29 10:09:58 -07:00
Victor Marmol 02231ea75d Merge pull request #7503 from jsafrane/devel/fix-volume-rm
Fixed kubelet deleting data from volumes on stop (#7317).
2015-04-29 10:01:16 -07:00
Jan Safranek 9b9e98a22f Fixed kubelet deleting data from volumes on stop (#7317).
We must not clear the pod directory in killUnwantedPods(), volumes are still
mounted there at this time. There already is cleanupOrphanedPodDirs(),
called later in the SyncPods() sequence, which should remove these pod
directories.
2015-04-29 10:41:19 +02:00
Yifan Gu fb1c55aa11 kubelet/container: Add GetContainerLogs to runtime interface. 2015-04-28 20:26:16 -07:00
Victor Marmol 787d42d50b Move network plugin teardown to DockerManager.
This teardown is Docker-specific and will let us also do the setup in
the manager in future cleanups.
2015-04-28 16:58:54 -07:00
Victor Marmol de0957ccb1 Create Kubelet types package for common shared types. 2015-04-28 16:57:45 -07:00
Vishnu Kannan 820d0f3e83 Adding a 'PastEventf' method to EventRecorder interface. This will be
useful for recording the timestamp of events that happened in the past.
2015-04-28 16:13:29 -07:00
Dawn Chen af5d017911 Merge pull request #7386 from vmarmol/rkt-pull-image
Kubelet: Factor out and remove pullImageAndRunContainer
2015-04-28 09:28:16 -07:00
Dawn Chen 1de4c45115 Merge pull request #7401 from vmarmol/rkt-kill-pod
Kubelet: Move killPod() logic to DockerManager's KillPod()
2015-04-28 09:25:12 -07:00
Victor Marmol 6b0db76e85 Move killPod() logic to DockerManager KillPod().
This moved Docker specific logic there and allows it to align with the
runtime API. There is still a pod infra container reference in the
function due to network plugins. We can handle this in the Kubelet since
we'll need to be explicit in stating that the network plugin will not
work in a non-Docker runtime.
2015-04-27 17:15:37 -07:00
Victor Marmol 42a2059a5d Remove DockerPrefix references in Kubelet.
Makes this usage generic and usable by other runtimes.
2015-04-27 15:55:13 -07:00
Victor Marmol 3082bb291c Remove pullImageAndRunContainer().
Relevant logic is now in shared helpers.
2015-04-27 15:13:11 -07:00
Victor Marmol b232eef5f7 Move image PullPolicy logic to pullImage().
This will allow us to remove the Docker-specific logic in
pullImageAndRunContainer() and re-use pullImage() in other runtimes.
2015-04-27 15:13:11 -07:00
Dawn Chen aa487b7cab Merge pull request #7382 from vmarmol/rkt-deps
Move Docker-specific log handling to DockerManager.
2015-04-27 15:10:14 -07:00
Victor Marmol 7404b7019c Move Docker-specific log handling to DockerManager.
Eases the separation of Docker-specific code into the Docker-specific
runtime.
2015-04-27 13:10:10 -07:00
Brian Grant 2648ae86d6 Merge pull request #6739 from pmorie/downward-api
Env var sources / downward API
2015-04-27 12:46:00 -07:00
Paul Morie 7d30f09ebf Add downward API for environment vars 2015-04-27 14:13:11 -04:00
Victor Marmol 0c52f7b6a5 Move CreatePodInfraContainer to DockerManager.
This will allow us to start making it an implementation detail of the
Docker runtime.
2015-04-27 11:07:38 -07:00
Yifan Gu 6c98b9daee kubelet/metrics: Move instrumented_docker.go to dockertools.
This can solve the circular import problem when we move the
kubelet.pullImage to kubelet/metrics or kubelet/container package.
2015-04-24 22:03:11 -07:00
Yu-Ju Hong b0e6926f67 kubelet: filter out terminated pods in SyncPods
Once a pod reaches a terminated state (whether failed or succeeded), it should
not transit out ever again. Currently, kubelet relies on examining the dead
containers to verify that the container has already been run. This is fine
in most cases, but if the dead containers were garbage collected, kubelet may
falsely concluded that the pod has never been run. It would then try to restart
all the containers.

This change eliminates most of such possibilities by pre-filtering out the pods
in the final states before sending updates to per-pod workers.
2015-04-24 15:28:03 -07:00
Yifan Gu b5a1b32aa4 kubelet/dockertools: Move RunContainer into container runtime.
Also removed ContainerRunner interface.
2015-04-23 16:40:37 -07:00
Yifan Gu 6ed27d06f7 kubelet: Move KillContainer to container runtime.
Rename KillContainerID(string) with KillContainer(string).
Delete the old KillContainer(*kubecontainer.Container).
2015-04-23 15:44:00 -07:00
David Oppenheimer 8667ebddff Merge pull request #7249 from yifan-gu/generator
kubelet/container: Introduce RunContainerOptionsGenerator.
2015-04-23 14:59:23 -07:00
Dawn Chen 6207c518b3 Merge pull request #7254 from yifan-gu/readiness
kubelet/dockertools: Add readinessManage/containerRefManager to dockerManager.
2015-04-23 14:34:43 -07:00
Yifan Gu e8d485a3a1 kubelet/dockertools: Add readinessManage/containerRefManager to dockerManager.
This can enable us to move KillContainer() to container runtime.
2015-04-23 14:20:34 -07:00
Yifan Gu bd7132bc07 kubelet/container: Introduce RunContainerOptionsGenerator.
This interface wraps the kubelet to provide the options for
container runtime to run a container.
2015-04-23 13:55:50 -07:00
Dawn Chen f7831dcd93 Merge pull request #7229 from vmarmol/stats
Kubelet: Add /stats/container endpoint for raw containers
2015-04-23 13:43:23 -07:00
Victor Marmol c29d328c55 Kubelet: Add /stats/container endpoint.
This endpoint exposes container stats for all raw containers on the
machine. The addition is backwards compatible.
2015-04-23 10:38:29 -07:00
Yifan Gu af1e9f737f kubelet: Introduce volume manager.
The volume manager book-keeps the information for the volume mounts
on the kubelet, so we can avoid passing the volumeMap around.
2015-04-23 10:37:02 -07:00
Satnam Singh 2444c1f943 Propagate pod and container name for log files 2015-04-22 15:08:51 -07:00
Victor Marmol 45575d95b3 Merge pull request #7177 from yifan-gu/runner
kubelet/dockertools: Remove dockerContainerCommandRunner.
2015-04-22 13:24:50 -07:00
Yifan Gu f59013410a kubelet/container: Move Prober/HandlerRunner interface to container/helpers.go
This enables us to pass them to container runtime as parameters.
2015-04-22 11:56:15 -07:00
Yifan Gu c55c879ffe kubelet/dockertools: Remove dockerContainerCommandRunner.
Replace with docker manager.
2015-04-22 11:00:54 -07:00
Victor Marmol 914a6febfb Merge pull request #7010 from yifan-gu/compute
kubelet: Refactor computePodContainerChanges().
2015-04-22 08:05:18 -07:00
Brian Grant 8dbbf3da5c Merge pull request #7138 from pravisankar/unschedulable-event
Record an event on node schedulable changes
2015-04-22 07:11:14 -07:00
Yifan Gu 611fb25926 kubelet: Refactor GetDockerVersion().
Remove GetDockerServerVersion() from DockerContainerCommandRunner interface,
replaced with runtime.Version(). Also added Version type in runtime for version
comparision.
2015-04-21 14:52:08 -07:00
Ravi Sankar Penta f1d88f6d2f Record an event on node schedulable changes 2015-04-21 14:14:59 -07:00
Yifan Gu 5594981340 kubelet: Refactor computePodContainerChanges().
Pull generatePodStatus() and makePodDataDirs() out as they are the
common part for container runtimes.
2015-04-21 13:53:20 -07:00
Victor Marmol 4b9a64bcd8 Merge pull request #7098 from yifan-gu/handler
kubelet: Refactor runHandler().
2015-04-21 08:14:42 -07:00
Yifan Gu c23b83b0ca kubelet: Refactor runHandler().
Use new HandlerRunner type to replace runHandler()
2015-04-20 21:31:11 -07:00
Daniel Smith 462534ca5d Merge pull request #7068 from krousey/api_pod_pointer
Changing  a few more instances of api.Pod to *api.Pod
2015-04-20 17:09:28 -07:00
Kris Rousey 594f514843 Changing a few remaining instances of passing pods around by value. I
avoided changing api.PodList.Items to []*api.Pod.
2015-04-20 15:26:45 -07:00
Victor Marmol d44e9b4880 Merge pull request #7048 from yujuhong/para_cleanup
Kubelet: parallelize cleaning up containers in unwanted pods
2015-04-20 14:59:07 -07:00
Yu-Ju Hong 275002173e Kubelet: parallelize cleaning up containers in unwanted pods
Kubelet kills unwanted pods in SyncPods, which directly impact the latency of a
sync iteration. This change parallelizes the cleanup to lessen the effect.

Eventually, we should leverage per-pod workers for cleanup, with the exception
of truly orphaned pods.
2015-04-20 14:42:12 -07:00
Brendan Burns 01b891770f Merge pull request #7054 from ncdc/dockerclient-version
Use go-dockerclient's APIVersion
2015-04-20 14:20:57 -07:00
Andy Goldstein a0a80ea76e Use go-dockerclient's APIVersion
Use go-dockerclient's APIVersion to check the minimum required Docker
version, as it contains methods for parsing the ApiVersion response from
the Docker daemon and for comparing 2 APIVersion objects.
2015-04-20 13:48:18 -04:00
Yu-Ju Hong cd61aa9484 Merge pull request #7009 from yifan-gu/kube_dep
kubelet: Refactor prober.
2015-04-20 10:23:04 -07:00
Clayton Coleman 9e87924983 Tone down kubelet logs for already run containers 2015-04-19 22:55:38 -04:00
Yifan Gu 1d58992df7 kubelet: Refactor prober.
Decompose the health check prober from the kubelet.
2015-04-17 15:54:28 -07:00
Yu-Ju Hong 1f3e47f6f7 Merge pull request #7005 from yifan-gu/kube_dep
kubelet: Refactor shouldContainerBeRestarted():
2015-04-17 15:05:41 -07:00
Yifan Gu 29a5da231d kubelet: Refactor shouldContainerBeRestarted():
Remove the function's dependency on kubelet.
2015-04-17 14:35:39 -07:00
Kris Rousey 81497f3ed2 Changing the scheduler package to use *api.Pod instead of api.Pod to
avoid unnecessary shallow copies. The change rippled through a lot of
code.
2015-04-17 13:34:31 -07:00
Yu-Ju Hong 13b29cd64b Merge pull request #6595 from guenter/kubelet-update-channel-closed
kubelet syncloop should stop if/when updates chan closes
2015-04-17 10:42:05 -07:00
Victor Marmol abab9ea31f Merge pull request #6844 from yifan-gu/cleankube
kubelet: Clean up computePodContainerChanges.
2015-04-15 13:53:21 -07:00
Yifan Gu 3b28c6262b kubelet: Clean up computePodContainerChanges.
More `continue`, less `else` to make it less indent and more readable.
2015-04-15 10:13:57 -07:00
Victor Marmol fb3c351fe1 Run Kubelet on "/kubelet" container. 2015-04-14 10:29:05 -07:00
Victor Marmol ca9e209ccb Merge pull request #6795 from yifan-gu/cache
kubelet/container: Replace DockerCache with RuntimeCache.
2015-04-14 09:37:34 -07:00
Dawn Chen 8420abeea8 Merge pull request #6786 from yifan-gu/cleankube
kubelet: Remove unused docker functions.
2015-04-14 09:16:53 -07:00
Victor Marmol e265f2c58d Merge pull request #6799 from xiang90/kerr
pkg/kubelet: fix error msg in GetHostIP
2015-04-14 08:40:34 -07:00
Xiang Li 4a152290f4 pkg/kubelet: fix error msg in GetHostIP 2015-04-13 22:44:23 -07:00
Yifan Gu e1feed9a8b kubelet/container: Replace DockerCache with RuntimeCache. 2015-04-13 18:16:05 -07:00
Yifan Gu 7fedb14c27 kubelet: Remove unused docker functions.
Remove kubelet.getPodInfraContainer().
Remove dockertools.RemoveContainerWithID().
Remove dockertools.FindContainersByPod().

Also replace the useless test with a test for GetPods().
2015-04-13 16:32:18 -07:00
Yifan Gu d14cb8f1dd kubelet: Introduce PodInfraContainerChanged().
This functions computes in ahead whether we need to restart the pod
infra container.
2015-04-13 16:18:52 -07:00
Yifan Gu dda600e45c kubelet/dockertools: Add puller interfaces in the containerManager. 2015-04-13 15:34:22 -07:00
Yifan Gu a3675e08f2 kubelet/dockertool: Move Getpods() to DockerManager. 2015-04-13 14:05:22 -07:00
Xiang Li cef744ecaa pkg/kubelet: move the capabilities related code to util.go 2015-04-11 12:09:11 -07:00
Tobi Knaup 3932dfd8bb Log an error when update channel is closed. 2015-04-10 17:30:04 -07:00
Dawn Chen fff6cebb5f Merge pull request #6711 from yujuhong/container_status
Kubelet: surface the container creation/start failure reason
2015-04-10 17:19:32 -07:00
Yu-Ju Hong bb417e82d7 Kubelet: surface the container creation/start failure reason
Container creation/start failure cannot be reproduced by inspecting the
containers. This change caches such errors so that kubelet can retrieve it
later.

This change also extends FakeDockerClient to support setting error response
for a specific function.
2015-04-10 16:02:27 -07:00
Daniel Smith e2093798cb Merge pull request #6675 from wojtek-t/nodes_support_field_selector
FieldSelector for node List()
2015-04-10 10:30:55 -07:00
Victor Marmol 1563a7636a Merge pull request #6652 from dchen1107/podstatus
Populate last terminated container information
2015-04-10 09:21:58 -07:00
Wojciech Tyczynski 88eb0b0295 FieldSelector for node List() 2015-04-10 12:53:16 +02:00
Dawn Chen 563f2965ba Populate last terminated container information 2015-04-09 16:10:13 -07:00
Daniel Smith 629d94657e Merge pull request #6624 from gmarek/status_to_subresource
Update NodeStatus use subresources.
2015-04-09 16:00:15 -07:00
Victor Marmol 40acaef454 Merge pull request #6607 from yujuhong/mirror_update
Kubelet: recreate mirror pod if the static pod changes
2015-04-09 10:29:55 -07:00
Yifan Gu b868f421e0 kubelet: Move pod infra container image setting to dockertools. 2015-04-09 09:53:07 -07:00
gmarek ccc56d3c3c Update NodeStatus use subresources. 2015-04-09 14:07:40 +02:00
Yu-Ju Hong d7cf294c99 Kubelet: recreate mirror pod if the static pod changes
If a static pod changes, delete the corresponding mirror pod. When kubelet
could not see mirror pod from the API server update, it'd attemp to create a
new mirror pod with up-to-date specs.
2015-04-08 18:06:21 -07:00
Vish Kannan 43949b41d4 Merge pull request #6586 from dchen1107/podstatus
small cleanup by removing useless generatePodStatus
2015-04-08 14:59:23 -07:00
Tobi Knaup 3efff6d4e8 kubelet syncloop should stop if/when updates chan closes 2015-04-08 14:45:16 -07:00
Dawn Chen 914616a195 Merge pull request #6592 from vishh/kubelet_logging
Improve kubelet logging around startup.
2015-04-08 14:35:53 -07:00
David Oppenheimer 4ffc2aad21 Merge pull request #6146 from kazegusuri/node_client_label
List in NodesInterface takes label selector
2015-04-08 14:22:53 -07:00
Vishnu Kannan 2b5cad6acf Improve kubelet logging around startup. This might help detect any lockup issues during startup. 2015-04-08 21:02:15 +00:00
Dawn Chen b6d846aea5 small cleanup by removing useless generatePodStatus 2015-04-08 13:38:06 -07:00
Yifan Gu 4b945e7218 kubelet: Remove GetRecentDockerContainersWithNameAndUUID().
Add unit tests to test the restart behaviour under different
restart policy.
2015-04-08 09:44:23 -07:00
Yifan Gu ddf323ee00 kubelet: Remove GetRecentDockerContainersWithNameAndUUID().
Always call GetPodStatus().
2015-04-08 09:44:23 -07:00
Yifan Gu 6103b144e0 kubelet: Remove GetRecentDockerContainersWithNameAndUUID().
Use the pod status to get the recent stopped containers in
shouldContainerBeRestarted().
2015-04-08 09:44:23 -07:00
Masahiro Sano d04cc5ced4 List in NodesInterface takes label selector 2015-04-08 23:41:27 +09:00
gmarek 72182735b9 Remove Node Controllers ability to pull status from Kubelet 2015-04-08 09:44:42 +02:00
Daniel Smith c1390a0836 version field selector field names in the client 2015-04-07 16:59:57 -07:00
Quinton Hoole c670071e87 Revert "kubelet: Remove GetRecentDockerContainersWithNameAndUUID." 2015-04-07 14:25:10 -07:00
David Oppenheimer 402bf60366 Merge pull request #6214 from gmarek/move_consts_to_flags
Move NodeController constants to flags
2015-04-07 11:31:11 -07:00
gmarek 321a81047c Move NodeController constants to flags 2015-04-07 12:33:03 +02:00
Yifan Gu ba1ad9fad2 kubelet: Refactor RunInContainer/ExecInContainer/PortForward.
Replace GetKubeletDockerContainers() with findContainer().
2015-04-06 17:14:46 -07:00
Victor Marmol 7716804a0d Merge pull request #6470 from yifan-gu/get_recent
kubelet: Remove GetRecentDockerContainersWithNameAndUUID.
2015-04-06 14:25:59 -07:00
Yifan Gu a8c02412b2 kubelet: Remove GetRecentDockerContainersWithNameAndUUID().
Use the pod status to get the recent stopped containers in
shouldContainerBeRestarted().
2015-04-06 12:43:49 -07:00
James DeFelice d194af6b4f allow for more easily customized kubelet creation and initialization 2015-04-06 18:51:42 +00:00
Yu-Ju Hong 0e1bd18b3e Fix the kubelet node watch 2015-04-04 09:59:39 -07:00
Dawn Chen 67c1678e7e Merge pull request #6378 from yujuhong/docker_manager
RFC: Kubelet: a step towards to better encapsulation of docker functions
2015-04-02 14:22:26 -07:00
Yu-Ju Hong d01bc660b5 Kubelet: a step towards to better encapsulation of docker functions
We want to stop leaking more docker details into kubelet, and we also want to
consolidate some of the existing docker interfaces/structs. This change creates
DockerManager as the new home of some functions in dockertools/docker.go. It
also absorbs containerRunner. In addition, GetDockerPodStatus is renamed to
GetPodStatus with the entire pod passed to it so that it is simialr to the what
is defined in the container Runtime interface.

Eventually, DockerManager should implement the container Runtime interface, and
integrate DockerCache with a flag to turn on/off caching. Code in kubelet.go
should not be using docker client directly.
2015-04-02 13:26:39 -07:00
Brian Grant 414be101b6 Merge pull request #6352 from piosz/api
Removed PodStatus.Host
2015-04-02 13:16:24 -07:00
Wojciech Tyczynski 6b08958264 Kubelet watching only its own Node 2015-04-02 18:39:59 +02:00
Piotr Szczesniak 5c6439d449 Removed PodStatus.Host
Fixes #6165
2015-04-02 16:38:45 +02:00
Dawn Chen db28ca67f6 Using gcr.io/google_containers/pause by default 2015-04-01 14:59:44 -07:00
Kris Rousey 6904c4d585 Fixing a lot of string formatting issues with regards to:
* Improper format specifier (e.g. %s for bools or %s for ints)
  * More or less parameters than format specifiers
  * Not calling a formatting function when it should have (e.g. Error() instead of Errorf())
2015-03-31 16:47:10 -07:00
Victor Marmol 9bbf0b1546 Merge pull request #6100 from pmorie/entrypoint
Add control over container entrypoint
2015-03-31 09:58:40 -07:00
Victor Marmol d6d370d8ae Merge pull request #6211 from dchen1107/docker
publish node components version information
2015-03-31 09:47:08 -07:00
Dawn Chen 5b9a6d47e8 publish node components version information 2015-03-31 09:32:29 -07:00
Paul Morie 7628b37d78 Add control over container entrypoint 2015-03-31 12:32:03 -04:00
Victor Marmol de35c8f2af Record event when image GC fails. 2015-03-30 10:32:51 -07:00
Federico Simoncelli 0e60374346 nodes: record an event on NodeReady changes
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2015-03-30 12:01:09 -04:00
Federico Simoncelli fe2d1f6762 node: move the reboot detection logic to kubelet
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2015-03-30 09:33:07 -04:00
Federico Simoncelli 604e0ad328 kubelet: move getNodeReference logic into a function
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2015-03-30 09:33:00 -04:00
Yu-Ju Hong 372c5c9f3a Kubelet: set host field in the pending pod status
Otherwise, the apiserver would reject the update.
2015-03-27 17:26:47 -07:00
Victor Marmol e4fc45c26f Merge pull request #6054 from fgrzadkowski/fix_pod_status
Do not fail pod status update if failed to get host IP
2015-03-27 09:10:44 -07:00
Victor Marmol 4ed3346587 Merge pull request #6039 from yifan-gu/readiness
kubelet: Add container readiness manager.
2015-03-27 09:04:00 -07:00
Filip Grzadkowski fe2f7f25c6 Do not fail if failed to get host IP 2015-03-27 14:15:41 +01:00
Yifan Gu 6fecda710c kubelet: Add container readiness manager.
Move the readiness managing logic into pkg/kubelet/container package
to facilitate the pluggable container runtime.
2015-03-26 18:45:23 -07:00
Vish Kannan f2c7dda6da Merge pull request #6026 from dchen1107/clean
kubectl describe nodes id reports related events
2015-03-26 17:39:21 -07:00
Dawn Chen f662d7d11c Kubelet reports node related events with empty namespace for now. 2015-03-26 16:30:23 -07:00
Yifan Gu 5f08555f45 kubelet: Refactor kubelet.runContainer.
Push the run container logic into container runtime.
2015-03-26 13:43:45 -07:00
Victor Marmol 1cad0df268 Merge pull request #6004 from yifan-gu/ref_manager
kubelet: Move container reference manager to pkg/kubelet/container.
2015-03-26 13:04:34 -07:00
Brian Grant 3b0db99692 Merge pull request #5915 from piosz/api
Changed PodInfo to be a list
2015-03-26 12:46:50 -07:00
Yifan Gu 9f62b929b8 kubelet: Move container reference manager to pkg/kubelet/container.
This enables other package to use it, such as docktools.
2015-03-26 11:53:44 -07:00
Victor Marmol a59e5f8995 Refactor pod killing to be done in a single killPod(). 2015-03-26 11:25:48 -07:00
Victor Marmol 106cc037ee Merge pull request #5995 from ArtfulCoder/pause_no_port_forward_for_net_host
Kill running Pod running with -net=true if kubelet does not allow it
2015-03-26 11:03:58 -07:00
Victor Marmol d2ea1a793b Merge pull request #5982 from yifan-gu/ref_manager
kubelet: Add container reference manager.
2015-03-26 10:20:13 -07:00
Abhishek Shah 5c42070eeb Kill running Pod running with -net=true if kubelet does not allow it 2015-03-26 10:13:06 -07:00
Yifan Gu a06bc96414 kubelet: Add container reference manager.
Move the reference managing logic into container reference manager.
This enables pluggable container runtime to manage the container references.
2015-03-26 09:50:54 -07:00
gmarek 5a11748018 Move Capacity from NodeSpec to NodeStatus 2015-03-26 15:28:48 +01:00
Piotr Szczesniak 31901ed9d0 Changed PodInfo to be a list
This change is to make API consistent with our convention.

Fixes #3622
2015-03-26 10:15:25 +01:00
Abhishek Shah cd5ed38250 Stop port forwarding from pause in net=host mode 2015-03-25 17:55:37 -07:00
Federico Simoncelli afbf401464 nodeinfo: add boot id system information
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2015-03-25 15:06:53 -04:00
Victor Marmol cf7e2756b5 Add HostNetworkSources capability to limit use of HostNetwork. 2015-03-25 11:23:06 -07:00
Victor Marmol d9cd7a78f7 Allow starting a container with --net=host. 2015-03-25 11:22:03 -07:00
Victor Marmol 5eb373692b Merge pull request #5928 from yujuhong/pod_status
Kubelet: pass the acutal pod for status update
2015-03-25 10:51:32 -07:00
Victor Marmol f7135b3dd4 Merge pull request #5827 from spothanis/master
added cloud provider flag to kubelet
2015-03-25 10:50:18 -07:00
Yu-Ju Hong b4b0bc75c4 Kubelet: pass the acutal pod for status update
Pod status update should include the ObjectMeta of the pod. This change is
required for #5738 to merge.
2015-03-25 09:58:46 -07:00
Filip Grzadkowski 74da3b14b0 Delete pod_cache and rely on updating pod status by kublet. 2015-03-25 15:08:09 +01:00
Sreekanth Pothanis 1c06cde4c4 added cloud provider flag to kubelet
This is to fix issue #5667
2015-03-24 19:32:50 -07:00
Yifan Gu 31bb11ac2a kubelet: Move pod name helpers to pkg/kubelet/container/runtime.go 2015-03-24 16:08:04 -07:00
Yifan Gu 13250c904f kubelet: Replace GetKubeletDockerContainers with GetPods in syncPod/SyncPods. 2015-03-24 16:01:38 -07:00
David Oppenheimer 30c3583900 Merge pull request #5806 from ddysher/condition-rename
Rename ConditionFull->ConditionTrue, ConditionNone->ConditionFalse
2015-03-24 15:50:11 -07:00
Victor Marmol 270c850b3b Merge pull request #5826 from yujuhong/pod_manager
Kubelet: refactor pod manager
2015-03-24 15:33:54 -07:00
Yu-Ju Hong 08e4a883b6 Kubelet: refactor pod manager
This change cleans up the pod manager extensively so that
 * Mirror pods are actually stored in the pod manager.
 * Both (non-mirror) pods and mirror pods are indexed by UID and full name for
   easy lookup and mapping. This is required for the next change to send
   full pod along with the pod status update.

This change also renames mirrorManager as mirrorClient since it is merely a
client to contact the API server and create/delete mirror pods.
2015-03-24 15:10:26 -07:00
Deyuan Deng ca68f4a9d1 Rename ConditionFull->ConditionTrue, ConditionNone->ConditionFalse 2015-03-24 17:28:59 -04:00
David Oppenheimer c1730989cb Merge pull request #5870 from dchen1107/podstatus
Fix a bug of running node selector predicate on kubelet introduced by #5...
2015-03-24 14:05:27 -07:00
Dawn Chen e2e1d9e943 Fix a bug of running node selector predicate on kubelet introduced by #5715.
part of #5207, and fixed #5810
2015-03-24 13:13:25 -07:00
Deyuan Deng c5675b8924 Use fake time in nodecontroller unittest; rename receiver 's' to 'nc' 2015-03-24 14:23:48 -04:00
Deyuan Deng b51d491f05 Delete all pods based on condition transition time. 2015-03-24 14:23:48 -04:00
Deyuan Deng cf548765c9 Change kubelet update frequency to 2s, and make it a constant. 2015-03-24 14:23:48 -04:00
Filip Grzadkowski 632ca506ce * Update pod status only when it changes.
* Refactor syncing logic into a separate struct
2015-03-24 16:41:00 +01:00
Victor Marmol 07f928be64 Cap container hostname length to 63 chars.
Fixes #5829.
2015-03-23 19:36:45 -07:00
Yu-Ju Hong f440989017 Kubelet: add podManager for managing internal pod storage
This change moves pod array and mirrorPods into podManager, along with all
methods accessing these internal pod storages. This is the first step of the
refactoring, and no function change is involved.
2015-03-23 15:11:10 -07:00
Saad Ali e8f70428fb Merge pull request #5715 from jszczepkowski/kubelet-nodesel
Running node selector predicate on kubelet.
2015-03-23 11:06:00 -07:00
Jerzy Szczepkowski 34a8a3a844 Running node selector predicate on kubelet.
Added checking on kubelet if scheduled pods have matching node selector. This is the last step to fix #5207.
2015-03-23 08:21:58 +01:00
Nataliia Uvarova 73c2338320 Refactor build/parse dockername. #3511
Functions Build/ParseDockerName now work with struct instead of the long
list of arguments. This new struct also was reused in the kubelet.go
instead of auxilary podContainer struct.
2015-03-21 09:09:03 +01:00
Yu-Ju Hong 15e9760bd4 Kubelet: support retrieving stats using UID of mirror pod
Kubelet supports retrieving stats for pods/containers with and without UID.
This does not always work for the static pods because users may get the UIDs of
the mirror pods from the API server, and use them to query Kubelet. In this
case, Kubelet would fail to locate the containers due to mismatched UIDs.

This change adds a intenral mirror to static pod UID mapping and teaches all
public-facing functions to perform UID lookup before proceeding. This allows
users to use either mirror or static pod's UID to retrieve stats.
2015-03-20 15:40:49 -07:00
Vish Kannan f118ca8fb4 Merge pull request #5642 from thockin/volume_multi_plugins
Prep for multiple kinds of volume plugins
2015-03-20 15:12:30 -07:00
Tim Hockin bfadae77e0 Promote volume plugins, prep for persistent vols
Move pkg/kubelet/volume/... to pkg/volume/...
Some renames to make the soon-to-come persistent volumes work clearer.
2015-03-20 13:49:40 -07:00
Abhishek Gupta b0c23c1046 Headless Services: Adding option to specify None for PortalIP 2015-03-20 12:10:03 -07:00
Clayton Coleman 84ab8f7254 Reduce probe logging level
Too chatty for normal operation
2015-03-19 23:06:21 -04:00
Yu-Ju Hong 0d0fb5f07b Kubelet: per-pod workers should avoid grabbing the pod array lock
Per-pod worker syncs the pod and container status, and write the pod status in
the pod status cache. Given that it already owns a copy of the pod, it can
bypass the additional pod lookup step completely. This change adds a new
generatePodStatusByPod() method to achieve this. In general, per-pod worker
should avoid accessing the internal pod array completely, as this would may
lead to high contention.

This change also changes the return type of GetPodByFullName to reflect the
name, and consolidates GetPodByFullName() and GetPodByName().
2015-03-19 18:25:41 -07:00
CJ Cullen 7ddcecfd1c Revert "Revert "[WIP] southbound networking hooks in kubelet"" 2015-03-19 16:14:13 -07:00
Zach Loafman b5d1e538df Revert "[WIP] southbound networking hooks in kubelet" 2015-03-19 16:08:08 -07:00
Rajat Chopra 7857aa7751 kubelet networking plugin 2015-03-19 14:15:52 -07:00
Jerzy Szczepkowski c0ff504ad3 Merge pull request #5501 from jszczepkowski/kubelet-spechost
Running resource predicate on kubelet.
2015-03-19 21:34:27 +01:00
Dawn Chen 4910be6dcb Remove PodIP from ContainerStatus 2015-03-19 10:42:01 -07:00
Jerzy Szczepkowski 5845f6ad48 Running resource predicate on kubelet.
Added checking on kubelet if scheduled pods do not exceed resources. Related to #5207.
2015-03-19 10:40:10 +01:00
Dawn Chen 52e1ee9d5b Merge pull request #5619 from vmarmol/rate
Spread out pod status updates to apiserver.
2015-03-18 17:26:02 -07:00
Victor Marmol cda4b6c598 Spread out pod status updates to apiserver.
Lowers pod status interval to every 2m and spreads updates within that
time window.
2015-03-18 15:43:07 -07:00
Yifan Gu 027f6854d0 kubelet: Remove docker container in prober's interface
Also change
kubelet.docketIDToRef[dockertools.DockerID]*api.ObjectReference{} to
kubelet.containerIDToRef[string]*api.ObjectReference{}.
2015-03-18 14:28:27 -07:00
Yu-Ju Hong 6e8a8b741a Kubelet: simplify the lock acquring pattern
Avoid holding both podStatusesLock and podLock at the same time.
2015-03-18 11:45:29 -07:00
Victor Marmol 9586b39bb7 Merge pull request #5555 from fgrzadkowski/sync_pod_status
Periodically update pod status from kubelet.
2015-03-18 10:14:07 -07:00
Dawn Chen 9e781bc57d Merge pull request #5569 from vmarmol/image-gc
Garbage collecting images in the Kubelet.
2015-03-18 08:55:08 -07:00
Filip Grzadkowski 1a352b74ba Periodically update pod status from kubelet. 2015-03-18 12:11:39 +01:00
Victor Marmol d78ecf820e Garbage collecting images in the Kubelet.
Integrated the imageManager into the Kubelet and applies the garbage
collection policy every 5 minutes. The default policy allows up to 90%
disk usage, after which images are garbage collected to bring limit back
down to 80%.

Fixes #157.
2015-03-17 17:56:02 -07:00
Yu-Ju Hong b84de4e986 Merge pull request #5571 from vmarmol/fix
Adding errors to Kubelet events.
2015-03-17 16:14:58 -07:00
Dawn Chen cbe4a1a679 Merge pull request #5510 from vmarmol/gc
Introduce and implement container GC policy
2015-03-17 16:02:17 -07:00
Victor Marmol 0c664a343c Adding errors to Kubelet events.
This will help while debugging issues that generate events.

Also removed unecessary log line.
2015-03-17 15:55:25 -07:00
Salvatore Dario Minonne 31ddefc347 Finalize fields.Selector 2015-03-17 22:55:43 +01:00
Victor Marmol d1ed571e28 Use containerGC in the Kubelet.
New policy default is 100 containers max.

Fixes #5457.
2015-03-17 10:50:32 -07: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
Jeff Lowdermilk e37fd2a84d Merge pull request #5477 from dchen1107/clean
Convert RestartPolicy to string for v1beta3.
2015-03-16 10:23:52 -07:00
Dawn Chen 34e9c82c70 Convert RestartPolicy to string for v1beta3.
Fixed #3607 and spiritually support #5475
2015-03-13 18:38:07 -07:00
Satnam Singh ce7658a302 Merge pull request #5445 from vmarmol/unused
Remove unused handleUpdate() in Kubelet.
2015-03-13 16:00:17 -07:00
Dawn Chen 0cc2b62b4a Merge pull request #5265 from ddysher/kubelet-post-status
kubelet post node status to master
2015-03-13 15:29:22 -07:00
Vish Kannan 13253d09e1 Merge pull request #5444 from vmarmol/lock
Lock access and update to Kubelet pods.
2015-03-13 11:06:50 -07:00
Victor Marmol 04233cdb88 Remove unused handleUpdate() in Kubelet. 2015-03-13 10:35:50 -07:00
Victor Marmol 0e485310cf Lock access and update to Kubelet pods. 2015-03-13 10:31:26 -07:00
gmarek 3489d1ae01 Refactor kubelet syncPod method 2015-03-13 18:22:42 +01:00
Victor Marmol 4675fcc57d Make ParseDockerName() return an error.
This forces callers to handle cases where the container name could not
be parsed.
2015-03-12 16:33:16 -07:00
Victor Marmol 51122998e3 Garbage collect unidentified Kubernetes containers.
These containers may be caused by a change in the Kubernetes naming
convention. The old containers are killed, the new ones started, but the
old ones are never GC'd. This change makes Kubelet GC all Kubernetes
containers, old and new.

Fixes #5372.
2015-03-12 11:40:35 -07:00
Timothy St. Clair 308bb84cf3 Minor cleanup for etcd cleaning from kubelet 2015-03-12 09:39:22 -05:00
Eric Tune ae9bc28f8b Remove mentions of etcd in kubelet. 2015-03-11 16:40:20 -07:00
Eric Tune ac7bf05079 Kubelet has not even heard of etcd. 2015-03-11 16:29:31 -07:00
Deyuan Deng 9982aaa960 kubelet post node status to master 2015-03-10 23:17:36 -04:00
Yifan Gu 241ef34fba Refactor pkg/kubelet/kubelet.go: shouldContainerBeRestarted().
Simplify the function signature.
2015-03-09 17:42:57 -07:00
Victor Marmol e187be9fe1 Merge pull request #5143 from vmarmol/cadvisor-pkg
Refactoring Kubelet's cAdvisor interface into a package.
2015-03-09 11:36:03 -07:00
Victor Marmol ab3c9de34b Refactoring cAdvisor interface into a package.
This will make it easier to start running the real cAdvisor alongside
Kubelet. This change is primarily no-op refactoring. The main behavioral
change is that we always create a cAdvisor interface and expect it to
always be available. When we make a request, if cAdvisor is not
connected the request fails with a connection error. This failure is
handled today as well.
2015-03-09 11:19:05 -07:00
Victor Marmol ca84aae454 Kubelet: wait up to 5m for Docker to come up.
The Kubelet assumes Docker is running during its execution and on
machine boot it is a race between Docker coming up and Kubelet calling
Docker. This PR waits for Docker to be up before the Kubelet begins
doing useful work. On timeout, Kubelet exits and expects to be
restarted.
2015-03-09 09:50:34 -07:00
Victor Marmol 1866adddd3 Merge pull request #5157 from yifan-gu/clean_prober
Adjust prober's logging verbose.
2015-03-06 18:04:12 -08:00
Yifan Gu da5d7c7814 Adjust prober's logging. 2015-03-06 17:30:29 -08:00
Victor Marmol 798513844c Merge pull request #5148 from yifan-gu/clean_prober
Refactor pkg/kubelet/kubelet.go: probeContainer().
2015-03-06 17:04:57 -08:00
Yifan Gu 09af0cd3b5 Refactor pkg/kubelet/kubelet.go: probeContainer().
Split the function into probeContainerLiveness() and probeContainerReadiness().
2015-03-06 16:37:58 -08:00
Dawn Chen 9439c0f3bd Merge pull request #5103 from yujuhong/naming
kubelet: revamp the pod/container naming scheme
2015-03-06 15:58:58 -08: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
Deyuan Deng 50de1a80c2 kubelet should take a client interface 2015-03-06 15:01:55 -05:00
Dawn Chen 2d0743b143 Merge pull request #5019 from yujuhong/reject_pods
kubelet: reject pods on host port conflict
2015-03-06 11:42:04 -08:00
Yu-Ju Hong 3ccdb8db98 kubelet: reject pods on host port conflict
When a host port conflict is detected, kubelet should set the pod status to
fail. The failed status will then be polled by other components at a later time,
which allows replication controller to create a new pod if necessary.

To achieve this, this change stores the pod status information in a status map
upon the detecton of port conflict. GetPodStatus() consults this status map
before attempting to query docker. The entries in the status map will be removed
when the pod is no longer associated with the node.
2015-03-06 10:46:49 -08:00
gmarek 4a01a4dbf5 Refactor Kubelets syncPod function by wrapping some functionalities into functions 2015-03-06 18:32:11 +01:00
Dawn Chen 54b2b47caa Merge pull request #4756 from vishh/kubelet
Relax constraints on container status while fetching container logs
2015-03-05 21:49:48 -08:00
Yifan Gu ed1823e276 Refactor pkg/kubelet/kubelet.go: syncPod().
Makes the syncPod() takes only the containers that belongs to the pod.
2015-03-05 16:40:50 -08:00
Vishnu Kannan f6910803a9 Relax constraints on container status while fetching container logs 2015-03-06 00:19:52 +00:00
Paul Morie 02b18edac6 Allow multiple sources to be used with record package 2015-03-05 13:54:29 -05:00
Derek Carr cb1e044a60 Merge pull request #4923 from lavalamp/fix4
Allow reflector to do full resync periodically
2015-03-04 09:58:03 -05:00
Victor Marmol 71e545bf81 Merge pull request #4970 from dchen1107/podstatus
Hide POD container from end users
2015-03-02 17:15:24 -08:00
Dawn Chen dad365fb2b Hide POD container from end users 2015-03-02 17:03:28 -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 554b1c847c add occasional polling to reflector 2015-02-27 16:59:14 -08:00
Victor Marmol c7e7ecdf2c Handle crash in per-pod thread and container killer. 2015-02-27 16:33:46 -08:00
Victor Marmol cc3c4414f8 Merge pull request #4915 from yujuhong/hostport
kubelet: record an event with a clear reason on host port conflict
2015-02-27 16:04:04 -08:00
Yu-Ju Hong 241df2d3be kubelet: record an event with a clear reason on host port conflict
Currently, kubelet silently ignores pods that caused host port conflict. This
commit surfaces the error by recording an event.

It also makes sure that kubelet iterates through the pods in the order of the
creation timestamp, which ensures that pods created later are ignored on
conflict.
2015-02-27 15:51:53 -08:00
Victor Marmol 556acc792b Adding ContainersPerPodCount metric.
This will let us know the composition of pods in clusters.
2015-02-27 11:27:09 -08:00
Victor Marmol a9301b1996 Adding metric for latency of SyncPods (synching all pods). 2015-02-27 11:11:43 -08:00
Victor Marmol cbf93822ac Adding metrics to measure latency of Docker operations.
Part of #4604.
2015-02-27 10:26:06 -08:00
Victor Marmol ed0f5885b5 Adding sync pod latency metric (again).
Latency is broken down by create, update, and sync pods.

Part of #4604.
2015-02-27 09:35:20 -08:00
Wojciech Tyczynski a973f57d6b Thread per pod 2015-02-27 13:27:29 +01:00
Sami Wagiaalla 9150cb9d95 Catch kubelet-master hostname mismatch during health check
During the kubelet's /healthz responce check to see if the
hostname used by the master matches the hostname the kubelet
knows itself by. If not fail the health check.

Signed-off-by: Sami Wagiaalla <swagiaal@redhat.com>
2015-02-26 10:22:03 -05:00
Vish Kannan e3af23e6e9 Merge pull request #4792 from vmarmol/mon-containers-per-pod
Add Kubelet metrics for pod and container counts.
2015-02-25 18:51:22 -08:00
Victor Marmol 95464349d5 Add Kubelet metrics for pod and container counts.
Part of #4604.
2015-02-25 12:18:59 -08:00
Daniel Smith ec8ecf3993 Merge pull request #4494 from brendandburns/race
Add protection for the pods member varaible.
2015-02-25 10:41:32 -08:00
Brendan Burns 801ad909ca Add protection for the pods member varaible.
Address comments.
2015-02-24 19:36:11 -08:00
Vish Kannan 0b15f2ff65 Merge pull request #4784 from vmarmol/pod-restart
Kill infra pod when a container is restarted.
2015-02-24 13:37:08 -08:00
Vish Kannan c561c8b0b1 Merge pull request #4753 from vmarmol/mon
First Kubelet metric and overall plumbing.
2015-02-24 12:51:34 -08:00
Victor Marmol aadbf221d2 Kill infra pod when a container is restarted.
Revert 0e20f7d736.
Fixes #4759.
2015-02-24 11:52:05 -08:00
Rohit Jnagal e77322a561 Merge pull request #4755 from yifan-gu/cleanup
pkg/kubelet: Fix logging.
2015-02-24 10:12:02 -08:00
Rohit Jnagal 590a62ffe5 Merge pull request #4767 from mikedanese/kind-to-type
Rename {Node,Pod}ConditionKind -> {Node,Pod}ConditionType
2015-02-24 10:10:57 -08:00
Yifan Gu 1a5a842ac5 pkg/kubelet: Fix logging. 2015-02-24 09:47:10 -08:00
Wojciech Tyczynski dcef5e2955 Introduce DockerCache in Kubelet. 2015-02-24 09:10:07 +01:00