Commit Graph

3805 Commits (98e6d2c1e552120f20d7d726c5779ecfcb7145e5)

Author SHA1 Message Date
Kubernetes Submit Queue ecfde2b853 Merge pull request #35998 from yujuhong/fix_enum
Automatic merge from submit-queue

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 for consistency.

/cc @kubernetes/sig-node
2016-11-01 18:07:08 -07:00
Paulo Pires 9e6815e7c7
Fixed kubelet build. 2016-11-01 16:34:47 -04: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
Jitendra Bhurat 66a1ef25e0
Fixing Volumes on Windows 2016-11-01 15:48:37 -04:00
Jitendra Bhurat a659ac99b6
Moved getSecurityOpts() function to OS specific manager variant 2016-11-01 15:48:28 -04:00
Kubernetes Submit Queue 3a1c329b0d Merge pull request #35980 from yujuhong/rm_log
Automatic merge from submit-queue

Remove an unnecessary log line in kubelet
2016-11-01 11:45:18 -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
Kubernetes Submit Queue a02750dd8f Merge pull request #35490 from bprashanth/dockershim_probe_net
Automatic merge from submit-queue

Migrate Network Logic into runtime II

- [x] Probing
- [x] Bootstrap CIDR
- [x] Setup/Teardown
- [ ] ~~Hostports~~
- [ ] ~~BWShaping~~

https://github.com/kubernetes/kubernetes/pull/34780
2016-11-01 11:08:34 -07:00
David Ashpole d494ef66f0 Collects volume inode stats using the same find command that cadvisor uses these are included in the summary 2016-11-01 10:51:11 -07:00
Kubernetes Submit Queue 2244bfed81 Merge pull request #35137 from dashpole/per_container_inode_eviction
Automatic merge from submit-queue

Eviction manager evicts based on inode consumption

Fixes: #32526 Integrate Cadvisor per-container inode stats into the summary api.  Make the eviction manager act based on inode consumption to evict pods using the most inodes.

This PR is pending on a cadvisor godeps update which will be included in PR #35136
2016-11-01 10:32:09 -07:00
Kubernetes Submit Queue 7d10cffc37 Merge pull request #32383 from sttts/sttts-sysctl-infra-only
Automatic merge from submit-queue

Only set sysctls for infra containers

We did set the sysctls for each container in a pod. This opens up a way to set un-whitelisted sysctls during upgrade from v1.3:
- set annotation in v1.3 with an un-whitelisted sysctl. Set restartPolicy=Always
- upgrade cluster to v1.4
- kill container process
- un-whitelisted sysctl is set on restart of the killed container.
2016-11-01 08:47:38 -07:00
Yu-Ju Hong 2a4f2cd50d Remove an unnecessary log line in kubelet 2016-11-01 08:23:47 -07:00
Dr. Stefan Schimanski 42f6179517 dockershim: only set sysctl in infra container 2016-11-01 13:21:47 +01:00
Dr. Stefan Schimanski 962e7534b4 Only set sysctls for infra containers 2016-11-01 13:14:16 +01:00
Kubernetes Submit Queue 44b684ad53 Merge pull request #33663 from pmorie/selinux-fixes
Automatic merge from submit-queue

SELinux Overhaul

Overhauls handling of SELinux in Kubernetes.  TLDR: Kubelet dir no longer has to be labeled `svirt_sandbox_file_t`.

