Commit Graph

4350 Commits (35c2e70dd1af1479a9d6d8f23697e42763f4bc74)

Author SHA1 Message Date
Kubernetes Submit Queue 42d8d4ca88 Merge pull request #40948 from freehan/cri-hostport
Automatic merge from submit-queue (batch tested with PRs 40873, 40948, 39580, 41065, 40815)

[CRI] Enable Hostport Feature for Dockershim

Commits:
1. Refactor common hostport util logics and add more tests

2. Add HostportManager which can ADD/DEL hostports instead of a complete sync.

3. Add Interface for retreiving portMappings information of a pod in Network Host interface. 
Implement GetPodPortMappings interface in dockerService. 

4. Teach kubenet to use HostportManager
2017-02-08 14:14:43 -08:00
Derek Carr 0171121486 Add debug logging to eviction manager 2017-02-08 15:01:12 -05:00
Yu-Ju Hong f96611ac45 dockershim: set the default cgroup driver 2017-02-08 10:22:19 -08:00
Minhan Xia be9eca6b51 teach kubenet to use hostport_manager 2017-02-08 09:35:04 -08:00
Minhan Xia bd05e1af2b add portmapping getter into network host 2017-02-08 09:35:04 -08:00
Minhan Xia 8e7219cbb4 add hostport manager 2017-02-08 09:26:52 -08:00
Minhan Xia aabdaa984f refactor hostport logic 2017-02-08 09:26:52 -08:00
David Ashpole 67cb2704c5 delete volumes before pod deletion 2017-02-08 07:34:49 -08:00
Kubernetes Submit Queue c6f30d3750 Merge pull request #41105 from Random-Liu/fix-kuberuntime-log
Automatic merge from submit-queue (batch tested with PRs 38796, 40823, 40756, 41083, 41105)

Let ReadLogs return when there is a read error.

Fixes a bug in kuberuntime log.

Today, @yujuhong found that once we cancel `kubectl logs -f` with `Ctrl+C`, kuberuntime will keep complaining:
```
27939 kuberuntime_logs.go:192] Failed with err write tcp 10.240.0.4:10250->10.240.0.2:53913: write: broken pipe when writing log for log file "/var/log/pods/5bb76510-ed71-11e6-ad02-42010af00002/busybox_0.log": &{timestamp:{sec:63622095387 nsec:625309193 loc:0x484c440} stream:stdout log:[84 117 101 32 70 101 98 32 32 55 32 50 48 58 49 54 58 50 55 32 85 84 67 32 50 48 49 55 10]}
```

This is because kuberuntime keeps writing to the connection even though it is already closed. Actually, kuberuntime should return and report error whenever there is a writing error.

Ref the [docker code](3a4ae1f661/pkg/stdcopy/stdcopy.go (L159-L167))

I'm still creating the cluster and verifying this fix. Will post the result here after that.

/cc @yujuhong @kubernetes/sig-node-bugs
2017-02-08 00:49:51 -08:00
Kubernetes Submit Queue 1b7bdde40b Merge pull request #38796 from chentao1596/kubelet-cni-log
Automatic merge from submit-queue (batch tested with PRs 38796, 40823, 40756, 41083, 41105)

kubelet/network-cni-plugin: modify the log's info

**What this PR does / why we need it**:

  Checking the startup logs of kubelet, i can always find a error like this:
    "E1215 10:19:24.891724    2752 cni.go:163] error updating cni config: No networks found in /etc/cni/net.d"
 
 It will appears, neither i use cni network-plugin or not. 
After analysis codes, i thought it should be a warn log, because it will not produce any actions like as exit or abort, and just ignored when not any valid plugins exit.

 thank you!
2017-02-08 00:49:44 -08:00
Kubernetes Submit Queue 843e6d1cc3 Merge pull request #40770 from apilloud/clientset_interface
Automatic merge from submit-queue (batch tested with PRs 41103, 41042, 41097, 40946, 40770)

Use Clientset interface in KubeletDeps

**What this PR does / why we need it**:
This replaces the Clientset struct with the equivalent interface for the KubeClient injected via KubeletDeps. This is useful for testing and for accessing the Node and Pod status event stream without an API server.

**Special notes for your reviewer**:
Follow up to #4907

**Release note**:

`NONE`
2017-02-07 22:12:39 -08:00
Kubernetes Submit Queue 51b8eb9424 Merge pull request #40946 from yujuhong/docker_sep
Automatic merge from submit-queue (batch tested with PRs 41103, 41042, 41097, 40946, 40770)

dockershim: set security option separators based on the docker version

Also add a version cache to avoid hitting the docker daemon frequently.

This is part of #38164
2017-02-07 22:12:37 -08:00
Random-Liu 65190e2a72 Let ReadLogs return when there is a read error. 2017-02-07 15:43:48 -08:00
Yu-Ju Hong e66dd63b05 Add OWNERS to the dockertools package 2017-02-07 11:31:37 -08:00
Yu-Ju Hong d8e29e782f dockershim: set security option separators based on the docker version
Also add a version cache to avoid hitting the docker daemon frequently.
2017-02-07 11:06:40 -08:00
Kubernetes Submit Queue 98f97496ef Merge pull request #40903 from yujuhong/security_opts
Automatic merge from submit-queue (batch tested with PRs 40971, 41027, 40709, 40903, 39369)

