Commit Graph

3192 Commits (b038355c81ee621ef0bb199c20442879b97eadc1)

Author SHA1 Message Date
Kevin Wang 09344c1ffc Optimizing the processing flow of HandlePodAdditions and canAdmitPod methods.
Signed-off-by: Kevin Wang <wang.kanghua@zte.com.cn>

change the note for the canAdmitPod method.

Signed-off-by: Kevin Wang <wang.kanghua@zte.com.cn>

gofmt kubelet.go

Signed-off-by: Kevin Wang <wang.kanghua@zte.com.cn>
2016-07-11 10:34:51 +08:00
k8s-merge-robot a261776f3e Merge pull request #28670 from wojtek-t/scheduler_metadata
Automatic merge from submit-queue

Add meta field to predicate signature to avoid computing the same things multiple times

This PR only uses it to avoid computing QOS of a pod for every node from scratch.

Ref #28590
2016-07-09 22:28:14 -07:00
k8s-merge-robot e712b3c47a Merge pull request #28627 from ronnielai/disk-gc2
Automatic merge from submit-queue

RemoveContainer in Runtime interface

- Added a DeleteContainer method in Runtime interface
- Implemented DeleteContainer for docker

#28552
2016-07-08 22:18:51 -07:00
k8s-merge-robot 0f20ab63af Merge pull request #28566 from dubstack/dubstack-refactor-cgroup-manager
Automatic merge from submit-queue

Add checks in Create and Update Cgroup methods

This PR is connected to upstream issue for adding pod level cgroups in Kubernetes: #27204 
Libcontainer currently doesen't support updates to parent devices cgroups. Until we get libcontainer to support skipping devices cgroup we will have that logic on the kubelet side.
This PR includes:
1. Skip the devices cgroup when updating a cgroup. We only update the memory and cpu subsytems.
2. We explicitly pass all the cgroup paths that don't already exist to Apply() 
3. Adds an AlreadyExists() method which is a utility function to check if all the subsystems of a cgroup already exist. 
On cgroupManager.Update() we only call Set() and cgroupManager.Create() we only call Apply() method

@vishh PTAL
2016-07-08 19:12:01 -07:00
Euan Kemp eeee8b54ea kubelet: delete unused pod manager method 2016-07-08 15:15:54 -07:00
Euan Kemp 26e0f50504 kubelet: delete unused code 2016-07-08 15:15:43 -07:00
Paul Morie 5ca51e4047 Remove unnecessary calls to api.GetReference 2016-07-08 16:53:33 -04:00
Paul Morie 5c836f3582 Extract kubelet network code into its own file 2016-07-08 15:18:07 -04:00
Ron Lai 0a651402f2 - Added a DeleteContainer method in Runtime interface
- Implemented DeleteContainer for docker
2016-07-08 10:40:30 -07:00
Wojciech Tyczynski 6890868823 Add meta field to predicates signature 2016-07-08 12:25:48 +02:00
Buddha Prakash dcfff45ab7 Add checks in Create and Update Cgroup methods 2016-07-07 14:17:14 -07:00
k8s-merge-robot f1a6685b71 Merge pull request #24705 from derekwaynecarr/port_active_deadline
Automatic merge from submit-queue

Move ActiveDeadlineSeconds implementation into a kubelet sync observer

The first commit is from: https://github.com/kubernetes/kubernetes/pull/24344

The second commit moves the code for enforcement around active deadlines into a kubelet sync observer pattern.  It groups code that used to be scattered across the kubelet.

<!-- Reviewable:start -->
---
This change is [<img src="http://reviewable.k8s.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](http://reviewable.k8s.io/reviews/kubernetes/kubernetes/24705)
<!-- Reviewable:end -->
2016-07-07 12:49:02 -07:00
k8s-merge-robot 4da14c8a64 Merge pull request #28204 from thockin/cleanup-third_party
Automatic merge from submit-queue

Cleanup third party (pt 2)

Move forked-and-hacked golang code to the forked/ directory.  Remove ast/build/parse code that is now in stdlib.  Remove unused shell2junit
2016-07-07 12:13:14 -07:00
derekwaynecarr c162fec94d Move ActiveDeadlineSeconds to use lifecycle observers 2016-07-07 13:43:55 -04:00
k8s-merge-robot 3832b32d08 Merge pull request #27501 from ronnielai/test1
Automatic merge from submit-queue

Log all image deletion errors instead of just the last one

#27169
2016-07-07 00:53:39 -07:00
ronnielai 5d05fbad9b Revert "Declare out of disk when there is no free inodes" 2016-07-06 08:19:09 -07:00
k8s-merge-robot d06359d6a0 Merge pull request #28409 from saad-ali/moveVolumeController
Automatic merge from submit-queue

Reorganize volume controllers and manager

* Move both PV and attach/detach volume controllers to `controllers/volume` (closes #26222)
* Rename `kubelet/volume` to `kubelet/volumemanager`
* Add/update OWNER files
2016-07-02 00:41:02 -07:00
Ron Lai ed1444e47f Log all image deletion errors instead of just the last one 2016-07-01 20:00:05 -07:00
k8s-merge-robot 40b8fb476d Merge pull request #28176 from ronnielai/inode-check-dep
Automatic merge from submit-queue

Declare out of disk when there is no free inodes

#21546
2016-07-01 19:59:00 -07:00
saadali 0dd17fff22 Reorganize volume controllers and manager 2016-07-01 18:50:25 -07:00
k8s-merge-robot 2df9d16a7a Merge pull request #28173 from ronnielai/inode-summary-dep
Automatic merge from submit-queue

Includes the number of free inodes in stat summary

#21546
2016-07-01 18:38:28 -07:00
k8s-merge-robot fb19362e01 Merge pull request #25899 from yujuhong/ncri
Automatic merge from submit-queue

Add a new container runtime interface

This PR includes a proposal and a Go file to re-define the container runtime interface.
This is based on the original doc: https://docs.google.com/document/d/1ietD5eavK0aTuMQTw6-21r67UU73_vqYSUIPFdA0J5Q/

The umbrella issues is #22964

/cc @kubernetes/sig-node
2016-07-01 16:55:44 -07:00
k8s-merge-robot 793b4fea9e Merge pull request #27900 from derekwaynecarr/test_defaults_qos
Automatic merge from submit-queue

Add additional testing scenarios for compute resource requests=0

I was asked about the qos tier of a pod that specified 

`--requests=cpu=0,memory=0 --limits=cpu=100m,memory=1Gi`

and in just investigating current behavior, realized we should have an explicit test case to ensure that 0 values are preserved in defaulting passes, and that this is still a burstable pod (but the lowest for that tier as it related to eviction)

/cc @vishh
2016-07-01 16:16:23 -07:00
Yu-Ju Hong 08dc661133 Container runtime interface
This commit includes a proposal and a Go file to re-define the container
runtime interface.

Note that this is an experimental interface and is expected to go through
multiple revisions once developers start implementing against it. As stated in
the proposal, there are also individual issues to carry discussions of
specific features.
2016-07-01 15:42:11 -07:00
k8s-merge-robot 9470bfd692 Merge pull request #28240 from Random-Liu/add-semver-back
Automatic merge from submit-queue

Kubelet: Add the docker semver back.

Fixes #28221.
This PR:
1) Add the semver back https://github.com/kubernetes/kubernetes/pull/20020
2) Remove the code in https://github.com/kubernetes/kubernetes/pull/20827, because docker 1.8 is not officially supported now, and we want to deprecate it. https://github.com/kubernetes/kubernetes/pull/27208
3) Add a test for docker version comparison.

XRef https://github.com/kubernetes/kubernetes/pull/28223

@yujuhong 
/cc @ingvagabund 

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-30 23:20:56 -07:00
k8s-merge-robot 536622fd07 Merge pull request #27923 from kevinjkj/kevinjkj-patch-2-1
Automatic merge from submit-queue

fix return value
2016-06-30 21:14:15 -07:00
k8s-merge-robot ab37fbf4c2 Merge pull request #28258 from vishh/28231
Automatic merge from submit-queue

[kubelet] Allow opting out of automatic cloud provider detection in kubelet. By default kubelet will auto-detect cloud providers

fixes #28231
2016-06-30 12:27:26 -07:00
Ron Lai e5f8cd9973 Includes the number of free indoes in summary 2016-06-30 10:05:57 -07:00
Ron Lai 8cc6057c63 Declare out of disk when there is no free inodes. 2016-06-30 09:43:36 -07:00
Vishnu Kannan ea789e8612 Allow opting out of automatic cloud provider detection in kubelet
Signed-off-by: Vishnu Kannan <vishnuk@google.com>
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-06-29 18:04:29 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -07:00
Random Liu 7f6d9b3bc6 Add the semver back. 2016-06-29 14:35:12 -07:00
k8s-merge-robot 7f3da674f7 Merge pull request #26680 from olegshaldybin/fake-clientset-registry
Automatic merge from submit-queue

Track object modifications in fake clientset

