Commit Graph

769 Commits (aeea967149d270d90678d7aed02b1ca5fcd46b89)

Author SHA1 Message Date
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Chao Xu bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu 5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -08:00
Rajat Ramesh Koujalagi d81e216fc6 Better messaging for missing volume components on host to perform mount 2016-11-09 15:16:11 -08:00
Kubernetes Submit Queue 182a09c3c7 Merge pull request #35526 from justinsb/fix_35521_b
Automatic merge from submit-queue

kubelet bootstrap: start hostNetwork pods before we have PodCIDR

Network readiness was checked in the pod admission phase, but pods that
fail admission are not retried.  Move the check to the pod start phase.

Issue #35409 
Issue #35521
2016-11-06 12:53:14 -08:00
Justin Santa Barbara 88628119ab kubelet: testing for hostNetwork with network errors 2016-11-04 00:46:33 -04:00
Tim St. Clair ec9111d942
Hold bad AppArmor pods in pending rather than rejecting 2016-11-02 11:05:16 -07:00
Jess Frazelle d51962e1bb
vet fixes
Signed-off-by: Jess Frazelle <me@jessfraz.com>
2016-10-13 21:12:15 -07:00
Kubernetes Submit Queue 1854bdcb0c Merge pull request #29048 from justinsb/volumes_nodename_not_hostname
Automatic merge from submit-queue

Use strongly-typed types.NodeName for a node name

We had another bug where we confused the hostname with the NodeName.

Also, if we want to use different values for the Node.Name (which is
an important step for making installation easier), we need to keep
better control over this.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName
2016-09-27 17:58:41 -07:00
Justin Santa Barbara 54195d590f Use strongly-typed types.NodeName for a node name
We had another bug where we confused the hostname with the NodeName.

To avoid this happening again, and to make the code more
self-documenting, we use types.NodeName (a typedef alias for string)
whenever we are referring to the Node.Name.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName

Also clean up some of the (many) places where the NodeName is referred
to as a hostname (not true on AWS), or an instanceID (not true on GCE),
etc.
2016-09-27 10:47:31 -04:00
Paul Morie b1f91bd510 Move Kubelet pod-management code into kubelet_pods.go 2016-09-26 17:16:59 -04:00
deads2k 483af28944 fix up service lister 2016-09-22 09:12:37 -04:00
Antoine Pelisse 938872582e Revert "simplify RC and SVC listers" 2016-09-21 15:49:38 -07:00
deads2k 16fbb47189 fix up service lister 2016-09-20 08:24:33 -04:00
Yu-Ju Hong 7ada99181c Limit the number of names per image reported in the node status 2016-09-16 15:16:08 -07:00
Kubernetes Submit Queue 622c2bbd5e Merge pull request #32116 from ZTE-PaaS/zhangke-patch-039
Automatic merge from submit-queue

Fixed TODO: move predicate check into a pod admitter

refractoring AdmitPod func to move predicate check into a pod admitter
2016-09-11 18:25:13 -07:00
Ke Zhang 0ce6d8dafb TODO: move predicate check into a pod admitter 2016-09-09 09:58:42 +08:00
derekwaynecarr ff017839c7 Log an event when container runtime exceeds grace-period during eviction 2016-09-07 13:28:08 -04:00
Yu-Ju Hong 013f7e3c46 kubelet_test.go: use assertions
Switch most of the tests in this file to using  the assert/require library
(in `github.com/stretchr/testify`) in the tests for better readability and
less code in general.
2016-09-01 17:21:48 -07:00
Kubernetes Submit Queue bb9523bd0f Merge pull request #31157 from pmorie/kubelet-move
Automatic merge from submit-queue

Kubelet code move: volume / util

Addresses some odds and ends that I apparently missed earlier.  Preparation for kubelet code-move ENDGAME.

cc @kubernetes/sig-node
2016-08-25 00:20:39 -07:00
Justin Santa Barbara 902ba4e249 Add network-plugin-mtu option for MTU selection
MTU selection is difficult, and if there is a transport such as IPSEC in
use may be impossible.  So we allow specification of the MTU with the
network-plugin-mtu flag, and we pass this down into the network
provider.

