Commit Graph

570 Commits (25ffc6ab030fe545aa473694c0f1f51885d60ba9)

Author SHA1 Message Date
k8s-merge-robot 273c9ce503 Merge pull request #15177 from timstclair/restart-policy
Auto commit by PR queue bot
2015-10-09 09:41:22 -07:00
k8s-merge-robot 44699f5852 Merge pull request #15238 from mpuncel/mpuncel/cleanup
Auto commit by PR queue bot
2015-10-09 08:12:17 -07:00
feisky d624c7de51 Pass the ContainerGCPolicy in Runtime.GarbageCollect 2015-10-09 06:57:10 +08:00
feisky 69867fb502 Refactor container gc tests 2015-10-09 06:57:09 +08:00
feisky 4c8a836260 Move original container gc to docker runtime 2015-10-09 06:57:09 +08:00
jiangyaoguo af46c69553 Distinguish image registry unavailable and pull failure 2015-10-09 01:16:31 +08:00
Piotr Szczesniak 95b293c615 Merge pull request #13516 from samsabed/backoff-image-reason
backoff image pulling on failure
2015-10-08 13:05:32 +02: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
Michael Puncel 4921a62f3a Fix comment typo and remove unnecessary line 2015-10-07 09:53:27 -07:00
Sam Abed fdf712cd84 back-off image pull on failure
Signed-off-by: Sam Abed <samabed@gmail.com>
2015-10-07 21:12:42 +11:00
Sam Abed e20d599ace Apply pod restart policy to Containers that fail to start. Fix Reason and Message for succeeding or failing containers
Signed-off-by: Sam Abed <samsabed@gmail.com>
2015-10-07 12:20:28 +11:00
Matt Moore eeb4eeb17c Move pause and fluentd-elasticsearch to GCR v2.
This scopes down the initially ambitious PR:
https://github.com/kubernetes/kubernetes/pull/14960 to replace just
`pause` and `fluentd-elasticsearch` to come through `beta.gcr.io`.

The v2 versions have been pushed under new tags, `pause:2.0` and
`fluentd-elastisearch:1.12`.

NOTE: `beta.gcr.io` will still serve images using v1 until they are repushed with v2.  Pulls through `gcr.io` will still work after pushing through `beta.gcr.io`, but will be served over v1 (via compat logic).
2015-10-06 16:39:07 -07:00
Tim St. Clair f67879eac7 Check pod RestartPolicy before restarting unhealthy containers 2015-10-06 13:17:45 -07:00
Paul Morie 227dd82119 Add PodSecurityContext and backward compatibility tests 2015-10-05 21:05:27 -04:00
Alex Robinson 99936383b0 Merge pull request #15079 from gmarek/fix-kubemark
Turn on smarter FakeDockerClient in HollowNode.
2015-10-05 17:00:49 -07:00
Alex Robinson d8120f5425 Merge pull request #14221 from timstclair/readiness-workers
Refactor readiness probing
2015-10-05 13:26:54 -07:00
gmarek 22b318fc5c Turn on smarter FakeDockerClient in HollowNode. 2015-10-05 21:36:54 +02: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
Andy Goldstein ed021fed4c Port forwarding fixes
Correct port-forward data copying logic so that the server closes its
half of the data stream when socat exits, and the client closes its half
of the data stream when it finishes writing.

Modify the client to wait for both copies (client->server,
server->client) to finish before it unblocks.

Fix race condition in the Kubelet's handling of incoming port forward
streams. Have the client generate a connectionID header to be used to
associate the error and data streams for a single connection, instead of
assuming that streams n and n+1 go together. Attempt to generate a
pseudo connectionID in the server in the event the connectionID header
isn't present (older clients); this is a best-effort approach that only
really works with 1 connection at a time, whereas multiple concurrent
connections will only work reliably with a newer client that is
generating connectionID.
2015-09-30 20:03:49 -04:00
Tim Hockin 5fbcb72241 Merge pull request #14525 from dcbw/cni
CNI network plugin
2015-09-29 21:13:26 -07:00
liguangbo 12299087da Change Oom to OOM 2015-09-28 18:18:04 +08:00
Rajat Chopra 01dd813ce3 CNI network plugin
Add an experimental network plugin implementation named "cni" that
uses the Container Networking Interface (CNI) specification for
configuring networking for pods.