Fake clientset is used by unit tests extensively but it has some
shortcomings:

- no filtering on namespace and name: tests that want to test objects in
  multiple namespaces end up getting all objects from this clientset,
  as it doesn't perform any filtering based on name and namespace;

- updates and deletes don't modify the clientset state, so some tests
  can get unexpected results if they modify/delete objects using the
  clientset;

- it's possible to insert multiple objects with the same
  kind/name/namespace, this leads to confusing behavior, as retrieval is
  based on the insertion order, but anchors on the last added object as
  long as no more objects are added.

This change changes core.ObjectRetriever implementation to track object
adds, updates and deletes.

Some unit tests were depending on the previous (and somewhat incorrect)
behavior. These are fixed in the following few commits.
2016-06-29 06:04:33 -07:00
k8s-merge-robot 1a1a4709b9 Merge pull request #28093 from dubstack/dubstack-refactor-qos2
Automatic merge from submit-queue

[Refactor] Make QoS naming consistent across the codebase

@derekwaynecarr @vishh PTAL. Can one of you please attach a LGTM.
2016-06-29 02:36:22 -07:00
k8s-merge-robot c6fa861688 Merge pull request #28160 from saad-ali/waitForGracefulTerm
Automatic merge from submit-queue

Volume manager must verify containers terminated before deleting for ungracefully terminated pods

A pod is removed from volume manager (triggering unmount) when it is deleted from the kubelet pod manager. Kubelet deletes the pod from pod manager as soon as it receives a delete pod request. As long as the graceful termination period is non-zero, this happens after kubelet has terminated all containers for the pod. However, when graceful termination period for a pod is set to zero, the volume is deleted from pod manager *before* its containers are terminated.

This  can result in volumes getting unmounted from a pod before all containers have exited when graceful termination is set to zero.

This PR prevents that from happening by only deleting a volume from volume manager once it is deleted from the pod manager AND the kubelet containerRuntime status indicates all containers for the pod have exited. Because we do not want to call containerRuntime too frequently, we introduce a delay in the `findAndRemoveDeletedPods()` method to prevent it from executing more frequently than every two seconds.

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

Running test in tight loop to verify fix.
2016-06-29 01:33:31 -07:00
Tim Hockin 8c42c08363 move forked golang code to a common dir with LICENSE 2016-06-28 22:57:45 -07:00
Tim Hockin 37bda2dbf2 Move hacked golang os code to forked/ dir 2016-06-28 22:16:59 -07:00
Saad Ali c723d9e5c4 Volume manager verify containers terminated before deleting 2016-06-28 21:38:59 -07:00
k8s-merge-robot 532491aab6 Merge pull request #28095 from saad-ali/fixRacyVolumesInUse
Automatic merge from submit-queue

Kubelet should mark VolumeInUse before checking if it is Attached

Kubelet should mark VolumeInUse before checking if it is Attached.
Controller should fetch fresh copy of node object before detach instead of relying on node informer cache.

Fixes #27836
2016-06-28 15:59:17 -07:00
saadali e06b32b1ef Mark VolumeInUse before checking if it is Attached
Ensure that kublet marks VolumeInUse before checking if it is Attached.
Also ensures that the attach/detach controller always fetches a fresh
copy of the node object before detach (instead ofKubelet relying on node
informer cache).
2016-06-28 14:05:59 -07:00
Oleg Shaldybin ab6ac7c94e Fix mirror pod identity change test
If mirror pod identity changes it actually doesn't get updated;
previously test was relying on an incorrect record pulled from a fake
clientset.
2016-06-28 11:54:13 -07:00
Dr. Stefan Schimanski 186c6b29c1 Use : as seccomp security option operator for Docker 1.10 2016-06-28 16:44:48 +02:00
derekwaynecarr a04e6f8635 Add additional testing scenarios for compute resource requests=0 2016-06-27 14:38:55 -04:00
k8s-merge-robot db4c943f6d Merge pull request #27800 from derekwaynecarr/fix_filename_typo
Automatic merge from submit-queue

Fix typo in filename

just a simple fix
2016-06-27 09:49:16 -07:00
Jordan Liggitt c202a405cd Fix reference to linux-only struct 2016-06-27 11:13:49 -04:00
k8s-merge-robot ecfd4aa131 Merge pull request #27755 from dubstack/dubstack-cgroup-interface
Automatic merge from submit-queue

Add support for basic QoS and pod level cgroup management

This PR is a WIP and is tied to this upstream issue #27204 
It adds support for creation,deletion and updates of cgroups in Kubernetes.
@vishh PTAL

Please note that the first commit is part of this PR: #27749
cc @kubernetes/sig-node

Signed-off-by: Buddha Prakash <buddhap@google.com>
2016-06-26 22:21:15 -07:00
k8s-merge-robot d744fd411f Merge pull request #27598 from xiangpengzhao/optimize_canRunPod
Automatic merge from submit-queue

Refactor func canRunPod

After refactoring, we only need to check `if pod.Spec.SecurityContext == nil` once. The logic is a bit clearer.
2016-06-26 19:41:09 -07:00
Buddha Prakash 4acb64f8bd Make Qos naming consistent across the codebase 2016-06-26 16:19:47 -07:00
Buddha Prakash a5ead79d43 Add support for basic cgroup management 2016-06-26 15:41:34 -07:00
k8s-merge-robot 11c5d22004 Merge pull request #27750 from dims/fix-issue-27730
Automatic merge from submit-queue

Fix pkg/kubelet unit tests fail on OSX

use runtime.GOOS for the OperatingSystem and not hardcode it to linux.

Fixes #27730
2016-06-26 06:56:37 -07:00
k8s-merge-robot d64333419c Merge pull request #27749 from dubstack/dubstack-refactor-qos
Automatic merge from submit-queue

[Refactor] QOS to have QOS Class type for QoS classes