Currently implemented by kubenet.
2016-08-23 01:50:58 -04:00
Paul Morie b91ad76066 Kubelet code move: volume / util 2016-08-22 23:35:11 -04:00
Clayton Coleman e1ebde9f92
Add spec.nodeName and spec.serviceAccountName to downward env var
The serviceAccountName is occasionally useful for clients running on
Kube that need to know who they are when talking to other components.

The nodeName is useful for PetSet or DaemonSet pods that need to make
calls back to the API to fetch info about their node.

Both fields are immutable, and cannot easily be retrieved in another
way.
2016-08-20 15:50:36 -04:00
Kubernetes Submit Queue 1b79bc1812 Merge pull request #30731 from ncdc/exec-probe-message
Automatic merge from submit-queue

Always return command output for exec probes and kubelet RunInContainer

Always return command output for exec probes and kubelet RunInContainer, even if the command invocation returns nonzero.

When #24921 replaced RunInContainer with ExecInContainer, it introduced a change where an exec probe that failed no longer included the stdout/stderr from the probe in the event. For example, when running at log level 4, you see:

```
I0816 15:01:36.259826 29713 exec.go:38] Exec probe response: "Failed to access the status endpoint : HTTP Error 404: Not Found.\nHawkular metrics has only been running for 7\n seconds not aborting yet.\n"
```

But the event looks like this:

```
54s 22s 5 hawkular-metrics-hjme4 Pod spec.containers{hawkular-metrics} Warning Unhealthy {kubelet corbeau} Readiness probe failed:
```

Note the absence of the exec probe response after "Readiness probe failed". This PR restores the previous behavior.

cc @kubernetes/rh-cluster-infra @mwringe 

xref https://github.com/openshift/origin/issues/10424
2016-08-20 05:41:44 -07:00
Andy Goldstein c3fe759fec Always return exec command output
Always return exec command output, even if the command invocation returns nonzero. This applies to
exec probes and kubelet RunInContainer calls.
2016-08-17 16:21:19 -04:00
Scott Creeley 782d7d9815 Add Events for operation_executor to show status of mounts, failed or successful 2016-08-17 09:53:47 -04:00
Kubernetes Submit Queue 79ed7064ca Merge pull request #27970 from jingxu97/restartKubelet-6-22
Automatic merge from submit-queue

Add volume reconstruct/cleanup logic in kubelet volume manager

Currently kubelet volume management works on the concept of desired
and actual world of states. The volume manager periodically compares the
two worlds and perform volume mount/unmount and/or attach/detach
operations. When kubelet restarts, the cache of those two worlds are
gone. Although desired world can be recovered through apiserver, actual
world can not be recovered which may cause some volumes cannot be cleaned
up if their information is deleted by apiserver. This change adds the
reconstruction of the actual world by reading the pod directories from
disk. The reconstructed volume information is added to both desired
world and actual world if it cannot be found in either world. The rest
logic would be as same as before, desired world populator may clean up
the volume entry if it is no longer in apiserver, and then volume
manager should invoke unmount to clean it up.

Fixes https://github.com/kubernetes/kubernetes/issues/27653
2016-08-15 13:48:43 -07:00
Jing Xu f19a1148db This change supports robust kubelet volume cleanup
Currently kubelet volume management works on the concept of desired
and actual world of states. The volume manager periodically compares the
two worlds and perform volume mount/unmount and/or attach/detach
operations. When kubelet restarts, the cache of those two worlds are
gone. Although desired world can be recovered through apiserver, actual
world can not be recovered which may cause some volumes cannot be cleaned
up if their information is deleted by apiserver. This change adds the
reconstruction of the actual world by reading the pod directories from
disk. The reconstructed volume information is added to both desired
world and actual world if it cannot be found in either world. The rest
logic would be as same as before, desired world populator may clean up
the volume entry if it is no longer in apiserver, and then volume
manager should invoke unmount to clean it up.
2016-08-15 11:29:15 -07:00
Jess Frazelle 7e9d82129e
fix go vet errors
Signed-off-by: Jess Frazelle <jessfraz@google.com>

fix composites

Signed-off-by: Jess Frazelle <me@jessfraz.com>
2016-08-10 16:45:41 -07:00
Kubernetes Submit Queue 34e51d8ce9 Merge pull request #30095 from ronnielai/image-gc-2
Automatic merge from submit-queue