https://github.com/appc/cni/blob/master/SPEC.md
2015-09-25 22:30:37 -05:00
Brian Grant 2c92672827 Merge pull request #14227 from gmarek/fake_docker
Fix 'ContainersMap' feature in fake-docker-client.
2015-09-25 13:20:33 -07:00
Brian Grant bd3a3f1443 Revert "cni network plugin" 2015-09-24 23:24:21 -07:00
Brian Grant 17ecefe9f7 Merge pull request #13766 from rajatchopra/cni
cni network plugin
2015-09-24 22:42:31 -07:00
Eric Tune 1ffa7cbc4f Merge pull request #14290 from sdodson/container-inspect-ll4
Bump Container Inspect to loglevel 4
2015-09-23 16:42:07 -07:00
gmarek 0a3f7787e7 Fix 'ContainersMap' feature in fake-docker-client. 2015-09-23 09:08:18 +02:00
Rajat Chopra 4dc7485d94 cni network plugin 2015-09-22 11:16:41 -07:00
k8s-merge-robot e535e27e82 Merge pull request #14279 from pweil-/ipc-followup
Auto commit by PR queue bot
2015-09-22 07:28:07 -07:00
k8s-merge-robot c96c76b729 Merge pull request #13780 from smarterclayton/pod_logs
Auto commit by PR queue bot
2015-09-21 17:02:47 -07:00
Clayton Coleman c2e90cd154 Support extended pod logging options
Increase the supported controls on pod logging. Add validaiton to pod
log options. Ensure the Kubelet is using a consistent, structured way to
process pod log arguments.

Add ?sinceSeconds=<durationInSeconds>, &sinceTime=<RFC3339>, ?timestamps=<bool>,
?tailLines=<number>, and ?limitBytes=<number>
2015-09-21 15:39:32 -04:00
Scott Dodson 5de183cce7 Bump Container Inspect to loglevel 4 2015-09-21 13:28:43 -04:00
Paul Weil 20361e33f2 use infra container ns for ipc 2015-09-21 12:47:19 -04:00
k8s-merge-robot 843134885e Merge pull request #12470 from simon3z/add-host-ipc
Auto commit by PR queue bot
2015-09-21 09:15:01 -07:00
Tim Hockin 9698e957a6 Merge pull request #12717 from tamnd/fixdockercfg
Fix new docker config format for private registries
2015-09-18 14:43:38 -07:00
Federico Simoncelli f21d9ac9e4 Support pods with containers using host ipc
Add a HostIPC field to the Pod Spec to create containers sharing
the same ipc of the host.