This PR adds a QOSClass type and initializes QOSclass constants for the three QoS classes.
It would be good to use this in all future QOS related features. 
This would be good to have for the (Pod level cgroups isolation proposal)[https://github.com/kubernetes/kubernetes/pull/26751] that i am working on aswell.
@vishh PTAL
 
Signed-off-by: Buddha Prakash <buddhap@google.com>
2016-06-26 06:23:23 -07:00
k8s-merge-robot a43aa608a1 Merge pull request #27508 from aaronlevy/dapi-hostip
Automatic merge from submit-queue

Kubelet can retrieve host IP even when apiserver has not been contacted

fixes https://github.com/kubernetes/kubernetes/issues/26590, fixes https://github.com/kubernetes/kubernetes/issues/6558

Right now the kubelet expects to get the hostIP from the kubelet's local nodeInfo cache. However, this will be empty if there is no api-server (or the apiServer has not yet been contacted).

In the case of static pods, this change means the downward api can now be used to populate hostIP.
2016-06-25 23:29:05 -07:00
k8s-merge-robot ea1248e9f2 Merge pull request #27300 from euank/remove-dead-stack-get
Automatic merge from submit-queue

kubelt: Remove a couple lines of dead code

Presumably that code was added for debugging reasons and never removed. Hopefully.

If it's actually important and there's a good reason to do what looks like a no-op to get pause-the-world behaviour or whatever, I'd hope there'd be a comment.

cc @pwittrock
2016-06-25 20:23:38 -07:00
k8s-merge-robot 151c2249cc Merge pull request #28044 from yifan-gu/bump_rkt
Automatic merge from submit-queue

rkt: Bump required rkt version to 1.9.1.

Bump the rkt version to use the one that fixed the [go-systemd sdjournal issue](https://github.com/coreos/rkt/pull/2837), also match [release doc](https://github.com/kubernetes/kubernetes.github.io/blob/release-1.3/docs/getting-started-guides/rkt/index.md#prerequisite).

cc @kubernetes/sig-rktnetes @kubernetes/sig-node
2016-06-24 22:50:29 -07:00
k8s-merge-robot d50bd9e75c Merge pull request #27996 from ronnielai/gc-threshold
Automatic merge from submit-queue

Image GC logic should compensate for reserved blocks

Calculating the disk usage based on available bytes instead of usage bytes to account for reserved blocks in image GC

#27169
2016-06-24 19:08:36 -07:00
k8s-merge-robot f33188a0d0 Merge pull request #28060 from yifan-gu/fix_stage1_anno
Automatic merge from submit-queue

rkt: Fix the 'privileged' check when stage1 annotation is provided.

Previously when stage1 annotation is provided, we only checks if
the kubelet allows privileged, which is not useful as that is a global
setting.

Instead, we should check if the pod has explicitly set the privileged
security context to 'true'.

cc @kubernetes/sig-rktnetes @kubernetes/sig-node
2016-06-24 17:58:07 -07:00
k8s-merge-robot 6f8a0c61c1 Merge pull request #27208 from yujuhong/min_docker_version
Automatic merge from submit-queue

Bump minimum API version for docker to 1.21

The corresponding docker version is 1.9.x. Dropping support for docker 1.8.

/cc @kubernetes/sig-node
2016-06-24 17:24:19 -07:00
Yifan Gu 8b1b9120c6 rkt: Fix the 'privileged' check when stage1 annotation is provided.
Previously when stage1 annotation is provided, we only checks if
the kubelet allows privileged, which is not useful as that is a global
setting.

Instead, we should check if the pod has explicitly set the privileged
security context to 'true'.
2016-06-24 16:33:12 -07:00
Buddha Prakash c3551ae6cd Refactor qos package
Signed-off-by: Buddha Prakash <buddhap@google.com>
2016-06-24 15:36:04 -07:00
k8s-merge-robot c4aa7ee0b2 Merge pull request #25024 from xiangpengzhao/fix_typos
Automatic merge from submit-queue

Fix typos in docker.go

Fix minor typos in variable name
2016-06-24 13:56:22 -07:00
Yifan Gu 30c913e211 rkt: Bump required rkt version to 1.9.1. 2016-06-24 13:54:32 -07:00
Davanum Srinivas 8beed4cd8d
Fix pkg/kubelet unit tests fail on OSX
Fixes #27730
2016-06-24 15:58:09 -04:00
Ron Lai 038b8797c4 Calculating the disk usage based on available bytes instead of usage bytes to account for reserved blocks in image GC 2016-06-23 21:41:33 -07:00
k8s-merge-robot 8ed6c8eeb8 Merge pull request #27914 from yifan-gu/fix_kubenet_hostport
Automatic merge from submit-queue

kubenet: Fix host port for rktnetes.

Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.

cc @dcbw @freehan 

A follow up fix for https://github.com/kubernetes/kubernetes/pull/27878#issuecomment-227898936
2016-06-23 18:48:45 -07:00
Yifan Gu 9140ce07bc kubenet: Fix host port for rktnetes.
Because rkt pod runs after plugin.SetUpPod() is called, so
getRunningPods() does not return the newly created pod, which
causes the hostport iptable rules to be missing for this new pod.
2016-06-23 13:17:01 -07:00
Yu-Ju Hong 07b8c61274 Bump minimum API version for docker to 1.21
The corresponding docker version is 1.9.x. Dropping support for docker 1.8.
2016-06-23 10:21:54 -07:00
Kanghua Wang b694fc0688 fix return value
// matchesNodeSelector returns true if pod matches node's labels.
Whether this return value should be false?
2016-06-23 16:14:55 +08:00
k8s-merge-robot 1f78e7ea68 Merge pull request #27905 from freehan/krestart
Automatic merge from submit-queue

avoid deleting cbr0 address due to subnet string mismatch

fix: #27873
2016-06-22 23:01:49 -07:00
k8s-merge-robot 89bb77d3e8 Merge pull request #27737 from yifan-gu/grace_period
Automatic merge from submit-queue

rkt: Refactor grace termination period.

Add `TimeoutStopSec` service option to support grace termination.

Found we can improve the grace-period-termination by adding a systemd service option.

cc @kubernetes/sig-rktnetes
2016-06-22 19:23:25 -07:00
Minhan Xia 48169ce736 avoid deleting cbr0 address due to subnet string mismatch 2016-06-22 16:45:04 -07:00
Dan Williams e47d020cb6 kubelet/kubenet: simplify getting nsenter path 2016-06-22 14:26:11 -05:00
Dan Williams a657d0587b kubelet/kubenet: Fix getRunningPods() to support rkt pods
Don't assume there's an infra container.
2016-06-22 13:45:13 -05:00
Dan Williams db078dbea4 kubelet/cni/kubenet: use common container IP address functions 2016-06-22 11:36:10 -05:00
Dan Williams 9865ac325c kubelet/cni: make cni plugin runtime agnostic
Use the generic runtime method to get the netns path.  Also
move reading the container IP address into cni (based off kubenet)
instead of having it in the Docker manager code.  Both old and new
methods use nsenter and /sbin/ip and should be functionally
equivalent.
2016-06-22 11:36:10 -05:00
Tim St. Clair f2f3caf744 Rename **/manager.go 2016-06-21 15:11:31 -07:00
derekwaynecarr 060e69ae92 Fix typo in filename 2016-06-21 16:56:07 -04:00
k8s-merge-robot c30c49d0df Merge pull request #27376 from derekwaynecarr/eviction_owners
Automatic merge from submit-queue

Add owners file for kubelet eviction

/cc @vishh
2016-06-21 08:43:16 -07:00
k8s-merge-robot a8fecd0cc6 Merge pull request #27639 from pmorie/goodbye-pod-mutation
Automatic merge from submit-queue

Remove pod mutation for volumes annotated with supplemental groups

Removes the pod mutation added in #20490 -- partially resolves #27197 from the standpoint of making the feature inactive in 1.3.  Our plan is to make this work correctly in 1.4.

@kubernetes/sig-storage
2016-06-21 03:18:45 -07:00
k8s-merge-robot ee35555cb6 Merge pull request #27570 from Random-Liu/add-runtime-request-timeout-flag
Automatic merge from submit-queue

Add runtime-request-timeout kubelet flag.

XRef #23563.

Addresses https://github.com/kubernetes/kubernetes/issues/27388#issuecomment-226570083.

Add a new kubelet flag `runtime-request-timeout`, and set to 2 minutes by default.
Now the flag only affects dockertools, rkt may also want to set request timeout according to the flag. @yifan-gu 

This PR also removed the timeout for all long running operations to avoid issues like #27588 and #26122.

@yujuhong @rrati 
/cc @kubernetes/sig-node 

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-21 01:26:54 -07:00
k8s-merge-robot ec518005a8 Merge pull request #27567 from saad-ali/blockKubeletOnAttachController
Automatic merge from submit-queue

Kubelet Volume Manager Wait For Attach Detach Controller and Backoff on Error

* Closes https://github.com/kubernetes/kubernetes/issues/27483
  * Modified Attach/Detach controller to report `Node.Status.AttachedVolumes` on successful attach (unique volume name along with device path).
  * Modified Kubelet Volume Manager wait for Attach/Detach controller to report success before proceeding with attach.
* Closes https://github.com/kubernetes/kubernetes/issues/27492
  * Implemented an exponential backoff mechanism for for volume manager and attach/detach controller to prevent operations (attach/detach/mount/unmount/wait for controller attach/etc) from executing back to back unchecked.
* Closes https://github.com/kubernetes/kubernetes/issues/26679
  * Modified volume `Attacher.WaitForAttach()` methods to uses the device path reported by the Attach/Detach controller in `Node.Status.AttachedVolumes` instead of calling out to cloud providers.
2016-06-20 20:36:08 -07:00
saadali e716ddc771 Controller wait for attach and exponential backoff
Modify attach/detach controller to keep track of volumes to report
attached in Node VolumeToAttach status.

Modify kubelet volume manager to wait for volume to show up in Node
VolumeToAttach status.

Implement exponential backoff for errors in volume manager and attach
detach controller
2016-06-20 18:19:55 -07:00
Yifan Gu 4329ba700f rkt: Refactor grace termination period.
Add `TimeoutStopSec` service option to support grace termination.
2016-06-20 17:18:12 -07:00
Aaron Levy 4a62d8e86f pkg/kubelet: mock stubs for cadvisor calls 2016-06-20 16:33:22 -07:00
Aaron Levy 8c04af7b73 Retrieve host IP in isolation from apiserver 2016-06-20 11:47:32 -07:00
Yifan Gu 4e9298cd99 rkt: Map kubelet's `--stage1-image` flag to rkt's `--stage1-name` flag.
This enables rkt to use cached stage1 image instead of unpacking the
stage1 image every time for every pod.

After this change, users need to preload the stage1 images in order to
enable rkt to find the stage1 image with the name specified by this flag.
2016-06-20 10:39:46 -07:00
k8s-merge-robot 8f5d081194 Merge pull request #27209 from ronnielai/disk-check
Automatic merge from submit-queue

Logging for OutOfDisk when file system info is not available

#26566
1. Adding logs for file system info being not available.
2. Reporting outOfDisk when file system info is not available.
2016-06-19 00:02:59 -07:00
k8s-merge-robot 090e6ff660 Merge pull request #27625 from goltermann/spell2
Automatic merge from submit-queue

Fix several spelling errors in comments

What the title says
2016-06-18 23:08:28 -07:00
k8s-merge-robot 7ee4189cf6 Merge pull request #27036 from sttts/sttts-secure-seccomp-path
Automatic merge from submit-queue

Filter seccomp profile path from malicious .. and /

Without this patch with `localhost/<some-releative-path>` as seccomp profile one can load any file on the host, e.g. `localhost/../../../../dev/mem` which is not healthy for the kubelet.

/cc @jfrazelle 

Unit tests depend on https://github.com/kubernetes/kubernetes/pull/26710.
2016-06-18 15:58:07 -07:00
k8s-merge-robot d80b60ef7c Merge pull request #26934 from dcbw/split-hostport
Automatic merge from submit-queue

kubelet/kubenet: split hostport handling into separate module

This pulls the hostport functionality of kubenet out into a separate module so that it can be more easily tested and potentially used from other code (maybe CNI, maybe downstream consumers like OpenShift, etc).  Couldn't find a mock iptables so I wrote one, but I didn't look very hard.

@freehan @thockin @bprashanth
2016-06-18 15:24:57 -07:00
k8s-merge-robot 77cf11f4d7 Merge pull request #27441 from derekwaynecarr/downward_api_node_defaults
Automatic merge from submit-queue

Revert revert of downward api node defaults

Reverts the revert of https://github.com/kubernetes/kubernetes/pull/27439

Fixes #27062

@dchen1107 - who at Google can help debug why this caused issues with GKE infrastructure but not GCE merge queue?

/cc @wojtek-t @piosz @fgrzadkowski @eparis @pmorie
2016-06-18 12:12:24 -07:00
Random-Liu 3cc9ca3988 Add timeout for rkt requests. 2016-06-17 18:18:41 -07:00
Random-Liu 52ebd4ecf1 Add runtime-request-timeout kubelet flag. 2016-06-17 18:18:41 -07:00
k8s-merge-robot 04fd079d09 Merge pull request #27597 from dchen1107/kubectl
Automatic merge from submit-queue

No timeout for kubectl logs

Fix #27588

cc/ @smarterclayton
2016-06-17 17:48:15 -07:00
Daniel Smith 22d3267188 Merge pull request #27387 from yujuhong/sources_ready
kubelet: don't GC containers of deleted pods until all sources are ready
2016-06-17 16:01:31 -07:00
Paul Morie a573a0eda3 Remove pod mutation for volumes annotated with supplemental groups 2016-06-17 15:36:56 -04:00
derekwaynecarr 18a206ad56 Downward API defaults resource limits to node capacity/allocatable 2016-06-17 14:18:18 -04:00
goltermann 218645b346 Fix several spelling errors in comments. 2016-06-17 10:41:18 -07:00
k8s-merge-robot 1444cbf594 Merge pull request #27525 from wojtek-t/network_unavailable_only_in_gce
Automatic merge from submit-queue

Don't set NetworkUnavailable condition in non-GCE/GKE clouds

Ref #27347

@davidopp @erictune @justinsb @simonswine
2016-06-17 09:08:50 -07:00
k8s-merge-robot fd7803cdbb Merge pull request #27229 from pmorie/pod-manager-godoc
Automatic merge from submit-queue

Godoc for kubelet pod manager

Improve godoc for pod manager and mirror client.

@kubernetes/sig-node
2016-06-17 08:15:58 -07:00
k8s-merge-robot 983b478ff4 Merge pull request #27042 from lukaszo/logs
Automatic merge from submit-queue

Fix kubectl logs for init containers
2016-06-17 05:01:04 -07:00
Dawn Chen 8f5cadeae9 No timeout for kubectl logs 2016-06-16 20:36:59 -07:00
xiangpengzhao 28286d6890 Refactor func canRunPod 2016-06-16 21:36:07 -04:00
Jing Liu ef66f1ead8 improve iptables-restore implementation #27559
- improve restoreInternal implementation in iptables
- add SetStdin and SetStdout functions to Cmd interface
- modify kubelet/prober and some tests in order to work with Cmd interface
2016-06-16 12:19:34 -07:00
Dan Williams a519e8a403 kubenet: clean up networking when setup errors occur
Relying on the runtime to later call cleanup is fragile, so make sure
that everything gets nicely cleaned up when setup errors occur.
2016-06-16 13:53:28 -05:00
Dan Williams 965492fdd0 kubelet/kubenet: split hostport handling into separate module 2016-06-16 13:44:32 -05:00
Yu-Ju Hong f279e36292 Don't remove all containers of deleted pods until sources are ready
Without this fix, kubelet may assume a pod from a not-ready source has already
been deleted, and GC all its dead containers.
2016-06-16 10:47:12 -07:00
Wojciech Tyczynski f24f6102a9 Don't set NetworkUnavailable condition in non-GCE/GKE clouds 2016-06-16 09:40:49 +02:00
Yu-Ju Hong 9bc2b43064 Set the podAttachAndMountTimeout to a lower value
If the mount operation exceeds the timeout, it will return an error and the
pod worker will retry in the next sync (10s or less). Compared with the
original value (i.e., 10 minutes), this frees the pod worker sooner to process
pod updates, if there are any.
2016-06-15 16:01:15 -07:00
saadali 542f2dc708 Introduce new kubelet volume manager
This commit adds a new volume manager in kubelet that synchronizes
volume mount/unmount (and attach/detach, if attach/detach controller
is not enabled).

This eliminates the race conditions between the pod creation loop
and the orphaned volumes loops. It also removes the unmount/detach
from the `syncPod()` path so volume clean up never blocks the
`syncPod` loop.
2016-06-15 09:34:08 -07:00
saadali 9b6a505f8a Rename UniqueDeviceName to UniqueVolumeName
Rename UniqueDeviceName to UniqueVolumeName and move helper functions
from attacherdetacher to volumehelper package.
Introduce UniquePodName alias
2016-06-15 09:32:12 -07:00
Piotr Szczesniak 51af487b5f Revert "Downward api node defaults" 2016-06-15 15:47:49 +02:00
derekwaynecarr 8ea7998c7d Add owners file for kubelet eviction 2016-06-14 13:30:23 -04:00
derekwaynecarr 712860d55f Fix downward API for resource limits 2016-06-14 12:49:00 -04:00
Vishnu kannan afdd9ea262 When limits are not set, use capacity as limits in downward API for resources.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-06-14 11:29:39 -04:00
Dr. Stefan Schimanski 3826d2598c Move seccomp annotation validation into api/validation 2016-06-14 14:58:32 +02:00
Euan Kemp c7a60fd99a kubelet: Remove stack alloc
Presumably this was accidental leftover debug info
2016-06-13 14:04:22 -07:00
Ron Lai 8d6cdd5d1b Adding logs for file system info being not available. 2016-06-13 11:10:38 -07:00
Yifan Gu 03ee60c810 rkt: Updated the TestMakePodManifestAnnotations(). 2016-06-13 09:43:15 -07:00
Yifan Gu f2bf13a5ac rkt: Treat pod container cgroup as the infra container. 2016-06-13 09:43:10 -07:00
Paul Morie 8dafc776de Godoc for kubelet pod manager 2016-06-13 10:54:01 -04:00
Łukasz Oleś 07d13c1fb4 Fix kubectl logs for init containers
Related issues: #25818 #27040
2016-06-13 15:12:40 +02:00
Dr. Stefan Schimanski 04dc6dbf17 Add profile unit tests 2016-06-13 14:39:09 +02:00
Dr. Stefan Schimanski 6c54ceb0e4 Filter seccomp profile path from malicious .. and / 2016-06-13 14:39:09 +02:00
Xiangpeng Zhao 33039c2883 Fix typos in docker.go 2016-06-13 03:01:29 -04:00
k8s-merge-robot d935a02c64 Merge pull request #27101 from caesarxuchao/add-deletiontimestamp-log
Automatic merge from submit-queue

Let kubelet log the DeletionTimestamp if it's not nil in update

This helps to debug if it's the kubelet to blame when a pod is not deleted. 

Example output:
```
SyncLoop (UPDATE, "api"): "redis-master_default(c6782276-2dd4-11e6-b874-64510650ab1c):DeletionTimestamp=2016-06-08T23:58:12Z"
```

ref #26290
cc @Random-Liu
2016-06-12 22:56:43 -07:00
k8s-merge-robot da6d348b1c Merge pull request #26767 from ZTE-PaaS/249043822-patch-2
Automatic merge from submit-queue

Update reason_cache.go, Get method operate lru cache not threadsafe

The reason_cache wrapped lru cache , lru cache modies linked list even for a get, should use WLock for both read and write
2016-06-12 21:18:14 -07:00
k8s-merge-robot 5d6397e9ee Merge pull request #27017 from yujuhong/rm_version
Automatic merge from submit-queue

Fix docker api version in kubelet

There are two variables `dockerv110APIVersion` and `dockerV110APIVersion` with
the same purpose, but different values. Remove the incorrect one and fix usage
in the file.

/cc @dchen1107 @Random-Liu
2016-06-12 19:31:06 -07:00
k8s-merge-robot 55dbcee4dc Merge pull request #26586 from derekwaynecarr/fix_runtime_stats
Automatic merge from submit-queue

Fix system container detection

```release-note
Fix system container detection in kubelet on systemd.

This fixed environments where CPU and Memory Accounting were not enabled on the unit 
that launched the kubelet or docker from reporting the root cgroup when 
monitoring usage stats for those components.
```

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

/cc @vishh @ncdc @eparis @wojtek-t - this reverts the revert https://github.com/kubernetes/kubernetes/issues/26478

This should merge when node e2e setups were updated per https://github.com/kubernetes/kubernetes/pull/26289
2016-06-11 16:19:03 -07:00
k8s-merge-robot 911e84ed1e Merge pull request #26710 from sttts/sttts-fix-seccomp-annotations
Automatic merge from submit-queue

Move /seccomp/ into domain prefix in seccomp annotations

Fixes #26610.

/cc @mdshuai @ncdc @jfrazelle
2016-06-11 07:03:50 -07:00
k8s-merge-robot 64da66bab4 Merge pull request #24983 from Arvinderpal/cni_args_ignoreunknown
Automatic merge from submit-queue

Sets IgnoreUnknown=1 in CNI_ARGS

```release-note
release-note-none
```

K8 uses CNI_ARGS to pass pod namespace, name and infra container
id to the CNI network plugin. CNI logic will throw an error
if these args are not known to it, unless the user specifies
IgnoreUnknown as part of CNI_ARGS. This PR sets IgnoreUnknown=1
to prevent the CNI logic from erroring and blocking pod setup.
https://github.com/appc/cni/pull/158
https://github.com/appc/cni/issues/126
2016-06-11 05:38:30 -07:00
Yifan Gu edc946e081 rkt: Error out when the gid is empty.
Since appc requires gid to be non-empty today (https://github.com/appc/spec/issues/623),
we have to error out when gid is empty instead of using the root gid.
2016-06-10 18:48:14 -07:00
derekwaynecarr 08cdc0ef4f Fix system container detection 2016-06-10 16:49:16 -04:00
k8s-merge-robot 07f72acaa2 Merge pull request #27098 from yifan-gu/rkt_getlog
Automatic merge from submit-queue

rkt: Replace 'journalctl' with rkt's GetLogs() API.

This replaced the `journactl` shell out with rkt's GetLogs() API.
Fixes #26997 

To make this fully work, we need rkt to have this patch #https://github.com/coreos/rkt/pull/2763

cc @kubernetes/sig-node @euank @alban @iaguis @jonboulle
2016-06-10 01:54:05 -07:00
k8s-merge-robot 805a0aae71 Merge pull request #27141 from freehan/hpfix
Automatic merge from submit-queue

only handled non host network pods for hostports in kubenet

attempt to fix: #27118
2016-06-09 22:08:10 -07:00
k8s-merge-robot 1cfa84c1e1 Merge pull request #27015 from yifan-gu/kvm_network
Automatic merge from submit-queue

rkt: Do not run rkt pod inside a pre-created netns when network plugin is no-op

This fixed a panic where the returned pod network status is nil. (Fix #26540)

Also this makes lkvm stage1 able to run inside a user defined network, where the network name needs to be 'rkt.kubernetes.io'. A temporal solution to solve the network issue for lkvm stage1.
    
Besides, I fixed minor issues such as passing the wrong pod UID when cleaning up the netns file.

/cc @euank @pskrzyns @jellonek @kubernetes/sig-node 

I tested with no networkplugin locally, works fine. 

As a reminder, we need to document this in the release.https://github.com/kubernetes/kubernetes/issues/26201
2016-06-09 21:26:26 -07:00
k8s-merge-robot e54ebe5ebd Merge pull request #27132 from freehan/kubenetmasq
Automatic merge from submit-queue

turn off cni masqurade and manage it in kubenet

fixes #27110
2016-06-09 20:44:13 -07:00
Yifan Gu d69351b83a rkt: Replace 'journalctl' with rkt's GetLogs() API.
Also fixed a bug where 'journalctl -f' process leaks when the kubelet
is killed.
2016-06-09 20:02:53 -07:00
Yifan Gu 5a9ea30814 rkt: Do not run rkt pod inside a pre-created netns when network plugin is no-op.
This fixed a panic where the returned pod network status is nil.
Also this makes lkvm stage1 able to run inside a user defined
network, where the network name needs to be 'rkt.kubernetes.io'.

Also fixed minor issues such as passing the wrong pod UID, ignoring
logging errors.
2016-06-09 19:38:07 -07:00
k8s-merge-robot 7c4c19f623 Merge pull request #26936 from yifan-gu/fix_selinux
Automatic merge from submit-queue

rkt: Fix incomplete selinux context string when the option is partial.

Fix "EmptyDir" e2e tests failures caused by #https://github.com/kubernetes/kubernetes/pull/24901

As mentioned in https://github.com/kubernetes/kubernetes/pull/24901#discussion_r61372312
We should apply the selinux context of the rkt data directory (/var/lib/rkt) when users do not specify all the selinux options.

Due to my fault, the change was missed during rebase, thus caused the regression.

After applying this PR, the e2e tests passed.
```
$ go run hack/e2e.go -v -test --test_args="--ginkgo.dryRun=false --ginkgo.focus=EmptyDir"
...
Ran 19 of 313 Specs in 199.319 seconds
SUCCESS! -- 19 Passed | 0 Failed | 0 Pending | 294 Skipped PASS
```

BTW, the test is removed because the `--no-overlay=true` flag will only be there on non-coreos distro.

cc @euank @kubernetes/sig-node
2016-06-09 19:14:08 -07:00
Minhan Xia 1276a91638 kubenet masqurade for outbound traffic 2016-06-09 18:43:34 -07:00
Minhan Xia 1b2386f1ce only handled non host network pods for hostports in kubenet 2016-06-09 11:32:16 -07:00
k8s-merge-robot 7932158540 Merge pull request #26974 from pmorie/log-spam
Automatic merge from submit-queue

Reduce log spam in dockertools manager.go

Fixes #26972

@kubernetes/sig-node
2016-06-09 02:43:30 -07:00
k8s-merge-robot a5cd171c2f Merge pull request #25064 from Clarifai/httpheaders-querystring
Automatic merge from submit-queue

Preserve query strings in HTTP probes instead of escaping them

Fixes a problem reported on Slack by devth.

```release-note
* Allow the use of query strings and URI fragments in HTTP probes
```

This might also preserve fragments, for those crazy enough to pass them.

I am using url.Parse() on the path in order to get path/query/fragment
and also deliberately avoiding the addition of more fields to the API.
2016-06-09 01:15:47 -07:00
Chao Xu ccecc59ff2 In kubelet's handler of pod update, prints out deletiontimestamp if it's not nil 2016-06-08 23:48:40 -07:00
Paul Morie 0a0797a680 Reduce log spam in dockertools manager.go 2016-06-08 12:41:37 -04:00
Yu-Ju Hong 8866a894e4 Fix docker api version in kubelet
There are two variables `dockerv110APIVersion` and `dockerV110APIVersion` with
the same purpose, but different values. Remove the incorrect one and fix usage
in the file.
2016-06-07 17:51:36 -07:00
Łukasz Oleś 2b46aea495 Custom sort function for InitContainersStatuses
Order in init container statuses should be the same as defined in pod.
Statues shoudln't be sorted by name.
2016-06-07 23:57:23 +02:00
Yifan Gu 8596d25ad5 rkt: Fix incomplete selinux context string when the option is partial.
Add Getfilecon() into the selinux interface.
2016-06-07 14:43:35 -07:00
k8s-merge-robot 2cc0f2f040 Merge pull request #25280 from timothysc/http2_clients
Automatic merge from submit-queue

Option to enable http2 on client connections.

Addresses #21081

Enables http2 connection by default.  

before:
``` 
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      21868/kubelet       
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      21924/kube-proxy    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      754/sshd            
tcp        0      0 192.2.5.12:47080        192.2.5.11:443          ESTABLISHED 21924/kube-proxy    
tcp        0      0 192.2.5.12:47082        192.2.5.11:443          ESTABLISHED 21924/kube-proxy    
tcp        0      0 192.2.5.12:55776        169.254.169.254:80      ESTABLISHED 21868/kubelet       
tcp        0    304 192.2.5.12:22           192.2.5.10:49978        ESTABLISHED 22287/sshd: root [p 
tcp        0      0 192.2.5.12:34568        192.2.5.11:2379         ESTABLISHED 3029/flanneld       
tcp        0      0 192.2.5.12:55774        169.254.169.254:80      ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:47086        192.2.5.11:443          ESTABLISHED 21924/kube-proxy    
tcp        0      0 192.2.5.12:47102        192.2.5.11:443          ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:47108        192.2.5.11:443          ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:55772        169.254.169.254:80      ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:47104        192.2.5.11:443          ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:34718        192.2.5.11:2379         ESTABLISHED 3029/flanneld       
tcp        0      0 192.2.5.12:47110        192.2.5.11:443          ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:47106        192.2.5.11:443          ESTABLISHED 21868/kubelet       
tcp        0      0 192.2.5.12:47084        192.2.5.11:443          ESTABLISHED 21924/kube-proxy    
tcp6       0      0 :::4194                 :::*                    LISTEN      21868/kubelet       
tcp6       0      0 :::10250                :::*                    LISTEN      21868/kubelet       
tcp6       0      0 :::10255                :::*                    LISTEN      21868/kubelet       
tcp6       0      0 :::22                   :::*                    LISTEN      754/sshd            
tcp6       0      0 192.2.5.12:10255        192.2.5.15:41570        ESTABLISHED 21868/kubelet       
udp        0      0 0.0.0.0:8472            0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:22824           0.0.0.0:*                           600/dhclient        
udp        0      0 0.0.0.0:68              0.0.0.0:*                           600/dhclient        
udp6       0      0 :::4195                 :::*                                600/dhclient 
```

after
```
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      16962/kubelet       
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      17024/kube-proxy    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      754/sshd            
tcp        0      0 192.2.5.12:47046        192.2.5.11:443          ESTABLISHED 17024/kube-proxy    
tcp        0      0 192.2.5.12:47052        192.2.5.11:443          ESTABLISHED 16962/kubelet       
tcp        0      0 192.2.5.12:34568        192.2.5.11:2379         ESTABLISHED 3029/flanneld       
tcp        0      0 192.2.5.12:55720        169.254.169.254:80      ESTABLISHED 16962/kubelet       
tcp        0      0 192.2.5.12:55724        169.254.169.254:80      ESTABLISHED 16962/kubelet       
tcp        0      0 192.2.5.12:34718        192.2.5.11:2379         ESTABLISHED 3029/flanneld       
tcp        0      0 192.2.5.12:55726        169.254.169.254:80      ESTABLISHED 16962/kubelet       
tcp        0    304 192.2.5.12:22           192.2.5.10:49938        ESTABLISHED 17653/sshd: root [p 
tcp6       0      0 :::4194                 :::*                    LISTEN      16962/kubelet       
tcp6       0      0 :::10250                :::*                    LISTEN      16962/kubelet       
tcp6       0      0 :::10255                :::*                    LISTEN      16962/kubelet       
tcp6       0      0 :::22                   :::*                    LISTEN      754/sshd            
tcp6       0      0 192.2.5.12:10255        192.2.5.15:41472        ESTABLISHED 16962/kubelet       
udp        0      0 0.0.0.0:8472            0.0.0.0:*                           -                   
udp        0      0 0.0.0.0:22824           0.0.0.0:*                           600/dhclient        
udp        0      0 0.0.0.0:68              0.0.0.0:*                           600/dhclient        
udp6       0      0 :::4195                 :::*                                600/dhclient
```

/cc @jeremyeder
2016-06-06 10:22:49 -07:00
Dr. Stefan Schimanski 12346d5171 Fix seccomp prefix check 2016-06-06 14:08:17 +02:00
Dr. Stefan Schimanski ad6bd78007 Move /seccomp/ into domain prefix in seccomp annotations
Double slashes are not allowed in annotation keys. Moreover, using the 63
characters of the name component in an annotation key will shorted the space
for the container name.
2016-06-06 14:08:17 +02:00
Yifan Gu 3699b70b00 rkt: Refactor the systemd interface.
Replace shell out calls with dbus API calls.
Remove unused 'Reload()'.
2016-06-06 05:27:08 +00:00
k8s-merge-robot 8e091e254f Merge pull request #26666 from euank/fix-wrong-err
Automatic merge from submit-queue

rkt: Wrap exec errors as utilexec.ExitError

This is needed by the exec prober to distinguish error types and exit
codes correctly. Without this, the exec prober used for liveness probes
doesn't identify errors correctly and restarts aren't triggered. Fixes #26456

An alternative, and preferable solution would be to use utilexec
everywhere, but that change is much more involved and should come at a
later date. Unfortunately, until that change is made, writing tests for
this is quite difficult.

cc @yifan-gu @sjpotter
2016-06-04 05:11:16 -07:00
k8s-merge-robot c1392ec51a Merge pull request #26747 from freehan/kubenetdir
Automatic merge from submit-queue

pass NetworkPluginDir to kubenet

to unblock GCI kubenet integration #26379

cc: @andyzheng0831
2016-06-03 15:38:09 -07:00
Minhan Xia e9f8c70eaf pass NetworkPluginDir to kubenet 2016-06-03 10:22:49 -07:00
k8s-merge-robot d93f80c86b Merge pull request #26677 from Random-Liu/add-image-pull-timeout
Automatic merge from submit-queue

Add timeout for image pulling

Fix #26300.

With this PR, if image pulling makes no progress for *1 minute*, the operation will be cancelled. Docker reports progress for every 512kB block (See [here](3d13fddd2b/pkg/progress/progressreader.go (L32))), *512kB/min* means the throughput is *<= 8.5kB/s*, which should be kind of abnormal?

It's a little hard to write unit test for this, so I just manually tested it. If I set the `defaultImagePullingStuckTimeout` to 0s, and `defaultImagePullingProgressReportInterval` to 1s, image pulling will be cancelled.
```
E0601 18:48:29.026003   46185 kube_docker_client.go:274] Cancel pulling image "nginx:latest" because of no progress for 0, latest progress: "89732b811e7f: Pulling fs layer "
E0601 18:48:29.026308   46185 manager.go:2110] container start failed: ErrImagePull: net/http: request canceled
```

/cc @kubernetes/sig-node 
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-06-03 04:02:20 -07:00
KeZhang f76510d99e Update reason_cache.go 2016-06-03 16:33:36 +08:00
k8s-merge-robot 75ef1ca270 Merge pull request #26351 from saad-ali/attachDetachControllerKubeletChanges
Automatic merge from submit-queue

Attach/Detach Controller Kubelet Changes

This PR contains changes to enable attach/detach controller proposed in #20262.

Specifically it:
* Introduces a new `enable-controller-attach-detach` kubelet flag to enable control by attach/detach controller. Default enabled.
* Removes all references `SafeToDetach` annotation from controller.
* Adds the new `VolumesInUse` field to the Node Status API object.
* Modifies the controller to use `VolumesInUse` instead of `SafeToDetach` annotation to gate detachment.
* Modifies kubelet to set `VolumesInUse` before Mount and after Unmount.
  * There is a bug in the `node-problem-detector` binary that causes `VolumesInUse` to get reset to nil every 30 seconds. Issue https://github.com/kubernetes/node-problem-detector/issues/9#issuecomment-221770924 opened to fix that.
  * There is a bug here in the mount/unmount code that prevents resetting `VolumeInUse in some cases, this will be fixed by mount/unmount refactor.
* Have controller process detaches before attaches so that volumes referenced by pods that are rescheduled to a different node are detached first.
* Fix misc bugs in controller.
* Modify GCE attacher to: remove retries, remove mutex, and not fail if volume is already attached or already detached.

Fixes #14642, #19953

```release-note
Kubernetes v1.3 introduces a new Attach/Detach Controller. This controller manages attaching and detaching volumes on-behalf of nodes that have the "volumes.kubernetes.io/controller-managed-attach-detach" annotation.

A kubelet flag, "enable-controller-attach-detach" (default true), controls whether a node sets the "controller-managed-attach-detach" or not.
```
2016-06-02 23:30:32 -07:00
Saad Ali 9dbe943491 Attach/Detach Controller Kubelet Changes
This PR contains Kubelet changes to enable attach/detach controller control.
* It introduces a new "enable-controller-attach-detach" kubelet flag to
  enable control by controller. Default enabled.
* It removes all references "SafeToDetach" annoation from controller.
* It adds the new VolumesInUse field to the Node Status API object.
* It modifies the controller to use VolumesInUse instead of SafeToDetach
  annotation to gate detachment.
* There is a bug in node-problem-detector that causes VolumesInUse to
  get reset every 30 seconds. Issue https://github.com/kubernetes/node-problem-detector/issues/9
  opened to fix that.
2016-06-02 16:47:11 -07:00
k8s-merge-robot 4c316979c8 Merge pull request #25851 from euank/fixJournaldUsage
Automatic merge from submit-queue

rkt: Get logs via syslog identifier

This change works around https://github.com/coreos/rkt/issues/2630
Without this change, logs cannot reliably be collected for containers
with short lifetimes.

With this change, logs cannot be collected on rkt versions v1.6.0 and
before.

I'd like to also bump the required rkt version, but I don't want to do that until there's a released version that can be pointed to (so the next rkt release).

I haven't added tests (which were missing) because this code will be removed if/when logs are retrieved via the API. I have run E2E tests with this merged in and verified the tests which previously failed no longer fail.

cc @yifan-gu
2016-06-02 15:53:39 -07:00
Random-Liu 49c8683c24 Add timeout for image pulling 2016-06-02 10:49:17 -07:00
k8s-merge-robot a27058156f Merge pull request #24901 from yifan-gu/support_selinux
Automatic merge from submit-queue

rkt: Add pod selinux support.

Currently only pod level selinux context is supported, besides when
running selinux, we will not be able to use the overlay fs, see:
https://github.com/coreos/rkt/issues/1727#issuecomment-173203129.


cc @kubernetes/sig-node  @alban @mjg59 @pmorie
2016-06-02 07:48:02 -07:00
Euan Kemp 40efc0fb33 rkt: Wrap exec errors as utilexec.ExitError
This is needed by the exec prober to distinguish error types and exit
codes correctly.

An alternative, and preferable solution would be to use utilexec
everywhere, but that change is much more involved and should come at a
later date. Unfortunately, until that change is made, writing tests for
this is quite difficult.
2016-06-01 15:34:49 -07:00
Yifan Gu 0a7537ecbf rkt: Add pod selinux support.
Currently only pod level selinux context is supported, besides when
running selinux, for now we will not be able to use the overlay fs
except for coreos, see:
https://github.com/coreos/rkt/issues/1727#issuecomment-173203129.
2016-06-02 00:55:27 +08:00
k8s-merge-robot 6277eea57b Merge pull request #26200 from yifan-gu/remove_systemd_quotes
Automatic merge from submit-queue

rkt: Remove quotes in the systemd ExecStart command.

cc @euank @dcbw
2016-06-01 03:13:19 -07:00
Euan Kemp f028a9f410 rkt: Update minimum rkt version to 1.7.0
Also remove the redundant `appcVersion` check, that version should
already be captured in the rkt version
2016-05-31 15:24:51 -07:00
Euan Kemp d0a31873d7 rkt: Get logs via syslog identifier
This change works around https://github.com/coreos/rkt/issues/2630
Without this change, logs cannot reliably be collected for containers
with short lifetimes.

With this change, logs cannot be collected on rkt versions v1.6.0 and
before.
2016-05-31 15:23:46 -07:00
Yifan Gu 6cb87e8d69 rkt: Remove quotes in the systemd ExecStart command.
With quotes, the service doesn't start for systemd 219 with the error
saying the path of the netns cannot be found.

This PR fixes the bug by removing the quotes surround the netns path.
2016-05-31 22:16:42 +08:00
Yifan Gu 1d40f471b4 rkt: Fix docker auth config save directory to avoid race. 2016-05-30 20:40:31 +08:00
k8s-merge-robot 77de942e08 Merge pull request #26451 from Random-Liu/cache_image_history
Automatic merge from submit-queue

Kubelet: Cache image history to eliminate the performance regression

Fix https://github.com/kubernetes/kubernetes/issues/25057.

The image history operation takes almost 50% of cpu usage in kubelet performance test. We should cache image history instead of getting it from runtime everytime.

This PR cached image history in imageStatsProvider and added unit test.

@yujuhong @vishh 
/cc @kubernetes/sig-node 

Mark v1.3 because this is a relatively significant performance regression.

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-05-29 20:49:01 -07:00
k8s-merge-robot 32da727ca1 Merge pull request #26264 from luxas/remove_flannel_default
Automatic merge from submit-queue

Do not call NewFlannelServer() unless flannel overlay is enabled

Ref: #26093 

This makes so kubelet does not warn the user that iptables isn't in PATH, although the user didn't enable the flannel overlay.

@vishh @freehan @bprashanth
2016-05-29 15:49:00 -07:00
k8s-merge-robot eed13d702f Merge pull request #26253 from xiangpengzhao/fix_assertnotnil
Automatic merge from submit-queue

Add assert.NotNil for test case

I hardcode the `DefaultInterfaceName` from `eth0` to `eth-k8sdefault` at release 1.2.0,  in order to test my CNI plugins. When running the test, it panics and prints wrongly formatted messages as below.

In the test case `TestBuildSummary`, `containerInfoV2ToNetworkStats` will return `nil` if `DefaultInterfaceName` is not `eth0`. So maybe we should add `assert.NotNil` to the test case.

```
ok      k8s.io/kubernetes/pkg/kubelet/server    0.591s
W0523 03:25:28.257074    2257 summary.go:311] Missing default interface "eth-k8sdefault" for s%!(EXTRA string=node:FooNode)
W0523 03:25:28.257322    2257 summary.go:311] Missing default interface "eth-k8sdefault" for s%!(EXTRA string=pod:test0_pod1)
W0523 03:25:28.257361    2257 summary.go:311] Missing default interface "eth-k8sdefault" for s%!(EXTRA string=pod:test0_pod0)
W0523 03:25:28.257419    2257 summary.go:311] Missing default interface "eth-k8sdefault" for s%!(EXTRA string=pod:test2_pod0)
--- FAIL: TestBuildSummary (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x471817]

