Commit Graph

115 Commits (27e62180e019021e235b09c0412aaf527b183572)

Author SHA1 Message Date
Chao Xu bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu 5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -08:00
Yu-Ju Hong 5c90908eb0 dockershim: remove container upon naming conflicts
We have observed that, after failing to create a container due to "device or
resource busy", docker may end up having inconsistent internal state. One
symptom is that docker will not report the existence of the "failed to create"
container, but if kubelet tries to create a new container with the same name,
docker will error out with a naming conflict message.

To work around this, this commit parses the creation error message and if there
is a naming conflict, it would attempt to remove the existing container.
2016-11-16 10:20:16 -08:00
Random-Liu 2ce5deb6fd Add separate username field in CRI and use it. 2016-11-15 16:50:02 -08:00
Kubernetes Submit Queue c5c461df38 Merge pull request #36664 from yujuhong/fix_comments
Automatic merge from submit-queue

dockershim: clean up comments
2016-11-14 14:26:51 -08:00
Yu-Ju Hong b73dfe02b5 dockershim: clean up comments 2016-11-14 12:03:00 -08:00
pweil- d0d78f478c experimental host user ns defaulting 2016-11-14 10:16:03 -05:00
Kubernetes Submit Queue 9bdff48d5e Merge pull request #36253 from timstclair/klet-stream-config-pr
Automatic merge from submit-queue

Use indirect streaming path for remote CRI shim

Last step for https://github.com/kubernetes/kubernetes/issues/29579

- Wire through the remote indirect streaming methods in the docker remote shim
- Add the docker streaming server as a handler at `<node>:10250/cri/{exec,attach,portforward}`
- Disable legacy streaming for dockershim

Note: This requires PR https://github.com/kubernetes/kubernetes/pull/34987 to work.

Tested manually on an E2E cluster.

/cc @euank @feiskyer @kubernetes/sig-node
2016-11-09 23:29:18 -08:00
Kubernetes Submit Queue b600533794 Merge pull request #36423 from Random-Liu/support-root-nobody
Automatic merge from submit-queue

CRI: Support string user name.

https://github.com/kubernetes/kubernetes/pull/33239 and https://github.com/kubernetes/kubernetes/pull/34811 combined together broke the cri e2e test. https://k8s-testgrid.appspot.com/google-gce#gci-gce-cri