This feature must be explicitly enabled in apiserver using the
option host-ipc-sources.

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2015-09-18 21:13:39 +02:00
k8s-merge-robot 73d71d6a67 Merge pull request #14096 from mvdan/util-duration
Auto commit by PR queue bot
2015-09-18 00:20:43 -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
Tim St. Clair 1d0577286f Move the prober test from the docker manager_test.go to prober_test.go 2015-09-17 17:04:20 -07:00
k8s-merge-robot 0749339357 Merge pull request #14045 from jiangyaoguo/add-message-for-reason-cache
Auto commit by PR queue bot
2015-09-17 14:54:47 -07:00
jiangyaoguo 0d1ca62530 Add message to reason cache in kubelet 2015-09-18 01:19:04 +08:00
feihujiang 51f59f3c78 Fix the wrong path of document 2015-09-17 20:38:08 +08:00
k8s-merge-robot 445fde3dc5 Merge pull request #13447 from pweil-/pid-mode
Auto commit by PR queue bot
2015-09-16 23:34:35 -07:00
k8s-merge-robot d680ea2444 Merge pull request #13542 from yujuhong/backoff_restarts
Auto commit by PR queue bot
2015-09-16 23:11:42 -07:00
k8s-merge-robot 22f698f5b0 Merge pull request #13953 from liguangbo/change_iff_to_if_and_only_if
Auto commit by PR queue bot
2015-09-16 08:35:20 -07:00
liguangbo 4df68f03a3 change iff to if and only if to improve annotation readability 2015-09-16 08:29:36 +00:00
Jeff Lowdermilk a92c8b6886 Merge pull request #13384 from ZJU-SEL/portsbindings
Allow multiple host ports map to the same container port
2015-09-15 17:57:57 -07:00
Paul Weil ed80c2b940 pid mode 2015-09-15 13:51:44 -04:00
Jeff Lowdermilk e25ae7fdb2 Merge pull request #13833 from caesarxuchao/central-latest
[WIP] Making a generic latest package
2015-09-14 09:26:58 -07:00
Chao Xu dd6c121d7f massive changes 2015-09-11 17:31:47 -07:00
Mikaël Cluseau b76abf10cc hairpin: fix tests 2015-09-12 08:43:45 +11:00
Mikaël Cluseau 99a1cfa8ff hairpin support 2015-09-12 08:43:45 +11: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
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
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
Wojciech Tyczynski b85d0557b4 Revert #13052 2015-09-08 09:40:12 +02:00
Harry Zhang 7b2e2e5649 Fix tests and clear fmt mess in manager.go 2015-09-05 04:52:51 +00:00
Chao Xu 9fc79e9d99 refactor testapi and test scripts to prepare for multiple API groups. 2015-09-04 18:01:32 -07:00
derekwaynecarr 5dc74e8dbf Add support for CFS quota in kubelet 2015-09-03 13:44:28 -04:00
Yu-Ju Hong 9cdb004851 kubelet: fix erratic restart count caused per-container restart backoff 2015-09-02 18:50:42 -07:00
Marcin Wielgus 3e9932557d Merge pull request #13052 from pmorie/podip-fix
Fix race condition for consuming podIP via downward API
2015-09-02 16:04:01 +02:00
k8s-merge-robot 49475c3431 Merge pull request #13061 from yifan-gu/rkt_patch_events
Auto commit by PR queue bot
2015-09-01 04:10:18 -07:00
Paul Morie 4ff66bd70a Fix race exposing pod IP via downward API 2015-08-31 19:18:58 -04:00
Harry Zhang 18315db025 Allow multiple host ports map to the same port in container 2015-08-31 15:22:30 +08:00
Yu-Ju Hong f707ca08d5 Fix incorrect restart count for docker containers 2015-08-28 11:54:30 -07:00
Yifan Gu 6ced66249d kubelet/dockertools: clear container reference when killing a container. 2015-08-25 18:22:08 -07: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
tamnd 906b279080 Support new docker config format for private registries 2015-08-22 15:37:25 +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
Lv Lv 7cf9ee19c7 add test for utsMode change 2015-08-19 16:56:19 +08:00
Lv Lv 0b90dfba3a use host uts namespace when pod.Spec.HostNetwork is true 2015-08-19 13:02:10 +08: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 780accb3ba Kubelet should garbage collect dead pods
The sync loop should check for terminated pods that are no longer
running and clear them. The status loop should never write status
if the pod UID changes. Mirror pods should be deleted immediately
rather than gracefully.
2015-08-18 09:08:44 -04:00
Clayton Coleman 89f1f3b1b8 Alter graceful deletion to not use TTL
Avoid TTL by deleting pods immediately when they aren't
scheduled, and letting the Kubelet delete them otherwise.

Ensure the Kubelet uses pod.Spec.TerminationGracePeriodSeconds
when no pod.DeletionGracePeriodSeconds is available.
2015-08-18 09:08:43 -04:00
Clayton Coleman b842a7dd15 Revert "Revert "Gracefully delete pods from the Kubelet""
This reverts commit 98115facfd.
2015-08-18 08:57:02 -04:00
Yifan Gu d70a30c069 kubelet: refactor kubelet.Runtimehooks to container.ImagePuller. 2015-08-12 16:28:25 -07: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
Filip Grzadkowski 3f7b54cbdb Merge pull request #11669 from pweil-/sc-nonroot
add non-root directive to SC and kubelet checking
2015-08-11 10:30:53 +02:00
Alex Robinson 20c189d752 Merge pull request #12471 from peter-edge/docker-new-client-from-env
Use docker.NewClientFromEnv for creation of docker.Client
2015-08-10 14:22:21 -07:00
Paul Weil e490c20c22 add non-root directive to SC and kubelet checking 2015-08-10 13:30:34 -04:00
peter-edge 0458d707ac use docker.NewClientFromEnv for creation of docker.Client 2015-08-10 13:29:56 +02:00
Veres Lajos 9f77e49109 typofix - https://github.com/vlajos/misspell_fixer 2015-08-08 22:31:48 +01:00
Satnam Singh 4ece39ac20 Merge pull request #9452 from yifan-gu/img_pulling
kubelet: Add 'image pulling' event. Refactor dockerManager.createPodInfraContainer()
2015-08-07 15:23:24 -07:00
Satnam Singh bee48f4ce5 Merge pull request #12035 from AnanyaKumar/requests
Add support for request
2015-08-07 14:27:34 -07:00
Satnam Singh 950ec96db0 Merge pull request #12182 from AnanyaKumar/qos-node
Add QoS support on node
2015-08-07 14:27:02 -07:00
Yifan Gu 053db8dba7 kubelet/dockertools: Refactor image pulling for pod infra container.
Replace the trunk of pull image code with dockerManagner.pullImage().
Also add tests to verify the image pulling/pulled events.
2015-08-07 11:42:04 -07:00
Ananya Kumar 6ef3de1d5f Add QoS support on node 2015-08-07 11:18:16 -07:00
Yifan Gu eb0fb43453 kubelet: Add image pulling event.
Since it takes a while (1-2mins) for kubelet to pulling a big image
(>500MB). Just showing "Pending" for pod status is not very helpful.