Set docker opt separator correctly for SELinux options

This is based on @pmorie's commit from #40179
2017-02-06 20:57:17 -08:00
Yu-Ju Hong 05c3b8c1cf Set docker opt separator correctly for SELinux options 2017-02-06 14:47:30 -08:00
Kubernetes Submit Queue d4bcf3ede5 Merge pull request #40951 from yujuhong/fix_cri_portforward
Automatic merge from submit-queue (batch tested with PRs 40930, 40951)

Fix CRI port forwarding

Websocket support was introduced #33684, which broke the CRI
implementation. This change fixes it.
2017-02-06 14:27:05 -08:00
Klaus Ma cc26fe6ee9 Removed unnecessarly empty line. 2017-02-06 11:10:34 +08:00
NickrenREN a62da3e22b record ReduceCPULimits result err info if possible
record ReduceCPULimits result err info if possible
2017-02-04 21:12:39 +08:00
Kubernetes Submit Queue a777a8e3ba Merge pull request #39972 from derekwaynecarr/pod-cgroups-default
Automatic merge from submit-queue (batch tested with PRs 40289, 40877, 40879, 39972, 40942)

Rename experimental-cgroups-per-pod flag

**What this PR does / why we need it**:
1. Rename `experimental-cgroups-per-qos` to `cgroups-per-qos`
1. Update hack/local-up-cluster to match `CGROUP_DRIVER` with docker runtime if used.

**Special notes for your reviewer**:
We plan to roll this feature out in the upcoming release.  Previous node e2e runs were running with this feature on by default.  We will default this feature on for all e2es next week.

**Release note**:
```release-note
Rename --experiemental-cgroups-per-qos to --cgroups-per-qos
```
2017-02-04 04:43:08 -08:00
Kubernetes Submit Queue 4796c7b409 Merge pull request #40727 from Random-Liu/handle-cri-in-place-upgrade
Automatic merge from submit-queue

CRI: Handle cri in-place upgrade

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

## How does this PR restart/remove legacy containers/sandboxes?
With this PR, dockershim will convert and return legacy containers and infra containers as regular containers/sandboxes. Then we can rely on the SyncPod logic to stop the legacy containers/sandboxes, and the garbage collector to remove the legacy containers/sandboxes.

To forcibly trigger restart:
* For infra containers, we manually set `hostNetwork` to opposite value to trigger a restart (See [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L389))
* For application containers, they will be restarted with the infra container.
## How does this PR avoid extra overhead when there is no legacy container/sandbox?
For the lack of some labels, listing legacy containers needs extra `docker ps`. We should not introduce constant performance regression for legacy container cleanup. So we added the `legacyCleanupFlag`:
* In `ListContainers` and `ListPodSandbox`, only do extra `ListLegacyContainers` and `ListLegacyPodSandbox` when `legacyCleanupFlag` is `NotDone`.
* When dockershim starts, it will check whether there are legacy containers/sandboxes.
  * If there are none, it will mark `legacyCleanupFlag` as `Done`.
  * If there are any, it will leave `legacyCleanupFlag` as `NotDone`, and start a goroutine periodically check whether legacy cleanup is done.
This makes sure that there is overhead only when there are legacy containers/sandboxes not cleaned up yet.

## Caveats
* In-place upgrade will cause kubelet to restart all running containers.
* RestartNever container will not be restarted.
* Garbage collector sometimes keep the legacy containers for a long time if there aren't too many containers on the node. In that case, dockershim will keep performing extra `docker ps` which introduces overhead.
  * Manually remove all legacy containers will fix this.
  * Should we garbage collect legacy containers/sandboxes in dockershim by ourselves? /cc @yujuhong 
* Host port will not be reclaimed for the lack of checkpoint for legacy sandboxes. https://github.com/kubernetes/kubernetes/pull/39903 /cc @freehan 

/cc @yujuhong @feiskyer @dchen1107 @kubernetes/sig-node-api-reviews 
**Release note**:

```release-note
We should mention the caveats of in-place upgrade in release note.
```
2017-02-03 22:17:56 -08:00
Kubernetes Submit Queue f20b4fc67f Merge pull request #40655 from vishh/flag-gate-critical-pod-annotation
Automatic merge from submit-queue

Optionally avoid evicting critical pods in kubelet

For #40573

```release-note
When feature gate "ExperimentalCriticalPodAnnotation" is set, Kubelet will avoid evicting pods in "kube-system" namespace that contains a special annotation - `scheduler.alpha.kubernetes.io/critical-pod`
This feature should be used in conjunction with the rescheduler to guarantee availability for critical system pods - https://kubernetes.io/docs/admin/rescheduler/
```
2017-02-03 16:22:26 -08:00
Yu-Ju Hong bb0eb3c33e Fix CRI port forwarding
Websocket support was introduced #33684, which broke the CRI
implementation. This change fixes it.
2017-02-03 15:29:49 -08:00
Derek Carr 04a909a257 Rename cgroups-per-qos flag to not be experimental 2017-02-03 17:10:53 -05:00
Andrew Pilloud 3f8505022c Use clientset.Interface for KubeClient 2017-02-03 07:36:16 -08:00
Kubernetes Submit Queue 2bb1e75815 Merge pull request #40863 from kubernetes/sttts-big-genericapiserver-move
Automatic merge from submit-queue (batch tested with PRs 40795, 40863)