Moving image gc to pkg/kubelet/images
2016-08-05 03:11:33 -07:00
derekwaynecarr 68bc47ecc6 Add support to invoke image gc in response to disk eviction thresholds 2016-08-04 17:13:08 -04:00
bindata-mockuser 0c76d85cc8 moving image gc to images 2016-08-04 12:26:06 -07:00
Andrey Kurilin 9f1c3a4c56 Fix various typos in kubelet 2016-08-03 01:14:44 +03:00
Michal Rostecki 59ca5986dd Print/log pointers of structs with %#v instead of %+v
There are many places in k8s where %+v is used to format a pointer
to struct, which isn't working as expected.

Fixes #26591
2016-08-01 22:27:56 +02:00
Harry Zhang cb14b35bde Refactor util clock into it's own pkg 2016-07-28 02:29:04 -04:00
Paul Morie 249da77371 Extract kubelet node status into separate file 2016-07-22 01:21:30 -04:00
Paul Morie d9ffcace6a Move ExtractPodBandwidthResources test into appropriate package 2016-07-19 14:34:08 -04:00
Cindy Wang e13c678e3b Make volume unmount more robust using exclusive mount w/ O_EXCL 2016-07-18 16:20:08 -07:00
k8s-merge-robot 50172148e4 Merge pull request #25273 from ncdc/exec-sigwinch
Automatic merge from submit-queue

Support terminal resizing for exec/attach/run

```release-note
Add support for terminal resizing for exec, attach, and run. Note that for Docker, exec sessions
inherit the environment from the primary process, so if the container was created with tty=false,
that means the exec session's TERM variable will default to "dumb". Users can override this by
setting TERM=xterm (or whatever is appropriate) to get the correct "smart" terminal behavior.
```

Fixes #13585
2016-07-14 07:26:49 -07:00
Andy Goldstein 3b21a9901b Support terminal resizing for exec/attach/run
Add support for terminal resizing for exec, attach, and run. Note that for Docker, exec sessions
inherit the environment from the primary process, so if the container was created with tty=false,
that means the exec session's TERM variable will default to "dumb". Users can override this by
setting TERM=xterm (or whatever is appropriate) to get the correct "smart" terminal behavior.
2016-07-13 17:06:16 -04:00
k8s-merge-robot 5067af159e Merge pull request #28715 from euank/kubelet-trim-dead-code
Automatic merge from submit-queue

kubelete: delete a few bits of dead code

Less is more.
2016-07-11 11:40:47 -07:00
Euan Kemp 26e0f50504 kubelet: delete unused code 2016-07-08 15:15:43 -07:00
Paul Morie 5c836f3582 Extract kubelet network code into its own file 2016-07-08 15:18:07 -04:00
derekwaynecarr c162fec94d Move ActiveDeadlineSeconds to use lifecycle observers 2016-07-07 13:43:55 -04: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
saadali 0dd17fff22 Reorganize volume controllers and manager 2016-07-01 18:50:25 -07:00
Ron Lai 8cc6057c63 Declare out of disk when there is no free inodes. 2016-06-30 09:43:36 -07:00
David McMahon ef0c9f0c5b Remove "All rights reserved" from all the headers. 2016-06-29 17:47:36 -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
Saad Ali c723d9e5c4 Volume manager verify containers terminated before deleting 2016-06-28 21:38:59 -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
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 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
Davanum Srinivas 8beed4cd8d
Fix pkg/kubelet unit tests fail on OSX
Fixes #27730
2016-06-24 15:58:09 -04: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
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
Aaron Levy 4a62d8e86f pkg/kubelet: mock stubs for cadvisor calls 2016-06-20 16:33:22 -07:00
derekwaynecarr 18a206ad56 Downward API defaults resource limits to node capacity/allocatable 2016-06-17 14:18:18 -04: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
Piotr Szczesniak 51af487b5f Revert "Downward api node defaults" 2016-06-15 15:47:49 +02: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
Minhan Xia 1276a91638 kubenet masqurade for outbound traffic 2016-06-09 18:43:34 -07:00
Sami Wagiaalla 4858d0ab6f Detangle Attach/Detach from GCE PD 2016-05-22 08:28:29 -04:00
k8s-merge-robot 6224f44717 Merge pull request #25771 from sjpotter/fs-info
Automatic merge from submit-queue