Fixes #33351 and #33510.  Implements #33951.
2016-11-01 05:04:17 -07:00
bprashanth 2941aea88e Use podCIDR as a proxy for kubenet.Status 2016-10-31 18:05:30 -07:00
Magnus Kulke b7880e7cd8 Populate NodeHostName status. 2016-11-01 01:09:50 +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 aee5b8099c Skip legacy features (hostport, bwshaping) 2016-10-31 13:05:19 -07:00
bprashanth 7c2aeecdd2 SetUp/TearDown II: remove code from kuberuntime 2016-10-31 13:05:19 -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
Jordan Liggitt 1a7f7c5399
Allow apiserver to choose preferred kubelet address type 2016-10-31 16:02:38 -04:00
David Ashpole 4ca7f9f972 deal with nil inodes and inodesfree 2016-10-31 12:10:23 -07:00
David Ashpole b8fc546d60 eviction manager ecivts pod using the most inodes. 2016-10-31 11:32:49 -07:00
Alexander Brand 9ef35289e4
Restore check when getting container IP 2016-10-31 14:20:50 -04:00
Alexander Brand 244152544c
Changes to kubelet to support win containers 2016-10-31 14:20:49 -04:00
Cesar Wong 09285864db
Initial windows container runtime 2016-10-31 14:20:49 -04: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
Chao Xu 850729bfaf include multiple versions in clientset
update client-gen to use the term "internalversion" rather than "unversioned";
leave internal one unqualified;
cleanup client-gen
2016-10-29 13:30:47 -07:00
Kubernetes Submit Queue f099403e63 Merge pull request #35661 from timstclair/dockershim
Automatic merge from submit-queue

Implement streaming CRI methods in dockershim

*NOTE: Temporarily includes commit from https://github.com/kubernetes/kubernetes/pull/35330 - only review the second commit.*

Builds on https://github.com/kubernetes/kubernetes/pull/35330, using the library to implement the streaming methods in various CRI shims.

This does not actually wire up the new streaming methods in the kubelet (that will be my next PR). Once the new methods are wired up, I will delete the `Legacy{Exec,Attach,PortForward}` methods.

/cc @kubernetes/sig-node @feiskyer
2016-10-29 09:28:50 -07:00
Kubernetes Submit Queue 9a219eb803 Merge pull request #34651 from smarterclayton/negotiate
Automatic merge from submit-queue

Simplify negotiation in server in preparation for multi version support

This is a pre-factor for #33900 to simplify runtime.NegotiatedSerializer, tighten up a few abstractions that may break when clients can request different client versions, and pave the way for better negotiation.

View this as pure simplification.
2016-10-29 03:32:02 -07:00
Kubernetes Submit Queue 5eefdb92c9 Merge pull request #35817 from luxas/fix_crossbuild
Automatic merge from submit-queue

Fix cadvisor_unsupported and the crossbuild

Resolves a bug in the `cadvisor_unsupported.go` code.
Fixes https://github.com/kubernetes/kubernetes/issues/35735

Introduced by: https://github.com/kubernetes/kubernetes/pull/35136
We should consider to cherrypick this as #35136 also was cherrypicked

cc @kubernetes/sig-testing @vishh @dashpole @jessfraz

```release-note
Fix cadvisor_unsupported and the crossbuild
```
2016-10-28 23:06:11 -07:00
Kubernetes Submit Queue 58457daf63 Merge pull request #31652 from intelsdi-x/poc-opaque-int-resources
Automatic merge from submit-queue

[PHASE 1] Opaque integer resource accounting.

## [PHASE 1] Opaque integer resource accounting.

This change provides a simple way to advertise some amount of arbitrary countable resource for a node in a Kubernetes cluster. Users can consume these resources by including them in pod specs, and the scheduler takes them into account when placing pods on nodes. See the example at the bottom of the PR description for more info.

Summary of changes:

- Defines opaque integer resources as any resource with prefix `pod.alpha.kubernetes.io/opaque-int-resource-`.
- Prevent kubelet from overwriting capacity.
- Handle opaque resources in scheduler.
- Validate integer-ness of opaque int quantities in API server.
- Tests for above.

Feature issue: https://github.com/kubernetes/features/issues/76

Design: http://goo.gl/IoKYP1

Issues:

kubernetes/kubernetes#28312
kubernetes/kubernetes#19082

Related:

kubernetes/kubernetes#19080

CC @davidopp @timothysc @balajismaniam 

**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
Added support for accounting opaque integer resources.

Allows cluster operators to advertise new node-level resources that would be
otherwise unknown to Kubernetes. Users can consume these resources in pod
specs just like CPU and memory. The scheduler takes care of the resource
accounting so that no more than the available amount is simultaneously
allocated to pods.
```

## Usage example

```sh
$ echo '[{"op": "add", "path": "pod.alpha.kubernetes.io~1opaque-int-resource-bananas", "value": "555"}]' | \
> http PATCH http://localhost:8080/api/v1/nodes/localhost.localdomain/status \
> Content-Type:application/json-patch+json
```

```http
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 11 Aug 2016 16:44:55 GMT
Transfer-Encoding: chunked