Move pkg/genericapiserver and pkg/storage to k8s.io/apiserver

approved based on #40363

These must merge first:
- [x] genericvalidation https://github.com/kubernetes/kubernetes/pull/40810
- [x] openapi https://github.com/kubernetes/kubernetes/pull/40829
- [x] episode 7 https://github.com/kubernetes/kubernetes/pull/40853
2017-02-03 03:48:50 -08:00
Kubernetes Submit Queue 0dcc04d698 Merge pull request #40795 from wojtek-t/use_caching_manager
Automatic merge from submit-queue (batch tested with PRs 40795, 40863)

Use caching secret manager in kubelet

I just found that this is in my local branch I'm using for testing, but not in master :)
2017-02-03 03:48:48 -08:00
Dr. Stefan Schimanski 6af3210d6f Update generated files 2017-02-03 08:15:46 +01:00
Dr. Stefan Schimanski 80b96b441b Mechanical import fixup: pkg/storage 2017-02-03 07:33:43 +01:00
Random-Liu b9cf8ebe77 Update bazel. 2017-02-02 15:36:24 -08:00
Random-Liu 626680d289 Add unit test for legacy container cleanup 2017-02-02 15:36:24 -08:00
Random-Liu 14940edaad Add legacy container cleanup 2017-02-02 15:36:24 -08:00
Kubernetes Submit Queue c84f3abca1 Merge pull request #40571 from jcbsmpsn/close-watch
Automatic merge from submit-queue

Release API watch resources when done.
2017-02-02 14:10:10 -08:00
Wojciech Tyczynski 6f3acb801d Fix bug in secret manager. 2017-02-02 21:39:26 +01:00
Vishnu Kannan c967ab7b99 Avoid evicting critical pods in Kubelet if a special feature gate is enabled
Signed-off-by: Vishnu Kannan <vishnuk@google.com>
2017-02-02 11:32:20 -08:00
Vishnu Kannan 6ddb528446 Revert "Sort critical pods before admission"
This reverts commit b7409e0038.
2017-02-02 10:41:24 -08:00
Vishnu Kannan ffd7dda234 Revert "Kubelet admits critical pods even under memory pressure"
This reverts commit afd676d94c.
2017-02-02 10:41:24 -08:00
Vishnu Kannan a3ae8c2b21 Revert "assign -998 as the oom_score_adj for critical pods."
This reverts commit 53931fbce4.
2017-02-02 10:41:21 -08:00
Vishnu Kannan b8a63537dd Revert "Don't evict static pods"
This reverts commit 1743c6b6ab.
2017-02-02 10:29:12 -08:00
Minhan Xia 51526d3103 Add checkpointHandler to DockerService 2017-02-02 10:19:34 -08:00
Minhan Xia 344d2f591f add checkpoint structures for dockershim 2017-02-02 10:18:37 -08:00
Jacob Simpson cf31d9413e Release API watch resources when done. 2017-02-02 10:17:08 -08:00
Wojciech Tyczynski ec6a95a665 Use caching secret manager in kubelet 2017-02-02 15:32:07 +01:00
Kubernetes Submit Queue 0477100f98 Merge pull request #33684 from fraenkel/port_forward_ws
Automatic merge from submit-queue

Add websocket support for port forwarding

#32880

**Release note**:
```release-note
Port forwarding can forward over websockets or SPDY.
```
2017-02-01 23:19:02 -08:00
Michael Fraenkel f07f5a4cc3 Generated code 2017-02-01 18:03:47 -07:00
Michael Fraenkel 93c11422e4 CRI Portforward needs to forward websocket ports
- adjust ports to int32
- CRI flows the websocket ports as query params

- Do not validate ports since the protocol is unknown
  SPDY flows the ports as headers and websockets uses query params
- Only flow query params if there is at least one port query param
2017-02-01 18:03:42 -07:00
Kubernetes Submit Queue 4bffae39cb Merge pull request #40574 from yujuhong/mv_securitycontext
Automatic merge from submit-queue

securitycontext: move docker-specific logic into kubelet/dockertools

This change moves the code specific to docker to kubelet/dockertools,
while leaving the common utility functions at its current package
(pkg/securitycontext).

When we deprecate dockertools in the future, the code will be moved to
pkg/kubelet/dockershim instead.
2017-02-01 15:31:49 -08:00
Rene Treffer 42ff859c27 Allow multipe DNS servers as comma-seperated argument for --dns
Depending on an exact cluster setup multiple dns may make sense.
Comma-seperated lists of DNS server are quite common as DNS servers
are always plain IPs.
2017-02-01 22:38:40 +01:00
Kubernetes Submit Queue 7165fe6e9e Merge pull request #39145 from NickrenREN/podpair
Automatic merge from submit-queue (batch tested with PRs 40758, 39145, 40776)

