Commit Graph

66 Commits (60604f8818aecbc9c3736fbc32747cc0a535bc80)

Author SHA1 Message Date
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Derek Carr 36619fa217 surface rpc error desc only in events 2017-06-13 23:42:15 -04:00
Derek Carr a02f10fa3a Strip containerID from events to reduce spam 2017-06-13 23:31:56 -04:00
Pengfei Ni 22e99504d7 Update CRI references 2017-06-09 10:16:40 +08:00
Derek Carr f59069720e Fix kubelet event recording 2017-05-22 17:24:36 -04:00
Yu-Ju Hong de0438a5c8 kuberuntime: add unit tests for container status population
Also refactor a little bit to make the function more testable.
2017-05-17 13:14:00 -07:00
Yu-Ju Hong 7c75f5c551 kuberuntime: report StartedAt for exited containers 2017-05-17 11:14:09 -07:00
Michael Taufen cbad320205 Reorganize kubelet tree so apis can be independently versioned 2017-05-12 10:02:33 -07:00
Random-Liu 2fbf34f7c1 Stop following container log when container exited. 2017-04-13 11:25:08 -07:00
vefimova fc8a37ec86 Added ability for Docker containers to set usage of dns settings along with hostNetwork is true
Introduced chages:
   1. Re-writing of the resolv.conf file generated by docker.
      Cluster dns settings aren't passed anymore to docker api in all cases, not only for pods with host network:
      the resolver conf will be overwritten after infra-container creation to override docker's behaviour.

   2. Added new one dnsPolicy - 'ClusterFirstWithHostNet', so now there are:
      - ClusterFirstWithHostNet - use dns settings in all cases, i.e. with hostNet=true as well
      - ClusterFirst - use dns settings unless hostNetwork is true
      - Default

Fixes #17406
2017-03-01 17:10:00 +00:00
Yu-Ju Hong c436671cca kuberuntime: remove the kubernetesManagedLabel label
The CRI shim should be responsible for returning only those
containers/sandboxes created through CRI. Remove this label in kubelet.
2017-01-27 17:08:46 -08:00
Clayton Coleman 2bb2604f0b
Limit the size of the termination log and allow log input
Enforce the following limits:

12kb for total message length in container status
4kb for the termination message path file
2kb or 80 lines (whichever is shorter) from the log on error

Fallback to log output if the user requests it.
2017-01-23 12:26:38 -05:00
Clayton Coleman eff134cd5f
Use chmod to bypass umask on termination log file
os.Create() will obey the umask which results in the file being 0644
when injected in the container.
2017-01-23 12:26:37 -05:00
Pengfei Ni 53c20e3630 kubelet/kuberuntime: update cri to protobuf v3 2017-01-20 09:55:56 +08:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Pengfei Ni 9d52b761cc kuberuntime/dockershim: add image ref to ImageService interfaces 2016-12-29 16:53:01 +08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Tim St. Clair cc801e97e8
[CRI] Manage attach TTY in Kubelet 2016-12-01 18:27:55 -08:00
Pengfei Ni f584ed4398 Fix package aliases to follow golang convention 2016-11-30 15:40:50 +08:00
Chao Xu 5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -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 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 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 3df60eb163 Implement security context in kuberuntime 2016-11-07 11:07:56 +08:00
Kubernetes Submit Queue f787cea237 Merge pull request #36020 from timstclair/klet-stream
Automatic merge from submit-queue

Separate Direct and Indirect streaming paths, implement indirect path for CRI

This PR refactors the `pkg/kubelet/container.Runtime` interface to remove the `ExecInContainer`, `PortForward` and `AttachContainer` methods. Instead, those methods are part of the `DirectStreamingRuntime` interface which all "legacy" runtimes implement. I also added an `IndirectStreamingRuntime` which handles the redirect path and is implemented by CRI runtimes. To control the size of this PR, I did not fully setup the indirect streaming path for the dockershim, so I left legacy path behind.

Most of this PR is moving & renaming associated with the refactoring. To understand the functional changes, I suggest tracing the code from `getExec` in `pkg/kubelet/server/server.go`, which calls `GetExec` in `pkg/kubelet/kubelet_pods.go` to determine whether to follow the direct or indirect path.