{
    "apiVersion": "v1",
    "kind": "Node",
    "metadata": {
        "annotations": {
            "volumes.kubernetes.io/controller-managed-attach-detach": "true"
        },
        "creationTimestamp": "2016-07-12T04:07:43Z",
        "labels": {
            "beta.kubernetes.io/arch": "amd64",
            "beta.kubernetes.io/os": "linux",
            "kubernetes.io/hostname": "localhost.localdomain"
        },
        "name": "localhost.localdomain",
        "resourceVersion": "12837",
        "selfLink": "/api/v1/nodes/localhost.localdomain/status",
        "uid": "2ee9ea1c-47e6-11e6-9fb4-525400659b2e"
    },
    "spec": {
        "externalID": "localhost.localdomain"
    },
    "status": {
        "addresses": [
            {
                "address": "10.0.2.15",
                "type": "LegacyHostIP"
            },
            {
                "address": "10.0.2.15",
                "type": "InternalIP"
            }
        ],
        "allocatable": {
            "alpha.kubernetes.io/nvidia-gpu": "0",
            "cpu": "2",
            "memory": "8175808Ki",
            "pods": "110"
        },
        "capacity": {
            "alpha.kubernetes.io/nvidia-gpu": "0",
            "pod.alpha.kubernetes.io/opaque-int-resource-bananas": "555",
            "cpu": "2",
            "memory": "8175808Ki",
            "pods": "110"
        },
        "conditions": [
            {
                "lastHeartbeatTime": "2016-08-11T16:44:47Z",
                "lastTransitionTime": "2016-07-12T04:07:43Z",
                "message": "kubelet has sufficient disk space available",
                "reason": "KubeletHasSufficientDisk",
                "status": "False",
                "type": "OutOfDisk"
            },
            {
                "lastHeartbeatTime": "2016-08-11T16:44:47Z",
                "lastTransitionTime": "2016-07-12T04:07:43Z",
                "message": "kubelet has sufficient memory available",
                "reason": "KubeletHasSufficientMemory",
                "status": "False",
                "type": "MemoryPressure"
            },
            {
                "lastHeartbeatTime": "2016-08-11T16:44:47Z",
                "lastTransitionTime": "2016-08-10T06:27:11Z",
                "message": "kubelet is posting ready status",
                "reason": "KubeletReady",
                "status": "True",
                "type": "Ready"
            },
            {
                "lastHeartbeatTime": "2016-08-11T16:44:47Z",
                "lastTransitionTime": "2016-08-10T06:27:01Z",
                "message": "kubelet has no disk pressure",
                "reason": "KubeletHasNoDiskPressure",
                "status": "False",
                "type": "DiskPressure"
            }
        ],
        "daemonEndpoints": {
            "kubeletEndpoint": {
                "Port": 10250
            }
        },
        "images": [],
        "nodeInfo": {
            "architecture": "amd64",
            "bootID": "1f7e95ca-a4c2-490e-8ca2-6621ae1eb5f0",
            "containerRuntimeVersion": "docker://1.10.3",
            "kernelVersion": "4.5.7-202.fc23.x86_64",
            "kubeProxyVersion": "v1.3.0-alpha.4.4285+7e4b86c96110d3-dirty",
            "kubeletVersion": "v1.3.0-alpha.4.4285+7e4b86c96110d3-dirty",
            "machineID": "cac4063395254bc89d06af5d05322453",
            "operatingSystem": "linux",
            "osImage": "Fedora 23 (Cloud Edition)",
            "systemUUID": "D6EE0782-5DEB-4465-B35D-E54190C5EE96"
        }
    }
}
```

After patching, the kubelet's next sync fills in allocatable:

```
$ kubectl get node localhost.localdomain -o json | jq .status.allocatable
```

```json
{
  "alpha.kubernetes.io/nvidia-gpu": "0",
  "pod.alpha.kubernetes.io/opaque-int-resource-bananas": "555",
  "cpu": "2",
  "memory": "8175808Ki",
  "pods": "110"
}
```

Create two pods, one that needs a single banana and another that needs a truck load:

```
$ kubectl create -f chimp.yaml
$ kubectl create -f superchimp.yaml
```

Inspect the scheduler result and pod status:

```
$ kubectl describe pods chimp
Name:           chimp
Namespace:      default
Node:           localhost.localdomain/10.0.2.15
Start Time:     Thu, 11 Aug 2016 19:58:46 +0000
Labels:         <none>
Status:         Running
IP:             172.17.0.2
Controllers:    <none>
Containers:
  nginx:
    Container ID:       docker://46ff268f2f9217c59cc49f97cc4f0f085d5ac0e251f508cc08938601117c0cec
    Image:              nginx:1.10
    Image ID:           docker://sha256:82e97a2b0390a20107ab1310dea17f539ff6034438099384998fd91fc540b128
    Port:               80/TCP
    Limits:
      cpu:                                      500m
      memory:                                   64Mi
      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   3
    Requests:
      cpu:                                      250m
      memory:                                   32Mi
      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   1
    State:                                      Running
      Started:                                  Thu, 11 Aug 2016 19:58:51 +0000
    Ready:                                      True
    Restart Count:                              0
    Volume Mounts:                              <none>
    Environment Variables:                      <none>