This commit introduces a "pulling" event, and inserts it before the
kubelet starts to pull an image.
2015-08-07 10:50:39 -07:00
Rajat Chopra 58a742e667 status hook for the container network 2015-08-06 15:46:04 -07:00
Wojciech Tyczynski 29aaf1a4d2 Merge pull request #12168 from brendandburns/stdin2
Support Stdin and TTY in the kubelet
2015-08-06 13:45:59 +02:00
Brendan Burns 901a04a3d6 Add support for interactive contaienrs to the kubelet 2015-08-05 22:14:56 -07: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
Brendan Burns e8e756a719 Add pod/attach to the APIServer. 2015-07-30 10:55:53 -07:00
Brendan Burns 64be76c14d Add support for Attach to the kubelet.
This is a pre-cursor to supporting 'kubectl attach ...' and 'kubectl run -it ...'
2015-07-27 21:48:55 -07:00
Jimmi Dyson 8e482462fb Fixes #8945: Cleanup log symlinks on remove & dead log symlinks 2015-07-08 08:43:59 +01:00
Yu-Ju Hong b9cc548799 Merge pull request #10763 from bprashanth/timer_leak
Don't leak tickers during an exec probe
2015-07-06 11:59:24 -07:00
Yu-Ju Hong b58e7c8c2d Merge pull request #10655 from dchen1107/cadvisor
Set minimal shares for containers with no cpu specified
2015-07-06 11:38:54 -07:00
Prashanth Balasubramanian 33e2f7cb8b Don't leak tickers in the exec probe 2015-07-05 17:52:52 -07:00
Dawn Chen 9ce11545c0 Explicitly configure master component containers and nginx with 200m each. 2015-07-02 10:46:39 -07:00
Dawn Chen 4b85e02504 Set minimal shares for containers with no cpu specified 2015-07-01 21:17:07 -07:00
Yu-Ju Hong d6ff297a1f Kubelet: stop logging "Error on reading termination-log..." messages
If a pod was deleted and the associated volumes/directory were removed, there
could be a window where the pod worker is still active. If the pod worker tries
to inspect the logs, such an error would be logged. Since the pod has been
deleted, such error messages are meaningless.