kubelet/cadvisor: Refactor cadvisor disk stat/usage interfaces.

basically

1) cadvisor struct will know what runtime the kubelet is, passed in via additional argument to New()

2) rename cadvisor wrapper function to DockerImagesFsInfo() to ImagesFsInfo() and have linux implementation choose a label based on the runtime inside the cadvisor struct

2a) mock/fake/unsupported modified to take the same additional argument in New()

3) kubelet's wrapper for the cadvisor wrapper is renamed in parallel

4) make all tests use new interface
2016-05-22 03:08:59 -07:00
k8s-merge-robot 9c9bdb2494 Merge pull request #25502 from swagiaal/attach-interface-pvc
Automatic merge from submit-queue

Add support for PersistentVolumeClaim in Attacher/Detacher interface

The attach detach interface does not support volumes which are referenced through PVCs. This PR adds that support
2016-05-21 06:25:34 -07:00
k8s-merge-robot 68ab865e75 Merge pull request #25328 from resouer/sort-images
Automatic merge from submit-queue

Only expose top N images in `NodeStatus`

Fix #25209

Sorted the image and only pick set top 50 sized images in node status.

cc @vishh
2016-05-21 04:43:30 -07:00
Random-Liu f9203e6813 Add unit test for generateAPIPodStatus for normal containers and init containers 2016-05-19 17:12:29 -07:00
Shaya Potter ae08ef38d7 kubelet/cadvisor: Refactor cadvisor disk stat/usage interfaces 2016-05-19 11:13:47 -07:00
Clayton Coleman 5e4308f91d
Update use of Quantity in other classes 2016-05-19 08:41:43 -04:00
k8s-merge-robot 7b4851b9ae Merge pull request #21274 from derekwaynecarr/kubelet_eviction
Automatic merge from submit-queue

out of resource killing (memory)

Adds the core framework for low-resource killing in the kubelet.

Implements support for out of memory killing.

Related:
https://github.com/kubernetes/kubernetes/pull/18724

<!-- 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/21274)
<!-- Reviewable:end -->
2016-05-17 10:15:32 -07:00
Harry Zhang d917ed2638 Add test for image in node status 2016-05-16 15:58:12 -04:00
Harry Zhang 032a886320 Only store top N images in status 2016-05-16 15:58:11 -04:00
k8s-merge-robot 59b7b1c550 Merge pull request #24921 from feiskyer/merge-exec
Automatic merge from submit-queue

Remove RunInContainer interface in Kubelet Runtime interface

According to #24689, we should merge RunInContainer and ExecInContainer in the container runtime interface. 

@yujuhong  @kubernetes/sig-node
2016-05-15 02:58:15 -07:00
derekwaynecarr edc76f6d4f out of resource killing (memory) 2016-05-14 11:34:45 -04:00
Yifan Gu 9d5bcf4251 rkt: Add tests for GarbageCollect(). 2016-05-13 15:13:52 -07:00
k8s-merge-robot 399b086620 Merge pull request #23684 from luxas/auto_label_arch
Automatic merge from submit-queue

Automatically add node labels beta.kubernetes.io/{os,arch}

Proposal: #17981
As discussed in #22623:
> @davidopp: #9044 says cloud provider but can also cover platform stuff.

Adds a label `beta.kubernetes.io/platform` to `kubelet` that informs about the os/arch it's running on.
Makes it easy to specify `nodeSelectors` for different arches in multi-arch clusters.