For https://github.com/kubernetes/kubernetes/issues/29579

/cc @kubernetes/sig-node
2016-11-04 11:52:06 -07:00
Tim St. Clair 86d849e374
Separate Direct and Indirect streaming paths, implement indirect path with CRI 2016-11-03 13:26:33 -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 479ff417b8 Merge pull request #35348 from Random-Liu/kuberuntime-container-logs
Automatic merge from submit-queue

CRI: Add kuberuntime container logs

Based on https://github.com/kubernetes/kubernetes/pull/34858.

The first 2 commits are from #34858. And the last 2 commits are new.

This PR added kuberuntime container logs support and add unit test for it.

I've tested all the functions manually, and I'll send another PR to write a node e2e test for container log.

**_Notice: current implementation doesn't support log rotation**_, which means that:
- It will not retrieve logs in rotated log file.
- If log rotation happens when following the log:
  - If the rotation is using create mode, we'll still follow the old file.
  - If the rotation is using copytruncate, we'll be reading at the original position and get nothing.

To solve these issues, kubelet needs to rotate the log itself, or at least kubelet should be able to control the the behavior of log rotator. These are doable but out of the scope of 1.5 and will be addressed in future release.

@yujuhong @feiskyer @yifan-gu 
/cc @kubernetes/sig-node
2016-11-01 20:47:20 -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
Kubernetes Submit Queue 9f9962714e Merge pull request #35611 from feiskyer/os-interface
Automatic merge from submit-queue

Use osInterface for Create

A small fix of using osInterface instead of os for `Create()`.

cc/ @Random-Liu
2016-10-29 20:59:55 -07:00
Tim St. Clair c60db99536
Implement streaming CRI methods in dockershim 2016-10-28 11:15:53 -07:00
Random-Liu 8e376dc843 Add kuberuntime container logs support. 2016-10-26 17:37:09 -07:00
Pengfei Ni 375660b931 Use osInterface for Create 2016-10-26 17:51:20 +08:00
Random Liu fad4672e72 Add legacy container log location support. 2016-10-23 19:08:47 -07:00
Random-Liu 121a91eb12 Symlink docker logs to CRI defined log path. 2016-10-23 19:08:47 -07:00
Random-Liu 76056a47f9 Change the timestamp unit to nanosecond. 2016-10-07 14:10:19 -07:00
Random-Liu a6aad1591b Make sure GetPodStatus can get statuses of all containers in a pod. 2016-10-07 14:10:18 -07:00
Yifan Gu be4e825ac3 CRI: Remove the mount name and port name.
Per discussion on https://github.com/kubernetes/kubernetes/issues/33873.

Currently the mount name is not being used and also involves some
incorrect usage (sometimes it's referencing a mount name, sometimes
it's referecing a volume name), so we decide to remove it from CRI.

The port name is also not used, so remove it as well.
2016-10-04 13:10:59 -07:00
Kubernetes Submit Queue bec41120d9 Merge pull request #33363 from feiskyer/initcontainer
Automatic merge from submit-queue

CRI: Add init containers

This PR adds init containers support in CRI.

CC @yujuhong @Random-Liu @yifan-gu 

Also CC @kubernetes/sig-node @kubernetes/sig-rktnetes
2016-10-04 10:26:33 -07:00
Random-Liu e2a994a4d1 Add fake attach support in CRI. 2016-09-29 21:29:07 -07:00
Pengfei Ni 9d42d450f8 CRI: Add init containers 2016-09-30 10:48:57 +08:00
Kubernetes Submit Queue b7c5156c6b Merge pull request #33443 from Random-Liu/cri-oom-score-adj
Automatic merge from submit-queue

CRI: Add oom score adj in new CRI implementation.

Part of #29478.

This PR adds oom score adj in new CRI implementation and dockershim.

I run [oom score node e2e test](https://github.com/kubernetes/kubernetes/blob/master/test/e2e_node/container_manager_test.go#L77) with new CRI implementation myself, and all tests passed.

@yujuhong @feiskyer
2016-09-27 04:24:48 -07:00
Random-Liu 2141e230a6 Add oom score adj in new CRI implementation. 2016-09-26 11:39:02 -07:00