goroutine 16 [running]:
testing.func·006()
        /usr/src/go/src/testing/testing.go:441 +0x181
k8s.io/kubernetes/pkg/kubelet/server/stats.checkNetworkStats(0xc20806d3b0, 0x140bbc0, 0x4, 0x0, 0x0)
        /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/server/stats/summary_test.go:296 +0xc07
k8s.io/kubernetes/pkg/kubelet/server/stats.TestBuildSummary(0xc20806d3b0)
        /go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/server/stats/summary_test.go:124 +0x11d2
testing.tRunner(0xc20806d3b0, 0x1e43180)
        /usr/src/go/src/testing/testing.go:447 +0xbf
created by testing.RunTests
        /usr/src/go/src/testing/testing.go:555 +0xa8b
```
2016-05-29 14:13:00 -07:00
k8s-merge-robot 98af443209 Merge pull request #26398 from euank/various-kubenet-fixes
Automatic merge from submit-queue

Various kubenet fixes (panics and bugs and cidrs, oh my)

This PR fixes the following issues:

1. Corrects an inverse error-check that prevented `shaper.Reset` from ever being called with a correct ip address
2. Fix an issue where `parseCIDR` would fail after a kubelet restart due to an IP being stored instead of a CIDR being stored in the cache.
3. Fix an issue where kubenet could panic in TearDownPod if it was called before SetUpPod (e.g. after a kubelet restart).. because of bug number 1, this didn't happen except in rare situations (see 2 for why such a rare situation might happen)

This adds a test, but more would definitely be useful.
The commits are also granular enough I could split this up more if desired.

I'm also not super-familiar with this code, so review and feedback would be welcome.

Testing done:
```
$ cat examples/egress/egress.yml
 apiVersion: v1