This change stops logging this error, but stores the error string in the pod
status. The pod status will be updated for pods that are still alive, and will
be discarded eventually for deleted pods.
2015-07-01 14:20:42 -07:00
Maxwell Forbes 2bb4cf3f8f Merge pull request #10266 from ArtfulCoder/kubelet_resolv
update docker's resolv.conf file with options ndots:5
2015-06-25 09:54:36 -07:00
Abhishek Shah 23caf446ae update docker's resolv.conf file with options ndots:5 2015-06-24 23:33:58 -07:00
Maxwell Forbes 28946766a3 Merge pull request #9807 from krousey/container_manifest
Removing ContainerManifest
2015-06-24 17:55:29 -07:00
Kris Rousey d13421e084 Removing ContainerManifest 2015-06-24 11:31:34 -07:00
Jeff Lowdermilk d212ea17cd Merge pull request #10182 from bprashanth/kubelet_status
Fix kubelet deadlock
2015-06-23 15:40:49 -07:00
Prashanth Balasubramanian af175cc00b Add a pod status equality method to the status manager. 2015-06-22 13:49:49 -07:00
Jeff Lowdermilk b7583b799f Merge pull request #10151 from brendandburns/explore
Remove some dead code.
2015-06-22 12:02:05 -07:00
Prashanth Balasubramanian 4b990d128a Don't flood the status manager with updates from multi-container pods 2015-06-22 10:22:28 -07:00
Brendan Burns 26b682d6a0 Remove some dead code. 2015-06-19 21:32:13 -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
Saad Ali d5e00d3990 Merge pull request #9523 from bprashanth/kl_stats
Scrape /metrics of kubelets from e2e tests
2015-06-17 11:30:28 -07:00
gmarek c2c1045e09 Add startup latency e2e "test" 2015-06-17 17:40:07 +02:00
Saad Ali 6ada940e7f Merge pull request #9706 from hurf/shorten_id
Shorten container ID in events
2015-06-16 15:58:30 -07:00
Andy Goldstein 7748a02e37 Eliminate possible infinite loop in exec
If a user starts an exec session with a shell and leaves it idle long
enough, they will eventually hit the Kubelet's HTTP server's read/write
timeout of 5 minutes. At this time, the StartExec call to Docker exits,
but if the user requested a TTY, the exec'd process does not exit.
After StartExec finishes, we try to determine the exit code of the
exec'd process, but in this case, we'll never get it. This change exits
the loop after 5 tries if the process is still running.
2015-06-16 15:44:09 -04:00
Prashanth Balasubramanian 831d7a36d0 Scrape /metrics of kubelets from e2e tests 2015-06-16 09:50:40 -07:00
Dawn Chen 80c48aedb2 Merge pull request #9824 from dchen1107/clean
explicitly applying oom_score_adj(0) to processes of user containers
2015-06-15 17:06:48 -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
Dawn Chen f6f9372d1a Apply oom_score_adj (0) to PID of user containers by default. 2015-06-15 16:16:34 -07:00
Fabio Yeon bb5d2101a1 Merge pull request #9765 from brendandburns/fix-kubelet
Fix a bug where the network container could be torn down before other pods
2015-06-15 15:09:01 -07:00
hurf d58768b351 Shorten container ID in events
Log only first 12 characters of container ID in events.
2015-06-15 17:01:27 +08:00
Brendan Burns aac696d44c Fix a bug where the network container could be torn down before other pods.
This can break PreStop that hits localhost in the pod.
2015-06-12 21:18:40 -07:00
Abhi Shah cdef8ae844 Merge pull request #9749 from dchen1107/podstatus
Add logging at RunInContainer for future debugging docker exec issues.
2015-06-12 17:10:12 -07:00
Dawn Chen c1d1a01087 Add logging at RunInContainer for future debugging docker exec issues. 2015-06-12 16:38:24 -07:00
Mike Danese 35771acdfa seperate readiness and liveness in the code 2015-06-11 15:09:27 -07:00
Dawn Chen f714020a7a Passing memory swap limit -1 by default. Docker remote API never check if memory
swap is enabled by kernel or not, instead by default to set the limit to
memory * 2, and return API error 500 if swap is not enabled.
2015-06-05 18:12:05 -07:00
Dawn Chen 636b40ffa1 Filtered out unfriendly error from docker when registry is not reachable(code: 502, 503, 504) 2015-06-05 11:29:35 -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
Brian Grant be2547bc39 Merge pull request #9149 from vmarmol/docker-errors
Kubelet: Add metric for tracking Docker error count
2015-06-02 22:50:50 -07:00
Victor Marmol 6b0d3d8df0 Add DockerErrors metric in the Kubelet.
Allows the tracking of errors by Docker operation.
2015-06-02 17:38:09 -07:00
Victor Marmol 1a805c711a Refactoring handling of latency recording. 2015-06-02 17:29:13 -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 8a9700b2ba Merge pull request #8864 from ncdc/pluggable-docker-exec
Add support for pluggable Docker exec handlers
2015-06-02 14:13:06 -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
Andy Goldstein 2a0d7ebb11 Add support for pluggable Docker exec handlers
Add support for pluggable Docker exec handlers. The default handler is
now Docker's native exec API call. The previous default, nsenter, can be
selected by passing --docker-exec-handler=nsenter when starting the
kubelet.
2015-06-01 16:59:59 -04: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 3830c068b9 Merge pull request #8883 from yujuhong/kubelet_unittest2
Kubelet: clean up more unit tests
2015-05-28 15:00:02 -07:00
Brendan Burns 2ec4b409e1 Make exec more consistent with the rest of the kubectl commands. 2015-05-27 15:47:32 -07:00
Yu-Ju Hong 697312bcd7 Migrate more docker-specific tests to dockertools/manager_test.go 2015-05-27 12:42:59 -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
Dawn Chen 017fb6a818 Merge pull request #8575 from yifan-gu/kube_refactor
Minor kubelet/rkt refactors
2015-05-21 09:37:31 -07:00
Yifan Gu 6a5681e0fe kubelet: Move HashContainer to kubelet/container package. 2015-05-20 12:08:32 -07:00
Tim Hockin 75617e8760 Better kubelet logging for probes
Log when we actually run probes and event when they fail.  Print the output of
a probe, too.
2015-05-20 08:56:45 -07:00
Dawn Chen 349d8b1a67 Merge pull request #8491 from vmarmol/fix-isolation
Fix setting resource isolation in Docker 1.6+
2015-05-19 11:26:27 -07:00
deads2k 72c0709f18 reduce scope of DockerConfigEntryWithAuth 2015-05-19 12:41:03 -04:00
Victor Marmol deaa0e569d Set CPU and memory in Create() and Start().
This allows for backwards and forwards compatability since old Docker
versions expect it in Create() and newer ones do so in Start().