```console
$ kubectl get no --show-labels
NAME        STATUS    AGE       LABELS
127.0.0.1   Ready     1m        beta.kubernetes.io/platform=linux-amd64,kubernetes.io/hostname=127.0.0.1
$ kubectl describe no
Name:			127.0.0.1
Labels:			beta.kubernetes.io/platform=linux-amd64,kubernetes.io/hostname=127.0.0.1
CreationTimestamp:	Thu, 31 Mar 2016 20:39:15 +0300
```
@davidopp @vishh @fgrzadkowski @thockin @wojtek-t @ixdy @bgrant0607 @dchen1107 @preillyme
2016-05-13 13:25:34 -07:00
derekwaynecarr 6fefb428c1 Add killPodNow to kubelet 2016-05-12 19:17:08 -04:00
Saad Ali 25f37007aa Merge pull request #24846 from pmorie/kubelet-test-loc
Reduce LOC in kubelet tests
2016-05-12 15:52:27 -07:00
Saad Ali 870a1634b1 Merge pull request #24722 from derekwaynecarr/kubelet_testing
Code cleanups in kubelet_test.go
2016-05-12 15:51:00 -07:00
Sami Wagiaalla 56ccd98db8 Add support for PersistentVolumeClaim in Attacher/Detacher interface
- Dereference PVCs in kubelet.
- Add getPersistentVolumebySpec to kubelet.
- Call getPersistentVolumebySpec from mount External volumes
- Add applyPVAnnotations to kubelet.
- Delete persistent_claim plugin.
2016-05-12 17:46:39 -04:00
k8s-merge-robot 08440b5dcc Merge pull request #24836 from Clarifai/gpu-impl
Automatic merge from submit-queue

WIP v0 NVIDIA GPU support

```release-note
* Alpha support for scheduling pods on machines with NVIDIA GPUs whose kubelets use the `--experimental-nvidia-gpus` flag, using the alpha.kubernetes.io/nvidia-gpu resource 
```

Implements part of #24071 for  #23587

I am not familiar with the scheduler enough to know what to do with the scores. Mostly punting for now.

Missing items from the implementation plan: limitranger, rkt support, kubectl
support and docs

cc @erictune @davidopp @dchen1107 @vishh @Hui-Zhi @gopinatht
2016-05-12 14:04:15 -07:00
k8s-merge-robot fd3ef234de Merge pull request #23711 from dcbw/kubenet-promiscuous
Automatic merge from submit-queue

kubenet: set bridge promiscuous mode based on hairpinMode

Closes: https://github.com/kubernetes/kubernetes/issues/23657
Closes: https://github.com/kubernetes/kubernetes/issues/20475

<!-- 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/23711)
<!-- Reviewable:end -->
2016-05-12 10:33:18 -07:00
Dan Williams b749902b42 kubenet: set bridge promiscuous mode based on hairpinMode
Closes: https://github.com/kubernetes/kubernetes/issues/23657
Closes: https://github.com/kubernetes/kubernetes/issues/20475
2016-05-12 10:02:33 -05:00
Saad Ali 4b564c95d7 Merge pull request #25325 from swagiaal/attacher-interface-update
Update Attacher/Detacher interfaces.
2016-05-11 11:36:19 -07:00
Lucas Käldström c28524fbab Add operatingsystem/architecture as node labels. Also, display that in status 2016-05-10 20:38:57 +03:00
k8s-merge-robot def7639457 Merge pull request #25245 from pmorie/kubelet/cadvisor
Automatic merge from submit-queue

Reduce kubelet LOC: extract cadvisor

Step 2 of #25028 

@yujuhong @kubernetes/sig-node
2016-05-09 21:09:42 -07:00
Rudi Chiarito 362c763fca WIP v0 NVIDIA GPU support
Implements part of #24071

I am not familiar with the scheduler enough to know what to do with the scores. Punting for now.

Missing items from the implementation plan: limitranger, rkt support, kubectl
support and user docs
2016-05-09 19:20:05 -04:00
Sami Wagiaalla 5258392e6a Update Attacher/Detacher interfaces.
- Expand arguments for Attach/Detach interfaces
- Run waitForDetach asynchronously
2016-05-09 17:18:08 -04:00
derekwaynecarr a7dfdeb63e Few cleanups in kubelet_test.go 2016-05-09 16:25:50 -04:00
k8s-merge-robot 545d56a63b Merge pull request #24810 from derekwaynecarr/sources_cleanup
Automatic merge from submit-queue

Clean-up sources ready tracking in kubelet

moved sources ready tracking behind an interface, made it thread-safe.
2016-05-09 05:48:09 -07:00
k8s-merge-robot d4b1b6776a Merge pull request #24557 from swagiaal/attacher-interface
Automatic merge from submit-queue

 Abstract node side functionality of attachable plugins

- Create PhysicalAttacher interface to abstract MountDevice and
  WaitForAttach.
- Create PhysicalDetacher interface to abstract WaitForDetach and
  UnmountDevice.
- Expand unit tests to check that Attach, Detach, WaitForAttach,
  WaitForDetach, MountDevice, and UnmountDevice get call where
  appropriet.