Conditions:
  Type          Status
  Initialized   True 
  Ready         True 
  PodScheduled  True 
No volumes.
QoS Class:      Burstable
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath           Type            Reason                  Message
  ---------     --------        -----   ----                            -------------           --------        ------                  -------
  9m            9m              1       {default-scheduler }                                    Normal          Scheduled               Successfully assigned chimp to localhost.localdomain
  9m            9m              2       {kubelet localhost.localdomain}                         Warning         MissingClusterDNS       kubelet does not have ClusterDNS IP configured and cannot create Pod using "ClusterFirst" policy. Falling back to DNSDefault policy.
  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Pulled                  Container image "nginx:1.10" already present on machine
  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Created                 Created container with docker id 46ff268f2f92
  9m            9m              1       {kubelet localhost.localdomain} spec.containers{nginx}  Normal          Started                 Started container with docker id 46ff268f2f92
```

```
$ kubectl describe pods superchimp
Name:           superchimp
Namespace:      default
Node:           /
Labels:         <none>
Status:         Pending
IP:
Controllers:    <none>
Containers:
  nginx:
    Image:      nginx:1.10
    Port:       80/TCP
    Requests:
      cpu:                                      250m
      memory:                                   32Mi
      pod.alpha.kubernetes.io/opaque-int-resource-bananas:   10Ki
    Volume Mounts:                              <none>
    Environment Variables:                      <none>
Conditions:
  Type          Status
  PodScheduled  False 
No volumes.
QoS Class:      Burstable
Events:
  FirstSeen     LastSeen        Count   From                    SubobjectPath   Type            Reason                  Message
  ---------     --------        -----   ----                    -------------   --------        ------                  -------
  3m            1s              15      {default-scheduler }                    Warning         FailedScheduling        pod (superchimp) failed to fit in any node