Fixes #8358
2015-05-19 09:26:15 -07:00
deads2k 5458f05679 create LocalObjectReference 2015-05-19 08:39:46 -04:00
deads2k 0c14e0cbdb add pull secret references to pods 2015-05-18 16:18:16 -04:00
Victor Marmol a7341cfb77 Merge pull request #8386 from smarterclayton/make_kubelet_consumable
Make it easier to reuse kubelet server code
2015-05-18 11:26:55 -07:00
Satnam Singh 26b27b5e0f Merge pull request #8374 from jimmidyson/docker-log-symlink-separator
Docker log symlinks should use underscore separator
2015-05-18 08:59:07 -07:00
Michal Fojtik 7d11e226b7 Disable 'Timestamps' in Docker logs to prevent double-timestamps 2015-05-18 12:27:19 +02:00
Clayton Coleman 1f628f2340 Bump fake docker version to emulate Docker 1.6 2015-05-16 16:10:49 -04:00
Jimmi Dyson 2d4067f1fd Fixes #8374: Underscore separator in docker log symlink 2015-05-16 19:19:27 +01:00
Dawn Chen ebbb130af8 OOM protected docker processes (-900) 2015-05-14 15:49:12 -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 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 3481db8aee Merge pull request #8136 from yifan-gu/runtime_opt
kubelet/container: Remove ipcMode and netMode from  RunContainerOptions.
2015-05-12 14:41:49 -07:00
Yifan Gu a2dac158c2 kubelet/container: Remove ipcMode and netMode from RunContainerOptions.
Since createPodInfraContainer() is moved into dockertools. There is no
need to pass the ipcMode or netMode via RunContainerOptions.
2015-05-12 14:18:00 -07:00
Vish Kannan a74522a738 Merge pull request #8011 from brendandburns/exec
Switch exec to look at exit code not output status.
2015-05-12 12:43:11 -07:00
Brendan Burns fbd0143fa8 Merge pull request #7971 from deads2k/make-docker-keyring-handle-multiple-hits
make the dockerkeyring handle mutiple matching credentials
2015-05-11 17:01:37 -07:00
Yu-Ju Hong a9c9505206 Use VirtualSize of the docker image as the image size 2015-05-11 11:03:47 -07:00
Yu-Ju Hong 3487a165b8 Unexport DockerManager.RunContainer 2015-05-11 11:03:41 -07:00
Victor Marmol 307d677e06 Merge pull request #8022 from ddysher/kubelet-privilege
Check Pod privileged container
2015-05-11 09:01:58 -07:00
deads2k 2ecb0ebd73 make the dockerkeyring handle mutiple matching credentials 2015-05-11 09:54:03 -04:00
Deyuan Deng 2f7183cba5 Check Pod privileged container 2015-05-09 17:30:35 -04:00
Deyuan Deng 72a563f618 Use error type from docker go-client instead of string 2015-05-09 15:20:45 -04:00
Yu-Ju Hong d185bfd56a Record failure reason for image pulling 2015-05-08 17:37:11 -07:00
Brendan Burns c9324e6e38 Switch exec to look at exit code not output status. 2015-05-08 16:51:37 -07:00
Yifan Gu 8b1174a3a7 kubelet/container: Move pty*.go to container runtime package.
This makes the labeld pty wrapper available for both container runtime.
2015-05-07 23:36:47 -07:00
Paul Morie df08b15121 Change signature of container runtime PullImage to allow pull w/ secret 2015-05-06 17:42:03 -04:00
Rodolfo Carvalho 075ae79826 Fix metric label
Signed-off-by: Rodolfo Carvalho <rcarvalh@redhat.com>
2015-05-06 10:29:50 +02:00
Paul Weil 982bf19c20 security context initial implementation - squash 2015-05-05 13:46:13 -04:00
Victor Marmol fe7cb95be6 Merge pull request #7746 from vishh/exec_fix
Fix kubelet's docker RunInContainer implementation
2015-05-04 16:49:57 -07:00
Victor Marmol a32d31d045 Merge pull request #7729 from yujuhong/runtime_up
Kubelet: wait until container runtime is up
2015-05-04 16:02:30 -07:00
Vishnu Kannan ec01265643 Fix docker exec logic. Without this patch, kubelet was not receiving any output from docker exec
and was incorrectly handling the output.
2015-05-04 16:01:32 -07:00
Yu-Ju Hong d231eb6bef Kubelet: wait until container runtime is up
Instead of waiting for the docker client to be up, we wait for the container
runtime to be up.
2015-05-04 15:16:38 -07:00
Victor Marmol b0129089da Merge pull request #7712 from rjnagal/kubelet
Expose pod name as a label on containers.
2015-05-04 14:52:16 -07:00
Rohit Jnagal 1511dbf0b5 Expose pod name as a label on containers.
Full pod name is exposed under key 'kubernetes.io/pod'.
It helps in introspection by looking at all containers in a pod through
docker ps -a -f label=kubernetes.io/pod=podXXX