The reason is that:
1) In dockershim and dockertools, we assume that `Image.Config.User` should be an integer. However, sometimes when user build the image with `USER nobody:nobody` or `USER root:root`, the field will become `nobody:nobody` and `root:root`. This makes dockershim to always return error.
2) The new kube-dns-autoscaler image is using `USER nobody:nobody`. (See https://github.com/kubernetes-incubator/cluster-proportional-autoscaler/blob/master/Dockerfile.in#L21)

This doesn't break the normal e2e test, because in dockertools [we only inspect image uid if `RunAsNonRoot` is set](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockertools/docker_manager.go#L2333-L2338), which is just a coincidence. However, in kuberuntime, [we always inspect image uid first](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kuberuntime/kuberuntime_container.go#L141).

This PR adds literal `root` and `nobody` support. One problem is that `nobody` is not quite the same in different OS distros. Usually it should be `65534`, but some os distro doesn't follow that. For example, Fedora is using `99`. (See https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Q5GCKZ7Q7PAUQW66EV7IBJGSRJWYXBBH/?sort=date)

Possible solution:
* Option 1: ~~Just use `65534`. This is fine because currently we only need to know whether the user is root or not.~~ Actually, we need to pass the user id to runtime when creating a container.
* Option 2: Return the uid as string in CRI, and let kuberuntime handle the string directly.

This PR is using option 1.

@yujuhong @feiskyer 
/cc @kubernetes/sig-node
/cc @MrHohn
2016-11-08 20:24:31 -08:00
Random-Liu 99ee3f4b76 Add non-numeric user name support. 2016-11-08 16:07:29 -08:00
Tim St. Clair 7badc1d226
Use indirect streaming path for dockershim & remote CRI runtime 2016-11-08 10:58:38 -08:00
Tim St. Clair 0f028ff660
Remove legacy dockershim streaming 2016-11-08 10:58:38 -08:00
Kubernetes Submit Queue 866293b704 Merge pull request #33366 from rhcarvalho/execincontainer-timeout-argument
Automatic merge from submit-queue

Add timeout argument to ExecInContainer

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: This is related to https://github.com/kubernetes/kubernetes/issues/26895. It brings a timeout to the signature of `ExecInContainer` so that we can take timeouts into account in the future. Unlike my first attempt in https://github.com/kubernetes/kubernetes/pull/27956, it doesn't immediately observe the timeout, because it is impossible to do it with the current state of the Docker Remote API (the default exec handler implementation).

**Special notes for your reviewer**: This shares commits with https://github.com/kubernetes/kubernetes/pull/27956, but without some of them that have more controversial implications (actually supporting the timeouts). The original PR shall be closed in the current state to preserve the history (instead of dropping commits in that PR).

Pinging the original people working on this change: @ncdc @sttts @vishh @dims 

**Release note**:

<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->

``` release-note
NONE
```
2016-11-08 01:41:19 -08:00
Rodolfo Carvalho 506129ba4e Add timeout argument to ExecInContainer
This allows us to interrupt/kill the executed command if it exceeds the
timeout (not implemented by this commit).

Set timeout in Exec probes. HTTPGet and TCPSocket probes respect the
timeout, while Exec probes used to ignore it.

Add e2e test for exec probe with timeout. However, the test is skipped
while the default exec handler doesn't support timeouts.
2016-11-07 13:00:59 +01:00
Pengfei Ni f8e5f81fed cleanup TODOs in dockershim 2016-11-07 11:41:06 +08:00
Pengfei Ni 3aee57d4ae Add security context support in dockershim 2016-11-07 11:07:56 +08:00
Pengfei Ni 476cd96098 run hack/update-bazel.sh 2016-11-07 11:07:56 +08:00
Kubernetes Submit Queue 8371a778f6 Merge pull request #35839 from Random-Liu/add-cri-runtime-status
Automatic merge from submit-queue

CRI: Add Status into CRI.

For https://github.com/kubernetes/kubernetes/issues/35701.
Fixes https://github.com/kubernetes/kubernetes/issues/35701.

This PR added a `Status` call in CRI, and the `RuntimeStatus` is defined as following:

``` protobuf
message RuntimeCondition {
    // Type of runtime condition.
    optional string type = 1;
    // Status of the condition, one of true/false.
    optional bool status = 2;
    // Brief reason for the condition's last transition.
    optional string reason = 3;
    // Human readable message indicating details about last transition.
    optional string message = 4;
}

message RuntimeStatus {
    // Conditions is an array of current observed runtime conditions.
    repeated RuntimeCondition conditions = 1;
}
```

Currently, only `conditions` is included in `RuntimeStatus`, and the definition is almost the same with `NodeCondition` and `PodCondition` in K8s api.

@yujuhong @feiskyer @bprashanth If this makes sense, I'll send a follow up PR to let dockershim return `RuntimeStatus` and let kubelet make use of it.
@yifan-gu @euank Does this make sense to rkt?
/cc @kubernetes/sig-node
2016-11-06 04:16:29 -08:00
Kubernetes Submit Queue 37e3074d3e Merge pull request #36100 from timstclair/cris-leak
Automatic merge from submit-queue

Cleanup leaking goroutine

Cleanup potential go-routine leak in ExecSync path by removing timeout support. Timeout support is added in https://github.com/kubernetes/kubernetes/pull/33366 and https://github.com/kubernetes/kubernetes/pull/35893, and until those merge this is consistent with current behavior.

/cc @rhcarvalho
2016-11-05 16:52:46 -07:00
Random-Liu 90fe0c5994 Update bazel. 2016-11-05 00:02:05 -07:00
Random-Liu 772bf8e14d Populate NetworkReady Status. 2016-11-05 00:02:05 -07:00
Random-Liu 4bd9dbf6ad Add RuntimeStatus in container/runtime.go 2016-11-05 00:02:05 -07:00
Random-Liu 55c5232810 Add Status implementation. 2016-11-05 00:02:05 -07:00
Random-Liu fc10a25ae1 Add Status into CRI. 2016-11-05 00:00:26 -07:00
Kubernetes Submit Queue 66a7a1f961 Merge pull request #36200 from yujuhong/remove_logs
Automatic merge from submit-queue

dockershim: remove unused GetContainerLogs method
2016-11-04 21:03:22 -07:00
Random-Liu 158e48861c Add remote streaming implementation. 2016-11-04 17:47:12 -07:00
Kubernetes Submit Queue c4ff44b66d Merge pull request #35597 from feiskyer/gpu
Automatic merge from submit-queue

CRI: Add devices to ContainerConfig

This PR adds devices to ContainerConfig and adds experimental GPU support.

cc/ @yujuhong @Hui-Zhi @vishh @kubernetes/sig-node
2016-11-04 02:30:52 -07:00
Yu-Ju Hong 5933540e44 dockershim: remove unused GetContainerLogs method
We have already implemented the new method, and this is no longer needed.
2016-11-03 17:27:18 -07:00
Kubernetes Submit Queue 41b5fe86b6 Merge pull request #31546 from derekwaynecarr/systemd-pod-cgroups
Automatic merge from submit-queue

pod and qos level cgroup support

```release-note
[Kubelet] Add alpha support for `--cgroups-per-qos` using the configured `--cgroup-driver`. Disabled by default.
```
2016-11-03 03:56:56 -07:00
Tim St. Clair fa15c87cf0
Cleanup leaking goroutine 2016-11-02 15:08:21 -07:00
derekwaynecarr 42289c2758 pod and qos level cgroup support 2016-11-02 08:07:04 -04:00
Alexander D. Kanevskiy 6ad82e5a30 Fix build break on non-Linux OS introduced in 87aaf4c0 2016-11-02 12:27:11 +02:00
Kubernetes Submit Queue 6e90106ded Merge pull request #34490 from yujuhong/docker_cgroup
Automatic merge from submit-queue

dockershim: move docker to the given cgroup
2016-11-02 00:30:30 -07:00
Pengfei Ni e0f89a322b CRI: Add devices implementation and moves GPU to devices 2016-11-02 15:24:45 +08:00
Kubernetes Submit Queue 07f78836ea Merge pull request #35969 from sttts/sttts-dockershim-infra-sysctl-only
Automatic merge from submit-queue

Only set sysctls in infra container in dockershim

Dockershim counterpart of https://github.com/kubernetes/kubernetes/pull/32383.
2016-11-01 23:52:06 -07:00
Kubernetes Submit Queue bef915da9d Merge pull request #35930 from Random-Liu/handle-empty-container-name
Automatic merge from submit-queue

CRI: Handle empty container name in dockershim.

Fixes https://github.com/kubernetes/kubernetes/issues/35924.

Dead container may have no name, we should handle this properly.

@yujuhong @bprashanth
2016-11-01 21:59:38 -07:00
Yu-Ju Hong 8a6285d844 CRI: Rename container/sandbox states
The enum constants are not namespaced. The shorter, unspecifc names are likely
to cause naming conflicts in the future.

Also replace "SandBox" with "Sandbox" in the API.
2016-11-01 13:18:21 -07:00
Yu-Ju Hong 87aaf4c0ac dockershim: move docker to the given cgruop
This change add a container manager inside the dockershim to move docker daemon
and associated processes to a specified cgroup. The original kubelet container
manager will continue checking the name of the cgroup, so that kubelet know how
to report runtime stats.
2016-11-01 11:39:20 -07:00
Dr. Stefan Schimanski 42f6179517 dockershim: only set sysctl in infra container 2016-11-01 13:21:47 +01:00
Random-Liu ecd1044200 Handle empty container name in dockershim. 2016-10-31 15:05:23 -07:00
bprashanth 11638e9ee1 Unittests 2016-10-31 13:05:20 -07:00
bprashanth 706207904e SetUp/TearDown I: dockershim 2016-10-31 13:05:19 -07:00
bprashanth 48db726342 Split network.Host into LegacyHost and NamespaceGetter 2016-10-31 13:05:19 -07:00
bprashanth 9c585baf1f Teach cri about podCIDR 2016-10-31 13:05:18 -07:00
bprashanth c11aa2eb77 Teach dockershim to probe for network plugins 2016-10-31 13:05:13 -07:00
Tim St. Clair c60db99536
Implement streaming CRI methods in dockershim 2016-10-28 11:15:53 -07:00
Kubernetes Submit Queue c9953ae0ed Merge pull request #34830 from feiskyer/sysctl
Automatic merge from submit-queue

Add sysctls for dockershim

This PR adds sysctls support for dockershim. All sysctls e2e tests are passed in my local settings.

Note that sysctls runtimeAdmit is not included in this PR, it is addressed in #32803.

cc/ @yujuhong @Random-Liu
2016-10-26 19:09:03 -07:00
Random-Liu 46916bc58b Update bazel. 2016-10-25 10:57:46 -07:00
Random-Liu 3d549b9e25 Add dockershim grpc server. 2016-10-25 10:31:16 -07:00
Pengfei Ni fee6daaa8d Add sysctls for dockershim 2016-10-25 11:24:31 +08:00