fit failure on node (localhost.localdomain): Insufficient pod.alpha.kubernetes.io/opaque-int-resource-bananas
```
2016-10-28 22:25:18 -07:00
Lucas Käldström 00fda67931 Fix cadvisor_unsupported and the crossbuild 2016-10-28 22:57:16 +03:00
Tim St. Clair c60db99536
Implement streaming CRI methods in dockershim 2016-10-28 11:15:53 -07:00
Connor Doyle c93646e8da Support opaque integer resource accounting.
- Prevents kubelet from overwriting capacity during sync.
- Handles opaque integer resources in the scheduler.
  - Adds scheduler predicate tests for opaque resources.
- Validates opaque int resources:
  - Ensures supplied opaque int quantities in node capacity,
    node allocatable, pod request and pod limit are integers.
  - Adds tests for new validation logic (node update and pod spec).
- Added e2e tests for opaque integer resources.
2016-10-28 10:15:13 -07:00
Clayton Coleman ca2f1b87ad
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation
and reduce the need to allocate during negotiation. Simplify the dynamic
client's logic around negotiating type. Add more tests for media type
handling where necessary.
2016-10-28 11:30:11 -04:00
bprashanth 37bc34c567 periodically GC pod ips 2016-10-27 22:15:35 -07:00
David Ashpole eb19713486 kubelet calls GetDirFsInfo(root directory) instead of using GetFsInfo(root label). Reverted #33520, and changed e2e test context to use nodefs 2016-10-27 08:04:59 -07:00
Kubernetes Submit Queue 7cfbdb8471 Merge pull request #35330 from timstclair/streamlib2
Automatic merge from submit-queue

First pass at CRI stream server library implementation

This is a first pass at implementing a library for serving attach/exec/portforward calls from a CRI shim process as discussed in [CRI Streaming Requests](https://docs.google.com/document/d/1OE_QoInPlVCK9rMAx9aybRmgFiVjHpJCHI9LrfdNM_s/edit#).

Remaining library work:
- implement authn/z
- implement `stayUp=false`, a.k.a. auto-stop the server once all connections are closed

/cc @kubernetes/sig-node
2016-10-26 22:32:28 -07:00
Kubernetes Submit Queue 10061ac358 Merge pull request #35523 from luxas/remove_reconcile
Automatic merge from submit-queue

Deprecate the --reconcile-cidr flag

<!--  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**: Follows up https://github.com/kubernetes/kubernetes/pull/34906

**Special notes for your reviewer**: I'm not sure why coreos had set `--reconcile-cidr` to `false` and what the implications are now.

**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
Deprecate the --reconcile-cidr kubelet flag because it has no function anymore
```

PTAL @thockin @freehan @justinsb @yujuhong 
@kubernetes/sig-node @kubernetes/sig-network 

**I will add `hack/update-all.sh` contents soon to fix builds**
2016-10-26 20:18:37 -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 e403ccef75 Generate bazel. 2016-10-26 17:37:37 -07:00
Random-Liu 35195ef50e Add unit test for kuberuntime container logs. 2016-10-26 17:37:09 -07:00
Random-Liu 8e376dc843 Add kuberuntime container logs support. 2016-10-26 17:37:09 -07:00
Tim St. Clair 4ee4128270
First pass at CRI stream server library implementation 2016-10-26 14:40:16 -07:00
Random-Liu 54feed4e41 Enable remote dockershim by default. Once the grpc integration
is stablized, I'll remove the temporary knob and configure container
runtime endpoint in all test suite.
2016-10-26 11:00:31 -07:00
Lucas Käldström 1cf00d1ff1 Remove the function of --reconcile-cidr and deprecate it 2016-10-26 20:25:35 +03:00
Paul Morie aa855b9f24 Update bazel configurations 2016-10-26 10:39:51 -04:00
Paul Morie 21116a7dbe Always relabel supported volumes when SELinux is enabled 2016-10-26 10:39:50 -04:00
Paul Morie a2d3da52be Remove volume SELinux relabeling when pod uses host IPC or PID ns 2016-10-26 10:39:46 -04:00
Paul Morie ca9a455f2c Mark container hosts file for SELinux relabel 2016-10-26 09:38:03 -04:00
Paul Morie 42ff2b3890 Relabel container termination log if SELinux is enabled 2016-10-26 09:38:03 -04:00
Paul Morie 7fb99442a6 Refactor pkg/util/selinux 2016-10-26 09:38:03 -04:00
Pengfei Ni 375660b931 Use osInterface for Create 2016-10-26 17:51:20 +08:00
Kubernetes Submit Queue d0214ee303 Merge pull request #29509 from Hui-Zhi/container-devices
Automatic merge from submit-queue

Fix devices information struct in container

So far nowhere use the ```Devices``` which in ```RunContainerOptions```. But when I want to use it, found that it could be better if change it, because Devices in container is like:
```json
"Devices": [
                {
                    "PathOnHost": "/dev/nvidiactl",
                    "PathInContainer": "/dev/nvidiactl",
                    "CgroupPermissions": "mrw"
                },
                {
                    "PathOnHost": "/dev/nvidia-uvm",
                    "PathInContainer": "/dev/nvidia-uvm",
                    "CgroupPermissions": "mrw"
                },
                {
                    "PathOnHost": "/dev/nvidia0",
                    "PathInContainer": "/dev/nvidia0",
                    "CgroupPermissions": "mrw"
                }
            ],
```
2016-10-25 23:12:11 -07:00
Kubernetes Submit Queue 6d81e916a6 Merge pull request #35489 from Random-Liu/instrumented-cri-service
Automatic merge from submit-queue