We also plan to visualize this in cAdvisor.
2015-05-04 21:20:42 +00:00
Victor Marmol 79fc8bee34 Change GetContainerLogs() signature.
This works for both runtimes. We need to eventually unify the ID scheme
for this method.
2015-05-04 11:16:32 -07: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
Daniel Smith 4a6ab7fd36 Merge pull request #7597 from eparis/copyright
Use generic copyright holder name in license boilerplate
2015-05-01 17:01:39 -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
Yu-Ju Hong 4fe3366b04 Removes RunPod in the Runtime interface
SyncPod subsumes RunPod, so the latter is no longer needed.
After this change, DockerManager implements the Runtime interface.
2015-05-01 14:47:04 -07: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
Vish Kannan cadfde0bd1 Merge pull request #7277 from guenter/cgroup-parent
Add --cgroup_parent flag to Kubelet to set the parent cgroup for pods
2015-05-01 10:24:58 -07:00
Yifan Gu 3751ecc766 kubelet/container: Move ShouldContainerBeRestarted() to runtime. 2015-04-30 22:55:25 -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
Victor Marmol 441a4e6f30 Merge pull request #7578 from yujuhong/docker_manager
Add image-related methods to DockerManager
2015-04-30 16:16:39 -07:00
Yu-Ju Hong 83c599e4d4 Add image-related methods to DockerManager
This change is part of the efforts to make DockerManager implement the Runtime
interface.

The change also modifies the interface slightly to work with existing
code, and aggregates the type converting functions to convert.go.
2015-04-30 13:27:52 -07:00
Yu-Ju Hong 2f7b951140 Remove more docker references in kubelet
This change also renames TrimRuntimePrefixFromImage to TrimRuntimePrefix to
better reflect that the usage is not limited to images (e.g. ID).
2015-04-30 13:16:11 -07:00
Tobi Knaup b96c4046a8 Add --cgroup_root flag to Kubelet to set the parent cgroup for all pods.
Implements #6991.
2015-04-30 10:32:27 -07:00
Yu-Ju Hong 919d78281f Clean up dockertools/manager.go and add more unit tests.
This change refactors the GetPods function and add some basic unit tests.
We should start migrating docker specific tests from kubelet_test to
manager_test.go.
2015-04-29 18:32:52 -07:00
Yu-Ju Hong d81ecc58f8 Adapt pod killing and cleanup for generic container runtime
This change removes docker-specifc code in killUnwantedPods. It
also instructs the cleanup code to move away from interacting with
containers directly. They should always deal with the pod-level
abstraction if at all possible.
2015-04-29 16:08:09 -07:00
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
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
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 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
Sam Ghods 5ceebb4a5f Add error message to log of docker error 2015-04-27 21:49:46 -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 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
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
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
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
Satnam Singh 2444c1f943 Propagate pod and container name for log files 2015-04-22 15:08:51 -07:00
Yifan Gu c55c879ffe kubelet/dockertools: Remove dockerContainerCommandRunner.
Replace with docker manager.
2015-04-22 11:00:54 -07:00
Victor Marmol 1a41ec9c86 Merge pull request #7116 from yujuhong/container_status
Print container statuses in `kubectl get pods`
2015-04-22 09:18:14 -07:00
Dawn Chen a666c1e731 Merge pull request #7134 from yifan-gu/version
kubelet: Refactor GetDockerVersion().
2015-04-21 16:49:45 -07:00
Yu-Ju Hong 06125f37d3 Print container statuses in `kubectl get pods`
`kubectl get pod` already prints one container per line. This change fills in
the status for each container listed. This aims to help users quickly identify
unhealthy pods (e.g. in a crash loop) at a glance.

 - The first row of every pod would display the pod information and status
 - Each row of the subsequent rows corresponds to a container in that pod:
    * STATUS refers to the container status (Running, Waiting, Terminated).
    * CREATED refers to the elapsed time since the last start time of the
      container.
    * MESSAGE is a string which explains the last termination reason, and/or
      the reason behind the waiting status.