remove duplicate function notes
2017-02-01 13:30:39 -08:00
Kubernetes Submit Queue cb758738f9 Merge pull request #40265 from feiskyer/cri-verify
Automatic merge from submit-queue

CRI: verify responses from remote runtime

Closes #40264.
2017-02-01 08:41:15 -08:00
Michael Fraenkel beb53fb71a Port forward over websockets
- split out port forwarding into its own package

Allow multiple port forwarding ports
- Make it easy to determine which port is tied to which channel
- odd channels are for data
- even channels are for errors

- allow comma separated ports to specify multiple ports

Add  portfowardtester 1.2 to whitelist
2017-02-01 06:32:04 -07:00
Kubernetes Submit Queue 76550cf2de Merge pull request #40710 from deads2k/client-21-record
Automatic merge from submit-queue (batch tested with PRs 40638, 40742, 40710, 40718, 40763)

move client/record

An attempt at moving client/record to client-go.  It's proving very stubborn and needs a lot manual intervention and near as I can tell, no one actually gets any benefit from the sink and source complexity it adds.

@sttts @caesarchaoxu
2017-01-31 20:40:45 -08:00
Kubernetes Submit Queue d399924b69 Merge pull request #40638 from yujuhong/rm_label
Automatic merge from submit-queue

kuberuntime: remove the kubernetesManagedLabel label

The CRI shim should be responsible for returning only those
containers/sandboxes created through CRI. Remove this label in kubelet.
2017-01-31 19:40:20 -08:00
Kubernetes Submit Queue 32d79c3461 Merge pull request #39443 from freehan/cri-hostport
Automatic merge from submit-queue (batch tested with PRs 40111, 40368, 40342, 40274, 39443)

refactor hostport logic

Refactor hostport logic to avoid using api.Pod object directly.
2017-01-31 19:18:44 -08:00
deads2k a106d9f848 switch kubelet to use external (client-go) object references for events 2017-01-31 19:15:33 -05:00
deads2k 8a12000402 move client/record 2017-01-31 19:14:13 -05:00
Kubernetes Submit Queue 31df7e411c Merge pull request #40527 from php-coder/docker_manager_cleanup
Automatic merge from submit-queue (batch tested with PRs 40527, 40738, 39366, 40609, 40748)

pkg/kubelet/dockertools/docker_manager.go: removing unused stuff

This PR removes unused constants and variables. I checked that neither kubernetes nor openshift code aren't using them.
2017-01-31 15:49:37 -08:00
Kubernetes Submit Queue fe01eef0bb Merge pull request #39242 from NickrenREN/kuberuntime-manager
Automatic merge from submit-queue (batch tested with PRs 40392, 39242, 40579, 40628, 40713)

optimize podSandboxChanged() function and fix some function notes
2017-01-31 01:16:51 -08:00
Kubernetes Submit Queue 564016bd9f Merge pull request #38443 from NickrenREN/vol-mgr-getVolumeInUse
Automatic merge from submit-queue (batch tested with PRs 38443, 40145, 40701, 40682)

fix GetVolumeInUse() function

Since we just want to get volume name info, each volume name just need to added once.  desiredStateOfWorld.GetVolumesToMount() will return volume and pod binding info,
if one volume is mounted to several pods, the volume name will be return several times. That is not what we want in this function.
We can add a new function to only get the volume name info  or judge whether the volume name is added to the desiredVolumesMap array.
2017-01-30 20:59:38 -08:00
Minhan Xia 548a6122c5 rename HostportHandler to HostportSyncer 2017-01-30 16:30:06 -08:00
deads2k c9a008dff3 move util/intstr to apimachinery 2017-01-30 12:46:59 -05:00
Dr. Stefan Schimanski 44ea6b3f30 Update generated files 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski 79adb99a13 pkg/api: move Semantic equality to k8s.io/apimachinery/pkg/api/equality 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski 88d9829ad5 pkg/kubelet/rkt: adapt to new appc/spec 2017-01-29 21:41:45 +01:00
Dr. Stefan Schimanski bc6fdd925d pkg/api/resource: move to apimachinery 2017-01-29 21:41:44 +01:00
Kubernetes Submit Queue 4bba610565 Merge pull request #40605 from deads2k/generic-32-movehttpstream
Automatic merge from submit-queue

pkg/util: move httpstream to k8s.io/apimachinery

pick one commit from @sttts's pull https://github.com/kubernetes/kubernetes/pull/40426

This blocks some client-go splitting, so I'm picking it out and merging it separately.  It's not my commit, so its not a self-lgtm in that sense.

approved based on https://github.com/kubernetes/kubernetes/issues/40363
2017-01-29 05:15:22 -08:00
Kubernetes Submit Queue a951727a18 Merge pull request #40597 from wojtek-t/cleanup_get_from_cache
Automatic merge from submit-queue (batch tested with PRs 40497, 39769, 40554, 40569, 40597)