CRI: Instrumented cri service

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

This PR added instrumented CRI service. Because we are adding the instrumented wrapper inside kuberuntime, it should work for both grpc and non-grpc integration.

This will be useful to compare latency difference between grpc and non-grpc integration, although there shouldn't be too much difference.

@yujuhong @feiskyer 
/cc @kubernetes/sig-node
2016-10-25 20:48:14 -07:00
Kubernetes Submit Queue a898f3d996 Merge pull request #34381 from liggitt/kubelet-auth
Automatic merge from submit-queue

kubelet authn/authz

Implements https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/kubelet-auth.md

Part of [Authenticated/Authorized access to kubelet API](https://github.com/kubernetes/features/issues/89) feature
2016-10-25 17:40:27 -07:00
Kubernetes Submit Queue b23798d4b5 Merge pull request #35329 from timstclair/portforward
Automatic merge from submit-queue

Refactor PortForward server methods into the portforward package

Refactor PortForward code into it's own package so it can be reused in the CRI streaming library without pulling in lots of extra dependencies.

This is a straightforward move. Nothing is changed other than a few references to the package.
2016-10-25 17:01:59 -07:00
Kubernetes Submit Queue d7f1484e6f Merge pull request #33616 from jingxu97/statusupdater-9-22
Automatic merge from submit-queue

Fix volume states out of sync problem after kubelet restarts

When kubelet restarts, all the information about the volumes will be
gone from actual/desired states. When update node status with mounted
volumes, the volume list might be empty although there are still volumes
are mounted and in turn causing master to detach those volumes since
they are not in the mounted volumes list. This fix is to make sure only
update mounted volumes list after reconciler starts sync states process.
This sync state process will scan the existing volume directories and
reconstruct actual states if they are missing.

This PR also fixes the problem during orphaned pods' directories. In
case of the pod directory is unmounted but has not yet deleted (e.g.,
interrupted with kubelet restarts), clean up routine will delete the
directory so that the pod directoriy could be cleaned up (it is safe to
delete directory since it is no longer mounted)

The third issue this PR fixes is that during reconstruct volume in
actual state, mounter could not be nil since it is required for creating
container.VolumeMap. If it is nil, it might cause nil pointer exception
in kubelet.
Detailed design proposal is #33203
2016-10-25 16:19:19 -07:00
Kubernetes Submit Queue 67d947996c Merge pull request #33988 from Random-Liu/add-remote-docker-shim
Automatic merge from submit-queue

CRI: Add dockershim grpc server.

This PR adds a in-process grpc server for dockershim.

Flags change:
1. `container-runtime` will not be automatically set to remote when `container-runtime-endpoint` is set. @feiskyer 
2. set kubelet flag `--experimental-runtime-integration-type=remote --container-runtime-endpoint=UNIX_SOCKET_FILE_PATH` to enable the in-process dockershim grpc server.
3. set node e2e test flag `--runtime-integration-type=remote -container-runtime-endpoint=UNIX_SOCKET_FILE_PATH` to run node e2e test against in-process dockershim grpc server.

I've run node e2e test against the remote cri integration, tests which don't rely on stream and log functions can pass.

This unblocks the following work:
1) CRI conformance test.
2) Performance comparison between in-process integration and in-process grpc integration.

@yujuhong @feiskyer 
/cc @kubernetes/sig-node
2016-10-25 15:36:29 -07:00
Jing Xu b02481708a Fix volume states out of sync problem after kubelet restarts
When kubelet restarts, all the information about the volumes will be
gone from actual/desired states. When update node status with mounted
volumes, the volume list might be empty although there are still volumes
are mounted and in turn causing master to detach those volumes since
they are not in the mounted volumes list. This fix is to make sure only
update mounted volumes list after reconciler starts sync states process.
This sync state process will scan the existing volume directories and
reconstruct actual states if they are missing.