kind: Pod
metadata:
  labels:
    name: egress
  name: egress-output
  annotations: {"kubernetes.io/ingress-bandwidth": "300k"}
spec:
  restartPolicy: Never
  containers:
    - name: egress
      image: busybox
      command: ["sh", "-c", "sleep 60"]
$ cat kubelet.log
...
Running: tc filter add dev cbr0 protocol ip parent 1:0 prio 1 u32 match ip dst 10.0.0.5/32 flowid 1:1
# setup
...
Running: tc filter del dev cbr0 parent 1:proto ip prio 1 handle 800::800 u32
# teardown
```

I also did various other bits of manual testing and logging to hunt down the panic and other issues, but don't have anything to paste for that 

cc @dcbw @kubernetes/sig-network
2016-05-29 04:04:22 -07:00
k8s-merge-robot 577cdf937d Merge pull request #26415 from wojtek-t/network_not_ready
Automatic merge from submit-queue

Add a NodeCondition "NetworkUnavaiable" to prevent scheduling onto a node until the routes have been created 

This is new version of #26267 (based on top of that one).

The new workflow is:
- we have an "NetworkNotReady" condition
- Kubelet when it creates a node, it sets it to "true"
- RouteController will set it to "false" when the route is created
- Scheduler is scheduling only on nodes that doesn't have "NetworkNotReady ==true" condition

@gmarek @bgrant0607 @zmerlynn @cjcullen @derekwaynecarr @danwinship @dcbw @lavalamp @vishh
2016-05-29 03:06:59 -07:00
k8s-merge-robot d00dec7825 Merge pull request #26397 from euank/fixReadOnlyRootfsPanic
Automatic merge from submit-queue

rkt: Fix panic in setting ReadOnlyRootFS

What the title says. I wish this method were broken out in a reasonably unit testable way. fixing this panic is more important for the second though, testing will come in a later commit.

I observed the panic in a `./hack/local-up-cluster.sh` run with rkt as the container runtime.

This is also the panic that's failing our jenkins against master ([recent run](https://console.cloud.google.com/m/cloudstorage/b/rktnetes-jenkins/o/logs/kubernetes-e2e-gce/1946/artifacts/jenkins-e2e-minion-group-qjh3/kubelet.log for the log output of a recent run))

cc @tmrts @yifan-gu
2016-05-29 02:17:09 -07:00
k8s-merge-robot 344f26ae69 Merge pull request #26145 from Random-Liu/image-pulling-progress
Automatic merge from submit-queue

Kubelet: Periodically reporting image pulling progress in log

Addresses https://github.com/kubernetes/kubernetes/issues/26075#issuecomment-221129896 and https://github.com/kubernetes/kubernetes/pull/26122#issuecomment-221128397.

This PR changes kube_docker_client to log pulling progress every *10* seconds. We can't print all progress messages into the log, because there are too many. So I make it report newest progress every 10 seconds to reduce log spam.
If the image pulling is too slow or stuck, we'll see image pulling progress unchanged or changed little overtime.

The following is the result if I set the reporting interval to *1* second.
```
I0524 00:53:26.189086  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "17b6a9e179d7: Pulling fs layer "
I0524 00:53:27.189082  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "202e40f8bb3a: Download complete "
I0524 00:53:28.189160  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Downloading [=>                                                 ] 1.474 MB/48.35 MB"
I0524 00:53:29.189156  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Downloading [====>                                              ] 3.931 MB/48.35 MB"
I0524 00:53:30.189089  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Downloading [=========>                                         ] 8.847 MB/48.35 MB"
I0524 00:53:31.189089  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Downloading [==================>                                ] 18.19 MB/48.35 MB"
I0524 00:53:32.189076  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Downloading [=======================================>           ] 38.34 MB/48.35 MB"
I0524 00:53:33.189106  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Extracting [=============>                                     ] 12.78 MB/48.35 MB"
I0524 00:53:34.189067  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Extracting [==================================>                ] 33.42 MB/48.35 MB"
I0524 00:53:35.189083  145099 kube_docker_client.go:252] Pulling image "ubuntu:latest": "487bffc61de6: Extracting [==================================================>] 48.35 MB/48.35 MB"
I0524 00:53:35.376667  145099 kube_docker_client.go:254] Finish pulling image "ubuntu:latest": "Status: Downloaded newer image for ubuntu:latest"
```

Ref image pulling related issue #19077.

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

@yujuhong @dchen1107 
/cc @kubernetes/sig-node
2016-05-28 13:34:28 -07:00
k8s-merge-robot 350efaf13d Merge pull request #26096 from euank/set-pod-ip
Automatic merge from submit-queue

rkt: Pass through podIP

This is needed for the /etc/hosts mount and the downward API to work.
Furthermore, this is required for the reported `PodStatus` to be
correct.

The `Status` bit mostly worked prior to #25062, and this restores that
functionality in addition to the new functionality.

In retrospect, the regression in status is large enough the prior PR should have included at least some of this; my bad for not realizing the full implications there.

#25902 is needed for downwards api stuff, but either merge order is fine as neither will break badly by itself.

cc @yifan-gu @dcbw
2016-05-28 12:40:39 -07:00
k8s-merge-robot 03fc51f74f Merge pull request #26046 from timoreimann/stabilize-map-order-in-kubectl-describe
Automatic merge from submit-queue

Stabilize map order in kubectl describe

Refs #25251.

Add `SortedResourceNames()` methods to map type aliases in order to achieve stable output order for `kubectl` descriptors.

This affects QoS classes, resource limits, and resource requests.

A few remarks:

1. I couldn't find map usages for described fields other than the ones mentioned above. Then again, I failed to identify those programmatically/systematically. Pointers given, I'd be happy to cover any gaps within this PR or along additional ones.
1. It's somewhat difficult to deterministically test a function that brings reliable ordering to Go maps due to its randomizing nature. None of the possibilities I came up with (rely a "probabilistic testing" against repeatedly created maps, add complexity through additional interfaces) seemed very appealing to me, so I went with testing my `sort.Interface` implementation and the changed logic in `kubectl.describeContainers()`.
1. It's apparently not possible to implement a single function that sorts any map's keys generically in Go without producing lots of boilerplate: a `map[<key type>]interface{}` is different from any other map type and thus requires explicit iteration on the caller site to convert back and forth. Unfortunately, this makes it hard to completely avoid code/test duplication.

Please let me know what you think.
2016-05-28 10:49:57 -07:00
Wojciech Tyczynski fcfaf1a3bd Revert "Fix system container detection in kubelet on systemd" 2016-05-28 16:11:53 +02:00
k8s-merge-robot c730198aad Merge pull request #25982 from derekwaynecarr/fix_stats
Automatic merge from submit-queue

Fix system container detection in kubelet on systemd

```release-note
Fix system container detection in kubelet on systemd.