Minor cleanup in getting from apiserver cache in kubelet
2017-01-27 17:38:28 -08:00
Yu-Ju Hong c436671cca kuberuntime: remove the kubernetesManagedLabel label
The CRI shim should be responsible for returning only those
containers/sandboxes created through CRI. Remove this label in kubelet.
2017-01-27 17:08:46 -08:00
Yu-Ju Hong 4506f4c2d0 securitycontext: move docker-specific logic into kubelet/dockertools
This change moves the code specific to docker to kubelet/dockertools,
while leaving the common utility functions at its current package
(pkg/securitycontext).

When we deprecate dockertools in the future, the code will be moved to
pkg/kubelet/dockershim instead.
2017-01-27 12:25:46 -08:00
Dr. Stefan Schimanski 674d78b2ab pkg/util: move httpstream to k8s.io/apimachinery 2017-01-27 15:10:42 -05:00
Wojciech Tyczynski 2d0fe16463 Minor cleanup in getting from apiserver cache in kubelet 2017-01-27 15:36:37 +01:00
Aleksandra Malinowska 74e1d8078e Revert "Delay deletion of pod from the API server until volumes are deleted" 2017-01-27 13:31:02 +01:00
Kubernetes Submit Queue e6e17a5be6 Merge pull request #40572 from yujuhong/cri_cleanup
Automatic merge from submit-queue (batch tested with PRs 40126, 40565, 38777, 40564, 40572)

docker-CRI: Remove legacy code for non-grpc integration

A minor cleanup to remove the code that is no longer in use to simplify the logic.
2017-01-27 01:34:22 -08:00
Kubernetes Submit Queue fb201dc838 Merge pull request #40564 from Random-Liu/add-container-not-found-error
Automatic merge from submit-queue (batch tested with PRs 40126, 40565, 38777, 40564, 40572)

Add IsContainerNotFound in kube_docker_client

This PR added `IsContainerNotFound` function in kube_docker_client and changed dockershim to use it.

@yujuhong @freehan
2017-01-27 01:34:21 -08:00
Yu-Ju Hong 202488995a docker-CRI: Remove legacy code for non-grpc integration 2017-01-26 17:23:20 -08:00
Random-Liu e5ee619449 Add IsContainerNotFound in kube_docker_client and change dockershim to
use it.
2017-01-26 16:10:50 -08:00
Kubernetes Submit Queue 892cd7a2a5 Merge pull request #40547 from PI-Victor/fix_typo_logging
Automatic merge from submit-queue (batch tested with PRs 40046, 40073, 40547, 40534, 40249)

fix a typo in cni log

**What this PR does / why we need it**:
fixes a typo s/unintialized/uninitialized in pkg/kubelet/network/cni/cni.go

**Release note**:

```release-note
```
2017-01-26 16:10:38 -08:00
Kubernetes Submit Queue ae1c9a2b25 Merge pull request #40360 from wojtek-t/speedup_secret_manager
Automatic merge from submit-queue (batch tested with PRs 40239, 40397, 40449, 40448, 40360)

Optimize secret manager to refresh secrets from apiserver cache

Ref #19188

@liggitt
2017-01-26 14:23:45 -08:00
Kubernetes Submit Queue 5f01179aff Merge pull request #40448 from Random-Liu/work-around-container-create-conflict
Automatic merge from submit-queue (batch tested with PRs 40239, 40397, 40449, 40448, 40360)

CRI: Work around container create conflict.

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

This PR added a random suffix in the container name when we:
* Failed to create the container because of "Conflict".
* And failed to remove the container because of "No such container".

@yujuhong @feiskyer 
/cc @kubernetes/sig-node-bugs
2017-01-26 14:23:43 -08:00
Kubernetes Submit Queue aace5a7b87 Merge pull request #40449 from deads2k/client-15-types
Automatic merge from submit-queue (batch tested with PRs 40239, 40397, 40449, 40448, 40360)

move the discovery and dynamic clients

Moved the dynamic client, discovery client, testing/core, and testing/cache to `client-go`.  Dependencies on api groups we don't have generated clients for have dropped out, so federation, kubeadm, and imagepolicy.

@caesarxuchao @sttts 

approved based on https://github.com/kubernetes/kubernetes/issues/40363
2017-01-26 14:23:42 -08:00
Kubernetes Submit Queue cfafc575dd Merge pull request #40397 from yujuhong/protoc_settings
Automatic merge from submit-queue (batch tested with PRs 40239, 40397, 40449, 40448, 40360)

CRI: use more gogoprotobuf plugins

Generate marshaler/unmarshaler code should help improve the performance.

This addresses #40098
2017-01-26 14:23:39 -08:00
Kubernetes Submit Queue 7857b9acdf Merge pull request #40239 from dashpole/disk_pod_lifecycle
Automatic merge from submit-queue

Delay deletion of pod from the API server until volumes are deleted

Depends on #37228, and will not pass tests until that PR is merged, and this is rebased.

Keeps all kubelet behavior the same, except the kubelet will not make the "Delete" call (kubeClient.Core().Pods(pod.Namespace).Delete(pod.Name, deleteOptions)) until the volumes associated with that pod are removed.  I will perform some performance testing so that we better understand the latency impact of this change.