Physical{Attacher,Detacher} are working titles suggestions welcome. Some other thoughts:
- NodeSideAttacher or NodeAttacher.
- AttachWatcher
- Call this Attacher and call the Current Attacher CloudAttacher.
- DeviceMounter (although there are way too many things called Mounter right now :/)

This is to address: https://github.com/kubernetes/kubernetes/pull/21709#issuecomment-192035382

@saad-ali
2016-05-08 14:04:44 -07:00
Robert Bailey 2493a9de62 Merge pull request #24959 from Random-Liu/fix-flaky-unit-test
Use fake clock in TestGetPodsToSync.
2016-05-06 14:14:02 -07:00
derekwaynecarr 582e662581 Clean-up sources ready tracking 2016-05-06 12:11:29 -04:00
k8s-merge-robot 16159b8bd0 Merge pull request #24344 from derekwaynecarr/kubelet-lifecycle-callouts
Automatic merge from submit-queue

Define interfaces for kubelet pod admission and eviction

There is too much code and logic in `kubelet.go` that makes it hard to test functions in discrete pieces.

I propose an interface that an internal module can implement that will let it make an admission decision for a pod.  If folks are ok with the pattern, I want to move the a) predicate checking, b) out of disk, c) eviction preventing best-effort pods being admitted into their own dedicated handlers that would be easier for us to mock test.  We can then just write tests to ensure that the `Kubelet` calls a call-out, and we can write easier unit tests to ensure that dedicated handlers do the right thing.

The second interface I propose was a `PodEvictor` that is invoked in the main kubelet sync loop to know if pods should be pro-actively evicted from the machine.  The current active deadline check should move into a simple evictor implementation, and I want to plug the out of resource killer code path as an implementation of the same interface.

 @vishh @timothysc - if you guys can ack on this, I will add some unit testing to ensure we do the call-outs.

/cc @kubernetes/sig-node @kubernetes/rh-cluster-infra
2016-05-06 08:53:35 -07:00
Paul Morie bc5d7a1bca Reduce kubelet LOC: extract cadvisor 2016-05-06 00:26:48 -04:00
k8s-merge-robot 03e7e08e70 Merge pull request #25124 from pmorie/kubelet-getters
Automatic merge from submit-queue

Reduce kubelet LOC: extract getters

Step 1 of #25028 as discussed in @kubernetes/sig-node meeting
2016-05-05 16:52:09 -07:00
Minhan Xia 265fdd9344 add NetworkStatus in NetworkPlugin interface for kubelet to consume 2016-05-04 13:46:31 -07:00
Sami Wagiaalla 71e7dba845 Abstract node side functionality of attachable plugins
- Expand Attacher/Detacher interfaces to break up work more
  explicitly.
- Add arguments to all functions to avoid having implementers store
  the data needed for operations.
- Expand unit tests to check that Attach, Detach, WaitForAttach,
  WaitForDetach, MountDevice, and UnmountDevice get call where
  appropriet.
2016-05-04 10:18:39 -04:00
Paul Morie 7521503ab9 Reduce kubelet LOC: extract getters 2016-05-04 02:25:22 -04:00
Paul Morie d1e0e726f2 Reduce LOC in kubelet tests 2016-05-03 22:45:08 -04:00
Random-Liu 4cca5b2290 Use fake clock in TestGetPodsToSync to fix flake. 2016-05-02 16:05:36 -07:00
feisky 831203c19b Remove RunInContainer interface in Kuberlete Runtime interface 2016-05-01 20:21:15 +08:00
derekwaynecarr 033ae3e37e Define interfaces for kubelet observing admission, sync loop, sync pod 2016-04-29 10:16:03 -04:00
k8s-merge-robot a586177360 Merge pull request #23740 from dcbw/kubenet-shaper
Automatic merge from submit-queue

kubenet: hook pod bandwidth resources up to shaper

@bprashanth @thockin Last bit for shaping.
2016-04-25 22:15:42 -07:00
gmarek e0712f7e57 Fix MaxPods feature in scheduler 2016-04-22 22:49:50 +02:00
Chao Xu 8537095415 use fully qualified resource in fake clients actions 2016-04-20 19:44:40 -07:00
Dan Williams 8086d64131 kubenet: hook pod bandwidth resources up to shaper 2016-04-19 15:32:46 -05:00
Lantao Liu 41953bae49 Add unit test for generateAPIPodStatus 2016-04-12 16:37:26 -07:00
k8s-merge-robot e93c0d727f Merge pull request #20204 from HaiyangDING/predlib
Automatic merge from submit-queue