This fixed environments where CPU and Memory Accounting were not enabled on the unit 
that launched the kubelet or docker from reporting the root cgroup when 
monitoring usage stats for those components.
```

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

/cc @kubernetes/sig-node @kubernetes/rh-cluster-infra @vishh @dchen1107
2016-05-28 05:38:15 -07:00
k8s-merge-robot e7a13ac2ad Merge pull request #25902 from euank/changeVolumeMounts
Automatic merge from submit-queue

rkt: Use volumes from RunContainerOptions

This replaces the previous creation of mounts from the `volumeGetter`
with mounts provided via RunContainerOptions.

This is motivated by the fact that the latter has a more complete set of
mounts (e.g. the `/etc/hosts` one created in kubelet.go in the case an IP is available).

This does not induce further e2e failures as far as I can tell.

cc @yifan-gu
2016-05-28 03:58:14 -07:00
k8s-merge-robot 74b20cccc6 Merge pull request #25813 from rrati/kubelet-pods-per-core
Automatic merge from submit-queue

Added pods-per-core to kubelet. #25762

Added --pods-per-core to kubelet

#25762
2016-05-28 03:08:28 -07:00
k8s-merge-robot f32b2582df Merge pull request #26391 from timstclair/containerd
Automatic merge from submit-queue

Move containerd process into docker cgroup for versions >= v1.11

Addresses https://github.com/kubernetes/kubernetes/issues/23397#issuecomment-209583923

/cc @vishh @kubernetes/sig-node
2016-05-27 19:42:48 -07:00
Euan Kemp c83ad19ae9 kubenet: Fix ipv4 validity check
The length of an IP can be 4 or 16, and even if 16 it can be a valid
ipv4 address. This check is the more-correct way to handle this, and it
also provides more granular error messages.
2016-05-27 16:25:14 -07:00
Alex Robinson 91f8c784a0 Merge pull request #21373 from enoodle/read_cadvisor_cloudinfo_in_kubelet
kubelet: reading cloudinfo from cadvisor
2016-05-27 16:14:24 -07:00
Alex Robinson cddf564f3c Merge pull request #24771 from timstclair/event-store
Disable cAdvisor event storage by default
2016-05-27 15:56:13 -07:00
Random-Liu 52a3d8a19d Add unit test for image history cache 2016-05-27 14:49:48 -07:00
Random-Liu 56bde2df9f Cache image history 2016-05-27 14:49:48 -07:00
Alex Robinson 1cca499e92 Merge pull request #26225 from yujuhong/less_noise
Reduce noise in kubelet.log
2016-05-27 14:28:53 -07:00
Euan Kemp abbd0321b2 rkt: Use volumes from RunContainerOptions
This replaces the previous creation of mounts from the `volumeGetter`
with mounts provided via RunContainerOptions.

This is motivated by the fact that the latter has a more complete set of
mounts (e.g. the `/etc/hosts` one created in kubelet.go).
2016-05-27 13:11:47 -07:00
Timothy St. Clair 199e15ab64 Update client connections to try to use http2, except attach, exec, and
port-forward which are customized
2016-05-27 15:08:42 -05:00
Alex Robinson bd0b94efe2 Merge pull request #26029 from luxas/mkdir_all
kubelet: Use MkdirAll instead of Mkdir
2016-05-27 11:40:01 -07:00
Alex Robinson 789b69758e Merge pull request #25688 from sjpotter/rkt_annotations
kubelet: Move common labels out of dockertools package
2016-05-27 11:26:31 -07:00
Euan Kemp 93487867ac kubenet: Update empty ip check
The previous check was incorrect because the `IP.String` method returns
`<nil>` and other non-empty-strings on error conditions.
2016-05-27 10:47:13 -07:00
Euan Kemp c4b8959a75 kubenet: Reduce loglevel of spammy message
When no shaping is enabled, that warning would always be printed.
2016-05-27 10:47:12 -07:00
Euan Kemp 7e0b9bfa66 kubenet: Fix panic when teardown run before setup
Teardown can run before Setup when the kubelet is restarted... in that
case, the shaper was nil and thus calling the shaper resulted in a panic

This fixes that by ensuring the shaper is always set... +1 level of
indirection and all that.
2016-05-27 10:47:12 -07:00
Euan Kemp 2f5e738dc1 kubenet: Fix inconsistent cidr usage/parsing
Before this change, the podCIDRs map contained both cidrs and ips
depending on which code path entered a container into it.

Specifically, SetUpPod would enter a CIDR while GetPodNetworkStatus
would enter an IP.

This normalizes both of them to always enter just IP addresses.

This also removes the now-redundant cidr parsing that was used to get
the ip before
2016-05-27 10:47:12 -07:00
Wojciech Tyczynski be1b57100d Change to NotReadyNetworking and use in scheduler 2016-05-27 19:32:49 +02:00
gmarek 7bdf480340 Node is NotReady until the Route is created 2016-05-27 19:29:51 +02:00
Euan Kemp 766eb6f0f7 kubenet: Fix bug where shaper.Reset wasn't called
The error check was inverse what it should have been, causing
shaper.Reset to only get called with invalid cidrs.
2016-05-27 10:20:43 -07:00