Is kubelet_pods.go the correct file to include the "when can I delete this pod" logic?

cc: @vishh @sjenning @derekwaynecarr
2017-01-26 13:46:02 -08:00
PI-Victor 388144f769
fix a typo in cni log 2017-01-26 21:27:38 +01:00
Wojciech Tyczynski 220cfdff91 Optimize secret manager to refresh secrets from apiserver cache 2017-01-26 20:54:45 +01:00
deads2k 9488e2ba30 move testing/core to client-go 2017-01-26 13:54:40 -05:00
Slava Semushin c52d367ecd pkg/kubelet/dockertools/docker_manager.go: remove unused const. 2017-01-26 17:00:16 +01:00
Slava Semushin 37a8caf2a5 pkg/kubelet/dockertools/docker_manager.go: remove unused errors. 2017-01-26 17:00:06 +01:00
Kubernetes Submit Queue 52863de51d Merge pull request #40495 from yujuhong/fnv_hash
Automatic merge from submit-queue (batch tested with PRs 38739, 40480, 40495, 40172, 40393)

Use fnv hash in the CRI implementation

fnv is more stable than adler. This PR changes CRI implementation to
use fnv for generating container hashes, but leaving the old
implementation (dockertools/rkt). This is because hash is what kubelet
uses to identify a container -- changes to the hash will cause kubelet
to restart existing containers. This is ok for CRI implementation (which
requires a disruptive upgrade already), but not for older implementations.

#40140
2017-01-25 21:20:31 -08:00
Kubernetes Submit Queue b9eb3e9d68 Merge pull request #40195 from fraenkel/env_secret_secretmgr
Automatic merge from submit-queue (batch tested with PRs 39538, 40188, 40357, 38214, 40195)

Use SecretManager when getting secrets for EnvFrom

Merges crossed in the night which missed this needed change.
2017-01-25 17:47:16 -08:00
Yu-Ju Hong 87f1291c19 Use fnv hash in the CRI implementation
Leave the old implementation (dockertools/rkt) untouched so that
containers will not be restarted during kubelet upgrade. For CRI
implementation (kuberuntime), container restart is required for kubelet
upgrade.
2017-01-25 15:01:41 -08:00
Minhan Xia 8e318b8d9b refactor hostport logic 2017-01-25 14:52:33 -08:00
Random-Liu 90e91a8989 Add unit test for the work around. 2017-01-25 14:15:41 -08:00
Random-Liu 1b1b444c46 Work around the container name conflict bug 2017-01-25 14:15:41 -08:00
Yu-Ju Hong 760d8e98e8 CRI: use more gogoprotobuf plugins
This includes generating marshaler/unmarshaler code to improve
performance.
2017-01-25 13:52:24 -08:00
David Ashpole b1b9686c91 periodically check if pod can be deleted 2017-01-25 10:51:48 -08:00
Dr. Stefan Schimanski a0137e9b28 Update generated files 2017-01-25 19:49:45 +01:00
Dr. Stefan Schimanski d7eb3b6870 pkg/util: move uuid and strategicpatch into k8s.io/apimachinery 2017-01-25 19:45:09 +01:00
David Ashpole 9094b57570 cleanup volumes before deleting from the api server 2017-01-25 10:21:15 -08:00
deads2k b0b156b381 make tools/cache authoritative 2017-01-25 08:29:45 -05:00
deads2k c2ae6d5b40 remove api to util dependency hiding types 2017-01-25 08:28:28 -05:00
Kubernetes Submit Queue df42444742 Merge pull request #40216 from sttts/sttts-more-cutoffs
Automatic merge from submit-queue (batch tested with PRs 39260, 40216, 40213, 40325, 40333)

genericapiserver: more dependency cutoffs