Move predicates into library

This PR tries to implement #12744 

Any suggestions/ideas are welcome. @davidopp 

current state: integration test fails if including podCount check in Kubelet.
    
DONE:
    1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type PredicateFailureError or InsufficientResourceError
    2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource, PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc if necessary. See discussion in issue #12744
TODO:
    1. determine which predicates should be included in GeneralPredicates()
    2. separate GeneralPredicates() into: a.) GeneralPredicatesEvictPod() and b.) GeneralPredicatesNotEvictPod()
    3. DaemonSet should use GeneralPredicates()
2016-04-12 07:44:45 -07:00
HaiyangDING 41ed85479a move predicates into library (address #12744)
DONE:
1. refactor all predicates: predicates return fitOrNot(bool) and error(Error) in which the latter is of type
	PredicateFailureError or InsufficientResourceError. (For violation of either MaxEBSVolumeCount or
        MaxGCEPDVolumeCount, returns one same error type as ErrMaxVolumeCountExceeded)
2. GeneralPredicates() is a predicate function, which includes serveral other predicate functions (PodFitsResource,
        PodFitsHost, PodFitsHostPort). It is registered as one of the predicates in DefaultAlgorithmProvider, and
        is also called in canAdmitPod() in Kubelet and should be called by other components (like rescheduler, etc)
        if necessary. See discussion in issue #12744
3. remove podNumber check from GeneralPredicates
4. HostName is now verified in Kubelet's canAdminPod(). add TestHostNameConflicts in kubelet_test.go
5. add getNodeAnyWay() method in Kubelet to get node information in standaloneMode

TODO:
1. determine which predicates should be included in GeneralPredicates()
2. separate GeneralPredicates() into:
	a. GeneralPredicatesEvictPod() and
	b. GeneralPredicatesNotEvictPod()
3. DaemonSet should use GeneralPredicates()
2016-04-11 00:57:03 +08:00
harry 5fe773d37c Add flow control pkg
Refactor pkg names in flow control related files
2016-04-03 11:28:03 +08:00
k8s-merge-robot 2205a30348 Merge pull request #23368 from saad-ali/renameBuilderCleaner
Auto commit by PR queue bot
2016-03-26 13:01:25 -07:00
goltermann 32d569d6c7 Fixing all the "composite literal uses unkeyed fields" Vet errors. 2016-03-25 15:25:09 -07:00
saadali 79012f6d53 Rename volume.Builder to Mounter and volume.Cleaner to Unmounter 2016-03-25 11:29:58 -07:00
goltermann 34d4eaea08 Fixing several (but not all) go vet errors. Most are around string formatting, or unreachable code. 2016-03-22 17:26:50 -07:00
harry b0900bf0d4 Refactor diff into sub pkg 2016-03-21 20:21:39 +08:00
Paul Morie 5194c12d9e Fix flake in pod IP as env var e2e 2016-03-10 16:32:03 -05:00
k8s-merge-robot fa0bf812d6 Merge pull request #22467 from Random-Liu/push-down-runtime-version-check
Auto commit by PR queue bot
2016-03-05 22:34:19 -08:00
Random-Liu 07b21c50fa Add Status in runtime interface and use it for runtime health check. 2016-03-04 21:26:41 -08:00
Abhishek Shah a3c00aadd5 Specify hostname, subdomain via annotation on podspec.
The hostname is a DNS A record, if the subdomain maps to a service name
in the same namespace
2016-03-04 13:28:33 -08:00
Yu-Ju Hong 4846c1e1b2 pleg: add an internal clock for testability
Also add tests for the health check.
2016-03-01 17:53:03 -08:00
Saad Ali f9b1a33b12 Merge pull request #21953 from timstclair/testing
Move kubelet test-only files to test-only packages
2016-03-01 15:48:10 -08:00
Tim St. Clair 7b6d843309 Move test-only files to test-only packages 2016-03-01 09:11:32 -08:00
Tim St. Clair 246b389275 Move test-only volume files to test-only volume package 2016-02-29 14:44:28 -08:00
Sami Wagiaalla 8c21967dd8 Only call Detacher after the final unmount 2016-02-25 14:11:07 -05:00
k8s-merge-robot dcbeacded0 Merge pull request #21521 from mesosphere/jdef_kubelet_options1
Auto commit by PR queue bot
2016-02-24 18:35:10 -08:00
dingh 40f6032d33 fix typo in test 2016-02-22 15:08:02 +08:00
James DeFelice 6c09689c60 add functional Option type to Kubelet, add SetNodeStatus Option, migrate node statue update funcs to slice of callbacks 2016-02-20 02:09:54 +00:00
k8s-merge-robot 057b8352ec Merge pull request #21182 from vishh/repoTagsRename
Auto commit by PR queue bot
2016-02-19 08:56:09 -08:00
Chao Xu ad46715f51 generate fake client for release_1_2 2016-02-17 16:10:02 -08:00
Vishnu kannan 2623fdde17 Improve the naming of fields in ContainerImage struct used in NodeStatus.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2016-02-16 15:45:22 -08:00
markturansky a242a3d5fe Added Attacher/Detacher interfaces and support to kubelet 2016-02-07 16:55:58 -05:00
Jan Chaloupka 4389b3f0d6 Rewritte util.* -> wait.* wherever reasonable 2016-02-07 12:02:20 +01:00
k8s-merge-robot bd67b8a5db Merge pull request #20192 from Random-Liu/remove-get-api-podstatus
Auto commit by PR queue bot
2016-02-05 11:00:42 -08:00
Dan Williams 67414afd11 Send PodCIDR to network plugins as an event 2016-02-03 10:08:07 -06:00
Jan Safranek e90de3f985 Fixed cleanup of persistent volumes.
Kubelet.cleanupOrphanedVolumes() compares list of volumes mounted to a node
with list of volumes that are required by pods scheduled on the node
("scheduled volume").

Both lists should contain real volumes, i.e. when a pod uses
PersistentVolumeClaim, the list must contain name of the bound volume instead
of name of the claim.
2016-02-03 10:00:09 +01:00
k8s-merge-robot 843c11e06a Merge pull request #20452 from caesarxuchao/replace-client-kubelet
Auto commit by PR queue bot
2016-02-02 23:46:58 -08:00
Chao Xu cddd7b56a4 replace client with clientset in kubelet and other places 2016-02-02 20:28:45 -08:00
Jeff Lowdermilk ae2aece9af Merge pull request #20202 from caesarxuchao/skip-update
skip update when deleting with grace-period=0
2016-02-02 18:24:57 -08:00
Jeff Lowdermilk caa9433234 Merge pull request #20433 from lavalamp/fix-bad-rv
Add timeout, fix potential startup hang
2016-02-02 17:27:23 -08:00
Random-Liu 7b4cdb6f8f Remove GetAPIPodStatus from runtime interface 2016-02-02 23:41:55 +00:00
Random-Liu 41b12a18d9 Remove GetAPIPodStatus usage 2016-02-02 23:41:55 +00:00
Chao Xu a6d96a04d0 make kubelet.HandlePodsDeletion aware of api.Pod 2016-02-02 13:01:17 -08:00
k8s-merge-robot 71ae2736c0 Merge pull request #19889 from yujuhong/replace_cache
Auto commit by PR queue bot
2016-02-02 00:41:06 -08:00
k8s-merge-robot 126f798699 Merge pull request #19942 from yujuhong/mirror_creation
Auto commit by PR queue bot
2016-02-01 22:55:38 -08:00
Yu-Ju Hong ff04de4fc0 Remove RuntimeCache from sync path
This change removes RuntimeCache in the pod workers and the syncPod() function.
Note that it doesn't deprecate RuntimeCache completely as other components
still rely on the cache.
2016-02-01 21:32:41 -08:00
k8s-merge-robot 32ab64ce5b Merge pull request #19778 from resouer/runtime
Auto commit by PR queue bot
2016-02-01 21:05:05 -08:00
k8s-merge-robot 348858061d Merge pull request #20258 from smarterclayton/get_logs_for_any_container
Auto commit by PR queue bot
2016-02-01 16:24:20 -08:00