2015-04-21 15:42:18 -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
Akram Ben Aissi b7fc22be8a Fixes an issue with hosts having an IPv6 address on localhost
- When 'getent hosts localhost' returns '::1' the creation of the
  listener fails because of the port parsing which uses ":" as a
separator
- Use of net.SplitHostPort() to do the job
- Adding unit tests to ensure that the creation succeeds
- On docker.go: adds a test on the presence the socat command which was
  failing silenty if not installed

- Code Review 1
  - Fixed typo on Expected
  - The UT now fails if the PortForwarder could not be created

- Code Review 2
  - Simplify socat error message
  - Changing t.Fatal to to.Error on unit tests

- Code Review 3
  - Removing useless uses cases in unit tests

- Code Review 4
  - Removing useless initiliasiation of PortForwarder
  - Changing error message

- Code Review 5
  - Simplifying TestCast struct
  - Adding addition test in one test case
  - Closing the listener

- Code Review 6
  - Improving unit test
2015-04-21 20:16:22 +02: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
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
Xiang Li 2f2247dae3 pkg/kubelet: no more self receiver in kubelet pkg 2015-04-19 20:26:07 -07:00
Yu-Ju Hong 2fd87597a4 Fix data race in kubelet_test.go
Ensure that FakeDockerClient make a copy of the internal list and return it.
2015-04-16 11:36:10 -07:00
Victor Marmol 54406a5b7c Merge pull request #6794 from yujuhong/restart_counts
Kubelet: persist restart count of a container
2015-04-14 16:01:49 -07:00
Yu-Ju Hong fd34441d2d Kubelet: persist restart count of a container
Currently, restart count are generated by examine dead docker containers, which
are subject to background garbage collection. Therefore, the restart count is
capped at 5 and can decrement if GC happens.

This change leverages the container statuses recorded in the pod status as a
reference point. If a container finished after the last observation, restart
count is incremented on top of the last observed count. If container is created
after last observation, but GC'd before the current observation time, kubelet
would not be aware of the existence of such a container, and would not increase
the restart count accordingly. However, the chance of this should be low, given
that pod statuses are reported frequently. Also, the restart cound would still
be increasing monotonically (with the exception of container insepct error).
2015-04-14 15:06:42 -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
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
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
Victor Marmol 1563a7636a Merge pull request #6652 from dchen1107/podstatus
Populate last terminated container information
2015-04-10 09:21:58 -07:00
Clayton Coleman fce3e5a2bb Merge pull request #6574 from ncdc/exec-portforward-no-command-pipes
Don't use command pipes for exec/port forward
2015-04-10 12:07:21 -04:00
Dawn Chen 563f2965ba Populate last terminated container information 2015-04-09 16:10:13 -07:00
Yifan Gu 12b382ce76 kubelet/fake_docker_client: Use self's PID instead of 42 in testing.
This is safer to use self's PID than some arbitrary PID (say 42),
since the kubelet will set the oom_score_adj for real.
2015-04-09 14:31:44 -07:00
Yifan Gu b868f421e0 kubelet: Move pod infra container image setting to dockertools. 2015-04-09 09:53:07 -07:00
Yifan Gu d4513c2890 kubelet/DockerManager: Fix returning empty error from GetPodStatus(). 2015-04-08 17:55:30 -07:00
Andy Goldstein 4c1cba5312 Don't use command pipes for exec/port forward
Switch to passing the streams for Stdin/Stdout/Stderr instead of using
StdinPipe() etc because the pipes are incompatible with Run()/Wait().
2015-04-08 13:42:42 -04: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