This PR also fixes the problem during orphaned pods' directories. In
case of the pod directory is unmounted but has not yet deleted (e.g.,
interrupted with kubelet restarts), clean up routine will delete the
directory so that the pod directoriy could be cleaned up (it is safe to
delete directory since it is no longer mounted)

The third issue this PR fixes is that during reconstruct volume in
actual state, mounter could not be nil since it is required for creating
container.VolumeMap. If it is nil, it might cause nil pointer exception
in kubelet.

Details are in proposal PR #33203
2016-10-25 12:29:12 -07:00
Tim St. Clair 52ed57ec3b
Refactor PortForward server methods into the portforward package 2016-10-25 12:08:35 -07:00
Kubernetes Submit Queue 664b86c9ae Merge pull request #35312 from aveshagarwal/master-rhbz-1384225
Automatic merge from submit-queue

Do not log stack trace for the error http.StatusBadRequest (400).

<!--  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 PR fixes an issue where stack trace is being logged in kubelet when the status http.StatusBadRequest occurs. 

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**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
```
2016-10-25 11:01:41 -07:00
Random-Liu ced5a848f5 Add instrumented CRI service which is enabled for both grpc and non-grpc
integration.
2016-10-25 10:59:27 -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
Yu-Ju Hong 94f580ef03 Revert "bootstrap: Start hostNetwork pods even if network plugin not ready" 2016-10-25 08:38:59 -07:00
Jordan Liggitt c83f5804d2
Wire kubelet authn/authz 2016-10-25 03:40:09 -04:00
Jordan Liggitt a602ae77b8
Move kubelet api paths to constants 2016-10-25 03:40:08 -04:00
Pengfei Ni fee6daaa8d Add sysctls for dockershim 2016-10-25 11:24:31 +08:00
Kubernetes Submit Queue 8923087b52 Merge pull request #31558 from MHBauer/match-raw-term-setting
Automatic merge from submit-queue

Use the rawTerminal setting from the container itself

**What this PR does / why we need it**:
Checks whether the container is set for rawTerminal connection and uses the appropriate connection.
Prevents the output `Error from server: Unrecognized input header` when doing `kubectl run`.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, #<issue_number>, ...)` format, will close that issue when PR gets merged)*: 
helps with case 1 in #28695, resolves #30159

**Special notes for your reviewer**:

**Release note**:
```
release-note-none
```
2016-10-24 18:55:14 -07:00
Mike Danese 763c4987f2 autogenerated 2016-10-24 14:47:27 -07:00
Kubernetes Submit Queue bedb4f368f Merge pull request #35018 from Random-Liu/add-kuberuntime-unit-test
Automatic merge from submit-queue

CRI: Refactor kuberuntime unit test

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

This PR:
1) Refactor the fake runtime service and some kuberuntime unit test.
2) Add better garbage collection unit test.
3) Fix init container unit test which isn't testing correctly. Some other unit tests may also need to be fixed.
4) Add pod log directory garbage collection unit test.

@feiskyer @yujuhong 
/cc @kubernetes/sig-node
2016-10-24 13:38:29 -07:00
Kubernetes Submit Queue 3c84164bdf Merge pull request #33347 from justinsb/fix_32900
Automatic merge from submit-queue

bootstrap: Start hostNetwork pods even if network plugin not ready
2016-10-24 01:14:06 -07:00
Random-Liu 0655ae56bb Add pod log garbage collection unit test. 2016-10-24 00:03:34 -07:00
Random Liu e87fa5e0ff * Refactor kuberuntime unit test
* Add gc unit test
* Fix init container unit test
2016-10-24 00:03:34 -07: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
Kubernetes Submit Queue eeae8b5975 Merge pull request #35294 from wojtek-t/kubelet_get_from_cache
Automatic merge from submit-queue

Kubelet getting node from apiserver cache before update.

This is blocked on #35218 (however it's ready for review).