- cut-off pkg/api.Resource and friends - lgtm
- authn plugins -> k8s.io/apiserver - 
- webhook authz plugin -> k8s.io/apiserver - lgtm
- ~~pkg/cert -> k8s.io/apimachinery (will rebase on @deads2k's PR also moving it)~~
- split pkg/config into kubelet config merger and flags - lgtm
- split feature gate between generic apiserver and kube - lgtm
- move pkg/util/flag into k8s.io/apiserver - lgtm
2017-01-24 16:26:00 -08:00
Kubernetes Submit Queue aacb222085 Merge pull request #40344 from smarterclayton/move_all_options
Automatic merge from submit-queue

Move remaining *Options to metav1

Primarily delete options, but will remove all internal references to non-metav1 options (except ListOptions).

Still working through it @sttts @deads2k
2017-01-24 14:11:38 -08:00
Dr. Stefan Schimanski 2b8e938128 Update generated files 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 82826ec273 pkg/util/flag: move to k8s.io/apiserver 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski a6b2ebb50c pkg/flag: make feature gate extensible and split between generic and kube 2017-01-24 20:56:03 +01:00
Dr. Stefan Schimanski 56d60cfae6 pkg/util: move flags from pkg/util/config to pkg/util/flags 2017-01-24 20:56:03 +01:00
Kubernetes Submit Queue 92c5457854 Merge pull request #40327 from yujuhong/rm_code
Automatic merge from submit-queue (batch tested with PRs 39275, 40327, 37264)

dockertools: remove some dead code

Remove `dockerRoot` that's not used anywhere.
2017-01-24 10:52:10 -08:00
Kubernetes Submit Queue 284dfb270e Merge pull request #39275 from ivan4th/fix-bad-fake-runtime-time-values
Automatic merge from submit-queue

Fix bad time values in kubelet FakeRuntimeService

These values don't affect tests but they can be confusing
for developers looking at the code for reference.
2017-01-24 10:50:14 -08:00
Clayton Coleman be6d2933df
refactor: Move *Options references to metav1 2017-01-24 13:41:51 -05:00
Clayton Coleman 7b1c715496
generated: Move references to metav1.*Options 2017-01-24 13:41:48 -05:00
Jitendra Bhurat 0cbf75c400
kubelet: Fix ConfigMap on Windows. 2017-01-24 18:40:49 +00:00
deads2k 5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
Michael Fraenkel 7ddad11058 Use SecretManager when getting secrets for EnvFrom 2017-01-24 05:05:48 -07:00
Kubernetes Submit Queue 43286a82c6 Merge pull request #39981 from fraenkel/optional_configmaps_secrets
Automatic merge from submit-queue

Optional configmaps and secrets

Allow configmaps and secrets for environment variables and volume sources to be optional

Implements approved proposal c9f881b7bb

Release note:
```release-note
Volumes and environment variables populated from ConfigMap and Secret objects can now tolerate the named source object or specific keys being missing, by adding `optional: true` to the volume or environment variable source specifications.
```
2017-01-23 23:06:35 -08:00
Pengfei Ni e2fa0ea87d CRI: verify responses from remote runtime 2017-01-24 10:16:17 +08:00
Michael Fraenkel 4e466040d9 Allow Optional ConfigMap and Secrets
- ConfigMaps and Secrets for Env or Volumes are allowed to be optional
2017-01-23 18:59:49 -07:00
Clayton Coleman 9009c1ac14
generated: informer,client 2017-01-23 17:52:47 -05:00
Clayton Coleman 469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
Clayton Coleman 245b592fac
Convert core code to metav1.ListOptions 2017-01-23 17:52:45 -05:00
Yu-Ju Hong c1d043af18 dockertools: remove some dead code 2017-01-23 14:34:56 -08:00
Kubernetes Submit Queue 13424d874b Merge pull request #40208 from wojtek-t/smart_volume_manager
Automatic merge from submit-queue (batch tested with PRs 40205, 40208)

Make secret volume plugin use secret manager

Ref #19188

@gmarek
2017-01-23 13:40:03 -08:00
Clayton Coleman 6ea557d4b2
Fix tests after new defaulted value added 2017-01-23 12:37:21 -05:00
Clayton Coleman 2bb2604f0b
Limit the size of the termination log and allow log input
Enforce the following limits:

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

Fallback to log output if the user requests it.
2017-01-23 12:26:38 -05:00
Clayton Coleman eff134cd5f
Use chmod to bypass umask on termination log file
os.Create() will obey the umask which results in the file being 0644
when injected in the container.
2017-01-23 12:26:37 -05:00
Wojciech Tyczynski e0784f2e00 Propage secret volumes in secret manager 2017-01-23 16:10:01 +01:00
Wojciech Tyczynski bf7138652f SecretVolume using secret manager 2017-01-23 16:10:01 +01:00
Kubernetes Submit Queue 0c41d538fc Merge pull request #40196 from resouer/remove-todo
Automatic merge from submit-queue

Remove TODOs to refactor kubelet labels

To address #39650 completely.

Remove label refactoring TODOs, we don't need them since CRI rollout is on the way.
2017-01-23 05:07:32 -08:00
Harry Zhang 6fd6f0e4a6 Remove TODOs to refactor kubelet labels 2017-01-22 13:07:19 +08:00
Kubernetes Submit Queue 8d5227bb2e Merge pull request #40210 from mikebryant/fix-kubelet-node-deletion-typo
Automatic merge from submit-queue (batch tested with PRs 40250, 40134, 40210)

Typo fix: Change logging function to formatting version

**What this PR does / why we need it**:

Slightly broken logging message:
```
I0120 10:56:08.555712    7575 kubelet_node_status.go:135] Deleted old node object %qkubernetes-cit-kubernetes-cr0-0
```
2017-01-20 18:15:36 -08:00
Kubernetes Submit Queue 470e732d7f Merge pull request #40235 from deads2k/generic-26-listers
Automatic merge from submit-queue (batch tested with PRs 40232, 40235, 40237, 40240)

move listers out of cache to reduce import tree

Moving the listers from `pkg/client/cache` snips links to all the different API groups from `pkg/storage`, but the dreaded `ListOptions` remains.

@sttts
2017-01-20 14:22:51 -08:00
Kubernetes Submit Queue b5929bfb2b Merge pull request #38789 from jessfraz/cleanup-temp-dirs
Automatic merge from submit-queue (batch tested with PRs 37228, 40146, 40075, 38789, 40189)

Cleanup temp dirs

So funny story my /tmp ran out of space running the unit tests so I am cleaning up all the temp dirs we create.
2017-01-20 12:34:58 -08:00
Kubernetes Submit Queue dcf14add92 Merge pull request #37228 from sjenning/teardown-terminated-volumes
Automatic merge from submit-queue (batch tested with PRs 37228, 40146, 40075, 38789, 40189)

kubelet: storage: teardown terminated pod volumes

This is a continuation of the work done in https://github.com/kubernetes/kubernetes/pull/36779

There really is no reason to keep volumes for terminated pods attached on the node.  This PR extends the removal of volumes on the node from memory-backed (the current policy) to all volumes.

@pmorie raised a concern an impact debugging volume related issues if terminated pod volumes are removed.  To address this issue, the PR adds a `--keep-terminated-pod-volumes` flag the kubelet and sets it for `hack/local-up-cluster.sh`.

For consideration in 1.6.

Fixes #35406

@derekwaynecarr @vishh @dashpole

```release-note
kubelet tears down pod volumes on pod termination rather than pod deletion
```
2017-01-20 12:34:52 -08:00
deads2k 1ce0637b27 move listers out of cache to reduce import tree 2017-01-20 15:01:38 -05:00
Kubernetes Submit Queue 54ff406702 Merge pull request #40159 from euank/beware-of-shadows
Automatic merge from submit-queue (batch tested with PRs 40011, 40159)

dockertools/nsenterexec: fix err shadow

The shadow of err meant the combination of `exec-handler=nsenter` +
`tty` + a non-zero exit code meant that the exit code would be LOST
FOREVER 👻

This isn't all that important since no one really used the nsenter exec
handler as I understand it

```release-note
NONE
```
2017-01-20 10:48:45 -08:00
Ivan Shvedunov 7a4ecc5c58 Fix bad time values in kubelet FakeRuntimeService
These values don't affect tests but they can be confusing
for developers looking at the code for reference.
2017-01-20 20:44:04 +03:00
Kubernetes Submit Queue 22a405055d Merge pull request #40170 from deads2k/client-10-restclient
Automatic merge from submit-queue (batch tested with PRs 36693, 40154, 40170, 39033)

make client-go authoritative for pkg/client/restclient

Moves client/restclient to client-go and a util/certs, util/testing as transitives.
2017-01-20 09:18:52 -08:00
Seth Jennings e2750a305a reclaim terminated pod volumes 2017-01-20 11:08:35 -06:00
Kubernetes Submit Queue 53b43d6f8f Merge pull request #40190 from yujuhong/nsenter_exec
Automatic merge from submit-queue (batch tested with PRs 40168, 40165, 39158, 39966, 40190)

dockershim: add support for the 'nsenter' exec handler

This change simply plumbs the kubelet configuration
(--docker-exec-handler) to DockerService.

This fixes #35747.
2017-01-20 08:28:53 -08:00
Kubernetes Submit Queue 0e1a166c4d Merge pull request #39158 from feiskyer/cri-proto3
Automatic merge from submit-queue (batch tested with PRs 40168, 40165, 39158, 39966, 40190)

CRI: upgrade protobuf to v3

For #38854, this PR upgrades CRI protobuf version to v3, and also updated related packages for confirming to new api.  

**Release note**:

```
CRI: upgrade protobuf version to v3.
```
2017-01-20 08:28:49 -08:00
Kubernetes Submit Queue 9841162445 Merge pull request #40165 from Random-Liu/fix-kubelet-owner-file
Automatic merge from submit-queue (batch tested with PRs 40168, 40165, 39158, 39966, 40190)

Small fix in kubelet owner file.

/cc @apelisse @dchen1107 @timstclair
2017-01-20 08:28:47 -08:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k c587b8a21e re-run client-gen 2017-01-20 08:02:36 -05:00
Mike Bryant a507777de8 Change logging function to formatting version 2017-01-20 11:24:05 +00:00
Euan Kemp d55776e85a dockertools/nsenterexec: fix err shadow
The shadow of err meant the combination of `exec-handler=nsenter` +
`tty` + a non-zero exit code meant that the exit code would be LOST
FOREVER 👻

This isn't all that important since no one really used the nsenter exec
handler as I understand it
2017-01-20 01:19:18 -08:00
Kubernetes Submit Queue 2d4d2f913f Merge pull request #39446 from fraenkel/env_secrets
Automatic merge from submit-queue (batch tested with PRs 39446, 40023, 36853)

Create environment variables from secrets

Allow environment variables to be populated from entire secrets.

**Release note**:
```release-note
Populate environment variables from a secrets.
```
2017-01-19 18:53:45 -08:00
Pengfei Ni 53c20e3630 kubelet/kuberuntime: update cri to protobuf v3 2017-01-20 09:55:56 +08:00
Pengfei Ni d4bfcd1fda kubelet/dockershim: update cri to protobuf v3 2017-01-20 09:55:37 +08:00
Pengfei Ni e77e61b3bb kubelet/rktshim: update cri to protobuf v3 2017-01-20 09:55:19 +08:00
Pengfei Ni 76afc7300d kubelet/remote: update cri to protobuf v3 2017-01-20 09:55:07 +08:00