It seems to visibly reduce the apiserver metrics (and I didn't observe higher number of conflicts even in 2000-node kubemark).
2016-10-22 01:59:57 -07:00
Wojciech Tyczynski ee73fcdadb Update kubelet_node_status.go 2016-10-22 08:44:25 +02:00
Mike Danese df713b478c fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Kubernetes Submit Queue a7807eb5a4 Merge pull request #34138 from ingvagabund/create-restclient-interface
Automatic merge from submit-queue

Create restclient interface

Refactoring of code to allow replace *restclient.RESTClient with any RESTClient implementation that implements restclient.RESTClientInterface interface.
2016-10-21 16:02:04 -07:00
Kubernetes Submit Queue d20dda0c06 Merge pull request #35309 from yujuhong/fix_restarts
Automatic merge from submit-queue

CRI: Handle container/sandbox restarts for pod with RestartPolicy == …

If all sandbox and containers are dead in a pod, and the restart policy is
"Never", kubelet should not try to recreate all of them.
2016-10-21 14:35:06 -07:00
Avesh Agarwal feaeb2a25c Do not log stack trace for the error http.StatusBadRequest (400). 2016-10-21 14:05:37 -04:00
Yu-Ju Hong 32f05cda4a CRI: Handle container/sandbox restarts for pod with RestartPolicy == Never
If all sandbox and containers are dead in a pod, and the restart policy is
"Never", kubelet should not try to recreate all of them.
2016-10-21 10:10:09 -07:00
Morgan Bauer a53990fd59
Use the rawTerminal setting from the container itself 2016-10-21 08:15:39 -07:00
Kubernetes Submit Queue f74fbfc044 Merge pull request #35240 from yujuhong/ns_fix
Automatic merge from submit-queue

Return an empty network namespace path for exited infra containers

If the infra container has already terminated, `docker inspect` will report
pid 0. The path constructed using the pid to check the network namespace of
the process will be invalid. This commit changes docker to report an empty
path to stop kubenet from erroring out whenever TearDown is called on an
exited infra container.
    
This is not a fix for all the plugins, as some plugins may require the actual
network namespace to tear down properly.
2016-10-21 03:12:57 -07:00
Jan Chaloupka 6079053407 Update clientset generator to use RESTClient interface instead of the RESTClient data type 2016-10-21 10:13:51 +02:00
Wojciech Tyczynski ad87989378 Kubelet getting node from apiserver cache before update. 2016-10-21 09:21:39 +02:00
Kubernetes Submit Queue 3148bc7996 Merge pull request #35008 from timstclair/cri
Automatic merge from submit-queue

Add streaming methods to CRI API

Copied verbatim from the proposal in the [design doc](https://docs.google.com/document/d/1OE_QoInPlVCK9rMAx9aybRmgFiVjHpJCHI9LrfdNM_s/edit#heading=h.akcz9mrsrc0x).

Note: this will conflict with https://github.com/kubernetes/kubernetes/pull/33988, but the fix ("not implemented") is simple so we can see which gets approved first.

For https://github.com/kubernetes/kubernetes/pull/33988/files

/cc @Random-Liu @kubernetes/sig-node
2016-10-20 19:21:34 -07:00
Yu-Ju Hong fee4c9a7d9 Return empty network namespace if the infra container has exited
If the infra container has already terminated, `docker inspect` will report
pid 0. The path constructed using the pid to check the network namespace of
the process will be invalid. This commit changes docker to report an empty
path to stop kubenet from erroring out whenever TearDown is called on an
exited infra container.

This is not a fix for all the plugins, as some plugins may require the actual
network namespace to tear down properly.
2016-10-20 17:12:08 -07:00
Tim St. Clair c29ec1d02a
Fix stdin type on attach 2016-10-20 14:54:16 -07:00
Kubernetes Submit Queue c04aec3462 Merge pull request #34375 from euank/rkt-image-with-port
Automatic merge from submit-queue

rkt: Convert image name to be a valid acidentifier

**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
Fix a bug under the rkt runtime whereby image-registries with ports would not be fetched from
```

This fixes a bug whereby an image reference that included a port was not
recognized after being downloaded, and so could not be run

This is the quick-and-simple fix. In the longer term, we'll want to refactor image logic a bit more to handle the many special cases that the current code does not, mostly related to library images on dockerhub.

/cc @yifan-gu @kubernetes/sig-rktnetes
2016-10-20 13:08:01 -07:00
Tim St. Clair 80d7fcad86
Fix typo 2016-10-20 13:02:16 -07:00