Commit Graph

4870 Commits (60604f8818aecbc9c3736fbc32747cc0a535bc80)

Author SHA1 Message Date
Kubernetes Submit Queue ef1febf789 Merge pull request #46367 from bobveznat/master
Automatic merge from submit-queue (batch tested with PRs 46450, 46272, 46453, 46019, 46367)

Move MountVolume.SetUp succeeded to debug level

This message is verbose and repeated over and over again in log files
creating a lot of noise. Leave the message in, but require a -v in
order to actually log it.

**What this PR does / why we need it**: Moves a verbose log message to actually be verbose.

**Which issue this PR fixes** fixes #46364
Fixes #29059
2017-05-26 18:49:04 -07:00
Tim Hockin 252646b8de Deprecate kubelet non-masquerade-cidr
Also do not install iptables rules if it is set to 0.0.0.0/0
2017-05-26 17:01:58 -07:00
Kubernetes Submit Queue e903c58c9e Merge pull request #45614 from yujuhong/container-metrics
Automatic merge from submit-queue (batch tested with PRs 45809, 46515, 46484, 46516, 45614)

CRI: add methods for container stats

**What this PR does / why we need it**:
Define methods in CRI to get container stats.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: 
Part of  https://github.com/kubernetes/features/issues/290; addresses #27097

**Special notes for your reviewer**:
This PR defines the *minimum required* container metrics for the existing components to function, loosely based on the previous discussion on [core metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/core-metrics-pipeline.md) as well as the existing cadvisor/summary APIs.
 
Two new RPC calls are added to the RuntimeService: `ContainerStats` and `ListContainerStats`. The former retrieves stats for a given container, while the latter gets stats for all containers in one call.
 
The stats gathering time of each subsystem can vary substantially (e.g., cpu vs. disk), so even though the on-demand model preferred due to its simplicity, we’d rather give the container runtime more flexibility to determine the collection frequency for each subsystem*. As a trade-off, each piece of stats for the subsystem must contain a timestamp to let kubelet know how fresh/recent the stats are. In the future, we should also recommend a guideline for how recent the stats should be in order to ensure the reliability (e.g., eviction) and the responsiveness (e.g., autoscaling) of the kubernetes cluster.
 
The next step is to plumb this through kubelet so that kubelet can choose consume container stats from CRI or cadvisor. 
 
**Alternatively, we can add calls to get stats of individual subsystems. However, kubelet does not have the complete knowledge of the runtime environment, so this would only lead to unnecessary complexity in kubelet.*


**Release note**:

```release-note
Augment CRI to support retrieving container stats from the runtime.
```
2017-05-26 16:59:08 -07:00
Kubernetes Submit Queue 71e0204f6a Merge pull request #46516 from derekwaynecarr/kubelet-neg-allocatable
Automatic merge from submit-queue (batch tested with PRs 45809, 46515, 46484, 46516, 45614)

kubelet was sending negative allocatable values

**What this PR does / why we need it**:
if you set reservations > node capacity, the node sent negative values for allocatable values on create.  setting negative values on update is rejected.

**Which issue this PR fixes**
xref https://bugzilla.redhat.com/show_bug.cgi?id=1455420

**Special notes for your reviewer**:
at this time, the node is allowed to set status on create.  without this change, a node was being registered with negative allocatable values.  i think we need to revisit letting node set status on create, and i will send a separate pr to debate the merits of that point.

```release-note
Prevent kubelet from setting allocatable < 0 for a resource upon initial creation.
```
2017-05-26 16:59:06 -07:00
Kubernetes Submit Queue 6d6413175f Merge pull request #46417 from resouer/fix-digest-nit
Automatic merge from submit-queue (batch tested with PRs 42256, 46479, 45436, 46440, 46417)

Log out digest when digest is invalid

Notice this in frakti: missing image ref when logging it out.

**Release note**:

```release-note
NONE
```
2017-05-26 15:59:05 -07:00
Kubernetes Submit Queue 55e2bfde0e Merge pull request #46479 from zjj2wry/cm
Automatic merge from submit-queue (batch tested with PRs 42256, 46479, 45436, 46440, 46417)

Fix naming and comments in Container Manage

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-26 15:59:00 -07:00
Yu-Ju Hong 2a224b3414 kubelet: remove a redundant check for mounting the hosts file
HostNetwork is not part of the Pod.Spec.SecurityContext in the versioned
pod. Remove the redundant check.
2017-05-26 12:53:22 -07:00
Adam Worrall d44c458a19 Support sandbox images from private registries
**What this PR does / why we need it**:

The --pod-infra-container-image parameter allows the user to specify
an arbitrary image to be used as the pod infra container (AKA
sandbox), an internal piece of the dockershim implementation of the
Container Runtime Interface.

The dockershim does not have access to any of the pod-level image pull
credentials configuration, so if the user specifies an image from a
private registry, the image pull will fail.

This change allows the dockershim to read local docker configuration
(e.g. /root/.docker/config.json) and use it when pulling the pod infra
container image.

**Which issue this PR fixes**: fixes #45738

**Special notes for your reviewer**:
The changes to fake_client for writing local config files deserve some
attention.

**Release note**:

```release-note
NONE
```
2017-05-26 12:17:10 -07:00
Bob Van Zant aca05c922c Move MountVolume.SetUp succeeded to debug level
This message is verbose and repeated over and over again in log files
creating a lot of noise. Leave the messsage in, but require a -v in
order to actually log it.

Fixes #29059
2017-05-26 10:54:34 -07:00
Kubernetes Submit Queue b9b5571339 Merge pull request #45944 from carlory/fix-comment
Automatic merge from submit-queue (batch tested with PRs 46501, 45944, 46473)

fix func comment in helpers.go

**What this PR does / why we need it**:
fix func comment in helpers.go
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE
**Special notes for your reviewer**:
NONE
**Release note**:

```release-note
NONE
```
2017-05-26 10:13:58 -07:00
Derek Carr 8aaaca0f69 kubelet was sending negative allocatable values 2017-05-26 13:01:24 -04:00
Kubernetes Submit Queue 07038c9417 Merge pull request #46395 from mindprince/issue-46204-45803-kubelet-volumes-test-flake
Automatic merge from submit-queue (batch tested with PRs 46429, 46308, 46395, 45867, 45492)

Implement FakeVolumePlugin's ConstructVolumeSpec method according to interface expectation.

This fixes #45803 and #46204.

**Release note**:
```release-note
NONE
```
2017-05-25 22:42:06 -07:00
Kubernetes Submit Queue 5e853709a7 Merge pull request #46089 from karataliu/wincri1
Automatic merge from submit-queue (batch tested with PRs 46124, 46434, 46089, 45589, 46045)

Support TCP type runtime endpoint for kubelet

**What this PR does / why we need it**:
Currently the grpc server for kubelet and dockershim has a hardcoded endpoint: unix socket '/var/run/dockershim.sock', which is not applicable on non-unix OS.

This PR is to support TCP endpoint type besides unix socket.

**Which issue this PR fixes** 
This is a first attempt to address issue https://github.com/kubernetes/kubernetes/issues/45927

**Special notes for your reviewer**:
Before this change, running on Windows node results in:
```
Container Manager is unsupported in this build
```

After adding the cm stub, error becomes:
```
listen unix /var/run/dockershim.sock: socket: An address incompatible with the requested protocol was used.
```

This PR is to fix those two issues.

After this change, still meets 'seccomp' related issue when running on Windows node, needs more updates later.

**Release note**:
2017-05-25 21:40:02 -07:00
zhengjiajin 9d68ae5963 Fix naming and comments in Container Manage 2017-05-26 10:53:09 +08:00
Kubernetes Submit Queue 470a6a45d5 Merge pull request #45949 from NickrenREN/kubelet-metric
Automatic merge from submit-queue (batch tested with PRs 45949, 46009, 46320, 46423, 46437)

Unregister some metrics

delete some registered metrics since they are not observed


**Release note**:
```release-note
NONE
```
2017-05-25 19:40:58 -07:00
Rohit Agarwal 2b594d6197 Add missing Cleanup() calls in kubelet tests.
Possibly related to #45803 and #46204.
2017-05-25 13:19:56 -07:00
Kubernetes Submit Queue 079020f559 Merge pull request #46160 from NickrenREN/fix-UX
Automatic merge from submit-queue

fix regression in UX experience for double attach volume

send event when volume is not allowed to multi-attach

Fixes #46012

**Release note**:
```release-note
NONE
```
2017-05-25 08:50:12 -07:00
Bryan Boreham 2d8c172a0f Fix screwed-up log message format
It had two %-verbs and three arguments
2017-05-25 15:33:39 +00:00
Harry Zhang 4f4b161fc7 Log out digest when digest is invalid 2017-05-25 16:46:56 +08:00
NickrenREN add091b1fb fix regression in UX experience for double attach volume
send event when volume is not allowed to multi-attach
2017-05-25 09:27:24 +08:00
Dong Liu fb26c9100a Support TCP type runtime endpoint for kubelet. 2017-05-25 09:16:11 +08:00
Kubernetes Submit Queue de1ebf8118 Merge pull request #44443 from jamiehannaford/kubelet-tc
Automatic merge from submit-queue

Bump kubelet/networks test coverage

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

Bumps test coverage

**Which issue this PR fixes**:

https://github.com/kubernetes/kubernetes/issues/40780
https://github.com/kubernetes/kubernetes/issues/39559

**Special notes for your reviewer**:

Writing positive test cases for these lines:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/networks.go#L38 https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/networks.go#L69 
is quite difficult, so the former has a negative case and the latter has no test coverage.

**Release note**:
```release-note
New tests for kubelet/networks
```
2017-05-24 16:17:08 -07:00
Yu-Ju Hong 417e9c8cea Update all relevant interfaces and create stubs 2017-05-24 15:21:16 -07:00
Yu-Ju Hong aff2be9f9b Run hack/update-generated-runtime.sh 2017-05-24 14:45:01 -07:00
Yu-Ju Hong 893a7b2dd1 CRI: add methods for getting container stats
This commit also changes the image-filesystem-related types.
2017-05-24 14:45:01 -07:00
Seth Jennings 2c866a7aaa reset resultRun on pod restart 2017-05-24 14:55:53 -05:00
Dan Williams 02200ba752 dockershim: don't spam logs with pod IP errors before networking is ready
GenericPLEG's 1s relist() loop races against pod network setup.  It
may be called after the infra container has started but before
network setup is done, since PLEG and the runtime's SyncPod() run
in different goroutines.

Track network setup status and don't bother trying to read the pod's
IP address if networking is not yet ready.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=1434950

Mar 22 12:18:17 ip-172-31-43-89 atomic-openshift-node: E0322
   12:18:17.651013   25624 docker_manager.go:378] NetworkPlugin
   cni failed on the status hook for pod 'pausepods22' - Unexpected
   command output Device "eth0" does not exist.
2017-05-23 22:42:41 -05:00
Dan Williams 9e1385b450 kubelet/network: return but tolerate errors returned from GetNetNS()
Runtimes should never return "" and nil errors, since network plugin
drivers need to treat netns differently in different cases.  So return
errors when we can't get the netns, and fix up the plugins to do the
right thing.

Namely, we don't need a NetNS on pod network teardown.  We do need
a netns for pod Status checks and for network setup.
2017-05-23 22:33:12 -05:00
Dan Williams 2036868a7d Revert "Return empty network namespace if the infra container has exited"
This reverts commit fee4c9a7d9.

This is not the correct fix for the problem; and it causes other problems
like continuous:

docker_sandbox.go:234] NetworkPlugin cni failed on the status hook for pod
"someotherdc-1-deploy_default": Unexpected command output nsenter: cannot
open : No such file or directory with error: exit status 1

Because GetNetNS() is returning an empty network namespace.  That is
not helpful nor should really be allowed; that's what the error return
from GetNetNS() is for.
2017-05-23 22:33:12 -05:00
Kubernetes Submit Queue 90250220a9 Merge pull request #44428 from qiujian16/commenttypo
Automatic merge from submit-queue

Fix some typo of comment in kubelet.go

**What this PR does / why we need it**:
The PR is to fix some typo in kubelet.go

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-23 18:45:34 -07:00
Kubernetes Submit Queue 98c66f9fca Merge pull request #46267 from Random-Liu/extend-stop-container-request-timeout
Automatic merge from submit-queue

Double `StopContainer` request timeout.

Doubled `StopContainer` request timeout to leave some time for `SIGKILL` container.

@yujuhong @feiskyer
2017-05-23 14:06:23 -07:00
Random-Liu 5f0288e022 Double `StopContainer` request timeout. 2017-05-23 09:35:48 -07:00
zhengjiajin c79b0c797f fix typo in kubelet 2017-05-23 19:54:10 +08:00
Kubernetes Submit Queue 99a8f7c303 Merge pull request #43590 from dashpole/eviction_complete_deletion
Automatic merge from submit-queue (batch tested with PRs 46022, 46055, 45308, 46209, 43590)

Eviction does not evict unless the previous pod has been cleaned up

Addresses #43166
This PR makes two main changes:
First, it makes the eviction loop re-trigger immediately if there may still be pressure.  This way, if we already waited 10 seconds to delete a pod, we dont need to wait another 10 seconds for the next synchronize call.
Second, it waits for the pod to be cleaned up (including volumes, cgroups, etc), before moving on to the next synchronize call.  It has a timeout for this operation currently set to 30 seconds.
2017-05-22 20:00:03 -07:00
Kubernetes Submit Queue c586f36e55 Merge pull request #46209 from wojtek-t/remove_iptables_save
Automatic merge from submit-queue (batch tested with PRs 46022, 46055, 45308, 46209, 43590)

Remove Save() from iptables interface

This is what @thockin requested in one of the reviews.
2017-05-22 20:00:00 -07:00
Kubernetes Submit Queue 0671a46610 Merge pull request #46246 from derekwaynecarr/kubelet-events
Automatic merge from submit-queue

Fix kubelet event recording

**What this PR does / why we need it**:
There are numerous areas where the kubelet was not properly recording events due to an incorrect type.

To keep this small, I updated all references to `RefManager` that result in throwing an event to ensure it does a conversion.

**Which issue this PR fixes**
Fixes https://github.com/kubernetes/kubernetes/issues/46241
Fixes #44348
Fixes #44652

**Special notes for your reviewer**:
I updated all references I could find to the existing RefManager in kubelet.

**Release note**:
```release-note
fix kubelet event recording for selected events.
```
2017-05-22 18:12:32 -07:00
Michelle Au 6ade5461ad Add GetNodeLabels to VolumeHost interface 2017-05-22 14:44:06 -07:00
Derek Carr f59069720e Fix kubelet event recording 2017-05-22 17:24:36 -04:00
Kubernetes Submit Queue 91adb3eacf Merge pull request #44906 from k82cn/moved_qos_to_v1helper
Automatic merge from submit-queue

Moved qos to api.helpers.

**What this PR does / why we need it**:
The `GetPodQoS` is also used by other components, e.g. kube-scheduler and it's not bound to kubelet; moved it to api helpers so client-go.

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

**Release note**:

```release-note-none
```
2017-05-22 13:30:06 -07:00
Wojciech Tyczynski 9e6de42745 Remove Save() from iptables interface 2017-05-22 13:23:49 +02:00
Kubernetes Submit Queue c1f8fcd9fe Merge pull request #45496 from andyxning/fix_pleg_relist_time
Automatic merge from submit-queue

fix pleg relist time

This PR fix pleg reslist time. According to current implementation, we have a `Healthy` method periodically check the relist time. If current timestamp subtracts latest relist time is longer than `relistThreshold`(default is 3 minutes), we should return an error to indicate the error of runtime.

`relist` method is also called periodically. If runtime(docker) hung, the relist method should return immediately without updating the latest relist time. If we update latest relist time no matter runtime(docker) hung(default timeout is 2 minutes), the `Healthy` method will never return an error.

```release-note
Kubelet PLEG updates the relist timestamp only after successfully relisting.
```

/cc @yujuhong @Random-Liu @dchen1107
2017-05-21 04:17:14 -07:00
Clayton Coleman 3e095d12b4
Refactor move of client-go/util/clock to apimachinery 2017-05-20 14:19:48 -04:00
Klaus Ma 83b7f77ee2 Moved qos to api.helpers. 2017-05-20 07:17:57 -04:00
Kubernetes Submit Queue 3456d4d239 Merge pull request #46033 from wojtek-t/reduce_memory_allocations_in_kube_proxy
Automatic merge from submit-queue

Reduce memory allocations in kube proxy

Memory allocation (and Go GarbageCollection) seems to be one of the most expensive operations in kube-proxy (I've seen profiles where it was more than 50%).

The commits are mostly independent from each other and all of them are mostly about reusing already allocated memory.

This PR is reducing memory allocation by ~5x (results below from 100-node load test):

before:
```
(pprof) top
38.64GB of 39.11GB total (98.79%)
Dropped 249 nodes (cum <= 0.20GB)
Showing top 10 nodes out of 61 (cum >= 0.20GB)
      flat  flat%   sum%        cum   cum%
   15.10GB 38.62% 38.62%    15.10GB 38.62%  bytes.makeSlice
    9.48GB 24.25% 62.87%     9.48GB 24.25%  runtime.rawstringtmp
    8.30GB 21.21% 84.07%    32.47GB 83.02%  k8s.io/kubernetes/pkg/proxy/iptables.(*Proxier).syncProxyRules
    2.08GB  5.31% 89.38%     2.08GB  5.31%  fmt.(*fmt).padString
    1.90GB  4.86% 94.24%     3.82GB  9.77%  strings.Join
    0.67GB  1.72% 95.96%     0.67GB  1.72%  runtime.hashGrow
    0.36GB  0.92% 96.88%     0.36GB  0.92%  runtime.stringtoslicebyte
    0.31GB  0.79% 97.67%     0.62GB  1.58%  encoding/base32.(*Encoding).EncodeToString
    0.24GB  0.62% 98.29%     0.24GB  0.62%  strings.genSplit
    0.20GB   0.5% 98.79%     0.20GB   0.5%  runtime.convT2E
```

after:
```
7.94GB of 8.13GB total (97.75%)
Dropped 311 nodes (cum <= 0.04GB)
Showing top 10 nodes out of 65 (cum >= 0.11GB)
      flat  flat%   sum%        cum   cum%
    3.32GB 40.87% 40.87%     8.05GB 99.05%  k8s.io/kubernetes/pkg/proxy/iptables.(*Proxier).syncProxyRules
    2.85GB 35.09% 75.95%     2.85GB 35.09%  runtime.rawstringtmp
    0.60GB  7.41% 83.37%     0.60GB  7.41%  runtime.hashGrow
    0.31GB  3.76% 87.13%     0.31GB  3.76%  runtime.stringtoslicebyte
    0.28GB  3.43% 90.56%     0.55GB  6.80%  encoding/base32.(*Encoding).EncodeToString
    0.19GB  2.29% 92.85%     0.19GB  2.29%  strings.genSplit
    0.18GB  2.17% 95.03%     0.18GB  2.17%  runtime.convT2E
    0.10GB  1.28% 96.31%     0.71GB  8.71%  runtime.mapassign
    0.10GB  1.21% 97.51%     0.10GB  1.21%  syscall.ByteSliceFromString
    0.02GB  0.23% 97.75%     0.11GB  1.38%  syscall.SlicePtrFromStrings
```
2017-05-19 23:21:49 -07:00
Kubernetes Submit Queue 1c8d255819 Merge pull request #46121 from Random-Liu/fix-kuberuntime-getpods
Automatic merge from submit-queue (batch tested with PRs 45996, 46121, 45707, 46011, 45564)

Fix kuberuntime GetPods.

The `ImageID` is not populated from `GetPods` in kuberuntime.

Image garbage collector is using this field, https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/images/image_gc_manager.go#L204.

Without this fix, image garbage collector will try to garbage collect all images every time. Because docker will not allow that, it should be fine. However, I'm not sure whether the unnecessary remove will cause any problem, e.g. overload docker image management system and make docker hang.

@dchen1107 @yujuhong @feiskyer Do you think we should cherry-pick this?
2017-05-19 18:57:33 -07:00
Random-Liu 4935e119da Fix kuberuntime GetPods. 2017-05-19 11:47:45 -07:00
Wojciech Tyczynski bcfae7e1ed Extend Iptables interface with SaveInto 2017-05-19 20:44:25 +02:00
Wojciech Tyczynski 028ac8034b Remove SaveAll from iptables interface 2017-05-19 20:44:25 +02:00
Kubernetes Submit Queue 4d89212d26 Merge pull request #44898 from xingzhou/kube-44697
Automatic merge from submit-queue (batch tested with PRs 45908, 44898)

While calculating pod's cpu limits, need to count in init-container.

Need to count in init-container when calculating a pod's cpu limits.
Otherwise, may cause pod start failure due to "invalid argument"
error while trying to write "cpu.cfs_quota_us" file.

Fixed #44697 

Release note:
```
NONE
```
2017-05-19 09:39:04 -07:00
tianshapjq f3b9874485 gpusInUse info error when kubelet restarts 2017-05-19 16:47:10 +08:00
Xing Zhou 22ab45b575 While calculating pod's cpu limits, need to count in init-container.
Need to count in init-container when calculating a pod's cpu limits.
Otherwise, may cause pod start failure due to "invalid argument"
error while trying to write "cpu.cfs_quota_us" file.
2017-05-19 12:31:27 +08:00
Kubernetes Submit Queue f57f0388db Merge pull request #41535 from aanm/adding-ipv6-brackets
Automatic merge from submit-queue (batch tested with PRs 41535, 45985, 45929, 45948, 46056)

kubelet/envvars: Adding brackets to IPv6 addresses

Signed-off-by: André Martins <aanm90@gmail.com>

**What this PR does / why we need it**: This adds IPv6 brackets on environments variables pods

**Special notes for your reviewer**:

Since the IP is a string I think the fastest way to detect if it's an IPv6 was to check for the presence of `:` in it. Let me know what you think.
2017-05-18 19:58:07 -07:00
Andy Xie af6c040630 fix pleg relist time 2017-05-18 11:40:04 +08:00
Kubernetes Submit Queue faf556ecbf Merge pull request #45885 from zhangxiaoyu-zidif/kubelet_test-delete-redundant-para
Automatic merge from submit-queue (batch tested with PRs 40234, 45885, 42975)

delete unused para.

**What this PR does / why we need it**:
delete unused para.

**Release note**:

```release-note
NONE
```
2017-05-17 20:27:50 -07:00
Kubernetes Submit Queue 6dbe853e29 Merge pull request #45544 from ianchakeres/reconciler-err-cleanup
Automatic merge from submit-queue (batch tested with PRs 45990, 45544, 45745, 45742, 45678)

Refactor reconciler volume log and error messages

**What this PR does / why we need it**:
Utilizes volume-specific error and log messages introduced in #44969, inside files that also log volume information. 

Specifically: 

- pkg/kubelet/volumemanager/reconciler/reconciler.go, 
- pkg/controller/volume/attachdetach/reconciler/reconciler.go, and
- pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go


**Which issue this PR fixes** : fixes #40905

**Special notes for your reviewer**:

**Release note**:

```release-note
```
NONE
2017-05-17 18:40:51 -07:00
Kubernetes Submit Queue 7f183142de Merge pull request #45990 from dashpole/fix_gc
Automatic merge from submit-queue

[Bug Fix] Return quantity freed even when an error exists

bug was added by #44986.  If we get an error from deleteImages, we try and use the bytes freed in a calculation.
That PR changed the behavior from evicting a pod upon error, to panicking because of the nil pointer.

This should fix inode eviction tests

/assign @dchen1107
2017-05-17 18:03:59 -07:00
Kubernetes Submit Queue ed8ce901f8 Merge pull request #45977 from yujuhong/started_time
Automatic merge from submit-queue (batch tested with PRs 45977, 45890)

kuberuntime: report StartedAt regardless of container states

This fixes #45943

**Release note**:
```release-note
Fix the bug where StartedAt time is not reported for exited containers.
```
2017-05-17 15:39:01 -07:00
Yu-Ju Hong de0438a5c8 kuberuntime: add unit tests for container status population
Also refactor a little bit to make the function more testable.
2017-05-17 13:14:00 -07:00
David Ashpole c9f58c0cd5 dont return nil quantities when calling deleteImages, as this quantity is used regardless of err 2017-05-17 12:58:41 -07:00
Yu-Ju Hong 7c75f5c551 kuberuntime: report StartedAt for exited containers 2017-05-17 11:14:09 -07:00
Kubernetes Submit Queue 4a9a702ee1 Merge pull request #45926 from MrHohn/api-annotations-move
Automatic merge from submit-queue

Move all API related annotations into annotation_key_constants.go

Separate from #45869. See https://github.com/kubernetes/kubernetes/pull/45869#discussion_r116839411 for details.

This PR does nothing but move constants around :)

/assign @caesarxuchao 

**Release note**:

```release-note
NONE
```
2017-05-17 10:34:53 -07:00
NickrenREN ec7bf948d4 Unregister some metrics
delete some registered metrics since they are not observed
2017-05-17 18:31:56 +08:00
Jamie Hannaford feb67d4672 Bump kubelet/networks test coverage 2017-05-17 11:20:06 +02:00
carlory 7fffa52bbd fix func comment in helpers.go 2017-05-17 15:44:21 +08:00
Kubernetes Submit Queue b10fd19232 Merge pull request #45625 from Random-Liu/fix-log-line
Automatic merge from submit-queue (batch tested with PRs 45860, 45119, 44525, 45625, 44403)

Make a log line more clear in kuberuntime_manager.go.

Make a log in `podSandboxChanged` more clear.

@yujuhong @feiskyer
2017-05-16 16:14:56 -07:00
Zihong Zheng a82676a126 Keep annotation_key_constants consistent 2017-05-16 14:25:30 -07:00
David Ashpole 21fb487245 wait for previous evicted pod to be cleaned up 2017-05-16 14:23:42 -07:00
Kubernetes Submit Queue 88a3b5babd Merge pull request #45111 from dwradcliffe/fix_kubelet_config_ignore
Automatic merge from submit-queue

kubelet: use the base filename to check if the filename starts with a dot

**What this PR does / why we need it**:
Fixes a bug in https://github.com/kubernetes/kubernetes/pull/39196. The goal was to ignore files that start with a dot but the value used is the full absolute filename including path.

**Which issue this PR fixes**: fixes #44450

@yujuhong

**Release note**:
```release-note
kubelet config should actually ignore files starting with dots
```
2017-05-16 11:39:02 -07:00
Kubernetes Submit Queue f82bdca459 Merge pull request #44326 from xlgao-zju/forcibly-remove
Automatic merge from submit-queue (batch tested with PRs 44326, 45768)

[CRI] Forcibly remove container

Forcibly remove the running containers in `RemoveContainer`. Since we should forcibly remove the running containers in `RemovePodSandbox`. See [here](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/api/v1alpha1/runtime/api.proto#L35).

cc @feiskyer @Random-Liu 

Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>
2017-05-16 10:39:05 -07:00
David Radcliffe aa4fdf5907 use the base filename to check if the filename starts with a dot 2017-05-16 12:17:58 -04:00
Kubernetes Submit Queue 576d1d243e Merge pull request #45408 from Carlory/fix-typo
Automatic merge from submit-queue

fix typo in docker_container.go

Signed-off-by: Carlory <fanbaofa@gmail.com>



**What this PR does / why we need it**:
fix typo in docker_container.go

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

**Special notes for your reviewer**:
NONE

**Release note**:

```release-note
NONE
```
2017-05-16 09:06:38 -07:00
zhangxiaoyu-zidif 471f97526b delete unused para. 2017-05-16 18:46:29 +08:00
Kubernetes Submit Queue 7cd32aba17 Merge pull request #45775 from liggitt/mirror-pod-validation
Automatic merge from submit-queue (batch tested with PRs 44337, 45775, 45832, 45574, 45758)

Tighten validation of mirror pod annotations

Tightens validation for pods with a mirror pod annotation:
1. spec.nodeName must be set
2. makes the mirror pod annotation immutable
3. starts validating pod-specific annotations during pod status update

None of these changes affect usage of the mirror pod annotation by kubelets, which only set it on pod creation (verified this is true back to 1.5.x)

the second commit updates the pod validation tests to look for specific error messages (best reviewed ignoring whitespace changes)

This is the validation portion of https://github.com/kubernetes/community/blob/master/contributors/design-proposals/kubelet-authorizer.md and https://github.com/kubernetes/features/issues/279

```release-note
Mirror pods must now indicate the nodeName they are bound to on creation. The mirror pod annotation is now treated as immutable and cannot be added to an existing pod, removed from a pod, or modified.
```
2017-05-15 18:39:13 -07:00
Kubernetes Submit Queue e11963194e Merge pull request #45808 from Crazykev/quick-fix
Automatic merge from submit-queue (batch tested with PRs 45171, 43947, 45788, 45822, 45808)

[CRI] Continue remove image when can't find image id with ImageRef

Signed-off-by: Crazykev <crazykev@zju.edu.cn>



**What this PR does / why we need it**: 
Should try to remove imageRef as repo:tag when can't find it as imageID.
/cc @feiskyer @Random-Liu  PTAL
also /cc @xlgao-zju @heartlock

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

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-05-15 14:24:51 -07:00
Kubernetes Submit Queue 51d6429a62 Merge pull request #45658 from zhangxiaoyu-zidif/add-strong-to-parsepodfulname
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658)

ParsePodFullName():code robustness

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

ParsePodFullName():code robustness

if pod name or namespace name is null, the function can handle it.
Meanwhile update unit test 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-15 13:25:52 -07:00
Kubernetes Submit Queue f6bcd28cd7 Merge pull request #41331 from dshulyak/import_remotecommand
Automatic merge from submit-queue (batch tested with PRs 41331, 45591, 45600, 45176, 45658)

Move client/unversioned/remotecommand to client-go

Module remotecommand originally part of kubernetes/pkg/client/unversioned was moved
to client-go/tools, and will be used as authoritative in kubectl, e2e and other places.

Module remotecommand relies on util/exec module which was copied to client-go/pkg/util
2017-05-15 13:25:42 -07:00
Kubernetes Submit Queue 1b7dacde4b Merge pull request #41766 from feiskyer/sysctls
Automatic merge from submit-queue (batch tested with PRs 45826, 45747, 45548, 45606, 41766)

CRI: using typed filed for sysctls

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

CRI supports sysctls via annotations [today](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/api/v1alpha1/runtime/api.proto#L237), we should move them to typed and structured fields instead. (refer [here](https://github.com/kubernetes/kubernetes/issues/30819#issuecomment-253369441))

**Which issue this PR fixes** 

Part of #39130.

**Release note**:

```release-note
NONE
```
2017-05-15 11:39:29 -07:00
Dmitry Shulyak a713604b24 Use streaming constants from pkg/api/v1 instead of pkg/api 2017-05-15 17:00:14 +03:00
Dmitry Shulyak 2612e0c78a Move client/unversioned/remotecommand to client-go
Module remotecommand originally part of kubernetes/pkg/client/unversioned was moved
to client-go/tools, and will be used as authoritative in kubectl, e2e and other places.

Module remotecommand relies on util/exec module which will be copied to client-go/pkg/util
2017-05-15 16:28:56 +03:00
Crazykev 1369a263f5 continue remove image when can't find image id with ref
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
2017-05-15 19:12:29 +08:00
Xing Zhou a2e68e96cb Fix typo.
Fixed typo.
2017-05-15 14:01:30 +08:00
Pengfei Ni 2b4956c208 dockershim: get sysctls from sandbox config instead of annotations 2017-05-15 12:53:32 +08:00
Pengfei Ni 8bc6e59278 kuberuntime: set sysctls for sandbox config 2017-05-15 12:52:38 +08:00
Pengfei Ni a7c9638e56 CRI: move sysctls annotations to typed fields 2017-05-15 12:52:01 +08:00
Jordan Liggitt cd3a1187a1
Require nodeName for mirror pods, make mirror pod annotation immutable 2017-05-13 22:34:41 -04:00
heartlock 8e702347ad set LogPath in dockershim
Signed-off-by: heartlock <21521209@zju.edu.cn>
2017-05-13 03:24:44 +00:00
heartlock c3b52267ca add LogPath for container status in CRI Interface
Signed-off-by: heartlock <21521209@zju.edu.cn>
2017-05-13 03:20:17 +00:00
Kubernetes Submit Queue ce4f010b01 Merge pull request #45553 from jcbsmpsn/init-certificate-manager-no-client
Automatic merge from submit-queue (batch tested with PRs 42759, 45553)

Allow certificate manager to be initialized with client.

Add test coverage to the certificate manager covering the initialization
scenario where it is initialized with no Certificate Request Signing
client, then the client is added later. This matches how it will be used
when the Certificate Request Signing client is also the consumer of the
certificate manager.
2017-05-12 17:48:39 -07:00
Kubernetes Submit Queue 3619c33350 Merge pull request #42759 from mtaufen/kubelet-apis-reorg
Automatic merge from submit-queue

Reorganize kubelet tree so apis can be independently versioned

@yujuhong @lavalamp @thockin @bgrant0607 
This is an example of how we might reorganize `pkg/kubelet` so the apis it exposes can be independently versioned. This would also provide a logical place to put the `KubeletConfiguration` type, which currently lives in `pkg/apis/componentconfig`; it could live in e.g. `pkg/kubelet/apis/config` instead.

Take a look when you have a chance and let me know what you think. The most significant change in this PR is reorganizing `pkg/kubelet/api` to `pkg/kubelet/apis`, the rest is pretty much updating import paths and `BUILD` files.
2017-05-12 17:43:22 -07:00
Kubernetes Submit Queue 816f8e29d8 Merge pull request #45623 from wongma7/subpath-file
Automatic merge from submit-queue

Don't attempt to make and chmod subPath if it already exists

fixes https://github.com/kubernetes/kubernetes/issues/45613

https://github.com/kubernetes/kubernetes/pull/43775 fixed one bug and introduced another... I overlooked that subPaths can be files, in which case MkDirAll will simply fail and the pod will not able to start.

Regardless of whether it is a directory or a file, there is no need to introduce the MkdirAll->Chmod  procedure if it exists, because if it exists, it should already have the correct permissions.

This needs to be cherry-picked into 1.6.

```release-note
Fix pods failing to start if they specify a file as a volume subPath to mount
```
2017-05-12 14:55:45 -07:00
Kubernetes Submit Queue 9c8287d629 Merge pull request #45624 from dashpole/kubelet_cleanup
Automatic merge from submit-queue (batch tested with PRs 45685, 45572, 45624, 45723, 45733)

Remove unused fields from Kubelet struct

Just a small attempt to clean up some unused fields in the kubelet struct.  This doesn't make any actual code changes.

/assign @mtaufen
2017-05-12 14:00:57 -07:00
Jacob Simpson de23d3fd00 Allow certificate manager to be initialized with client.
Add test coverage to the certificate manager covering the initialization
scenario where it is initialized with no Certificate Request Signing
client, then the client is added later. This matches how it will be used
when the Certificate Request Signing client is also the consumer of the
certificate manager.
2017-05-12 13:53:37 -07:00
Michael Taufen cbad320205 Reorganize kubelet tree so apis can be independently versioned 2017-05-12 10:02:33 -07:00
Kubernetes Submit Queue e1bb9a5177 Merge pull request #45667 from yujuhong/mv-pull-tests
Automatic merge from submit-queue (batch tested with PRs 45691, 45667, 45698, 45715)

dockertools: migrate the unit tests and delete the package
2017-05-12 04:09:41 -07:00
Kubernetes Submit Queue 1d4f0b4ac9 Merge pull request #45266 from Crazykev/remove-image
Automatic merge from submit-queue (batch tested with PRs 45684, 45266, 45669, 44787, 44984)

[CRI] Return success if ImageNotFound in RemoveImage() 

Signed-off-by: Crazykev <crazykev@zju.edu.cn>



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

**Sorry for close the [old one](https://github.com/kubernetes/kubernetes/pull/44381) mistakenly,  rebase and move to here.**
RemoveImage() operation should be idempotent, [ref](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/api/v1alpha1/runtime/api.proto#L89-L92)
 @feiskyer @Random-Liu PTAL


**Which issue this PR fixes**

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-12 03:20:38 -07:00
Kubernetes Submit Queue 990cbb3127 Merge pull request #45663 from JulienBalestra/rkt-improve-gc
Automatic merge from submit-queue (batch tested with PRs 45571, 45657, 45638, 45663, 45622)

rkt: Improve the Garbage Collection

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

This PR improve the garbage collection of files written inside the `/var/lib/kubelet/pods/<pod: id>`

It removes the` finished-<pod: id>` file touched during the `ExecStopPost` of the systemd unit.
It also removes the `/dev/termination-log` file mounted into containers .

The termination-log is used to produce a message from the container and collected by the kubelet when the Pod stops.
Especially for the termination-log, removing theses files will free the associated space used on the filesystem.


**Release note**:

`NONE`
2017-05-12 02:28:40 -07:00
Kubernetes Submit Queue 1f22204119 Merge pull request #45571 from verb/fix-fakeruntime-assertcalls
Automatic merge from submit-queue

Fix AssertCalls usage for kubelet fake runtimes unit tests

Despite its name, AssertCalls() does not assert anything. It returns an error that should be checked. This was causing false negatives for a handful of unit tests, which are also fixed here.

Tests for the image manager needed to be rearranged in order to accommodate a potentially different sequence of calls each tick because the image puller changes behavior based on prior errors.

**What this PR does / why we need it**: Fixes broken unit tests

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

**Special notes for your reviewer**: 

**Release note**:

```release-note
NONE
```
2017-05-12 01:45:22 -07:00
Kubernetes Submit Queue 6c50ffcf7b Merge pull request #45291 from yaxinlx/feature-request/fix-kubelet-channel-close
Automatic merge from submit-queue

There is a rule in using go channel: never close a channel in the

receiver side.

fix https://github.com/kubernetes/kubernetes/issues/45215
2017-05-12 00:16:59 -07:00
Ian Chakeres b1315f4491 Refactor reconciler volume log and error messages 2017-05-11 22:33:17 -07:00
Hemant Kumar 951a36aac7 Add Keepterminatedpodvolumes as a annotation on node
and lets make sure that controller respects it
and doesn't detaches mounted volumes.
2017-05-11 22:31:14 -04:00
Kubernetes Submit Queue 3dfffac7f9 Merge pull request #41684 from gyliu513/kubelet-types-labels
Automatic merge from submit-queue

Improved code coverage for pkg/kubelet/types/labels

The test coverage improved from 0% to 100%.
This fixed part of #40780



**What this PR does / why we need it**:
Increase test coverage.

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

**Special notes for your reviewer**:
release-note-none

**Release note**:

```NONE
```
2017-05-11 12:20:17 -07:00
Yu-Ju Hong fccf34ccb6 Remove various references of dockertools
Also update the bazel files.
2017-05-11 10:01:41 -07:00
Yu-Ju Hong 4b72d229f7 Migrate unit tests for image pulling credentials and error handling
Also remove the dockertools package completely.
2017-05-11 10:01:41 -07:00
Crazykev ebb5c3d13d return success if ImageNotFound in RemoveImage()
Signed-off-by: Crazykev <crazykev@zju.edu.cn>
2017-05-11 23:00:34 +08:00
Julien Balestra 00d87a7209 Remove the termination-log files, the finished- marker file during the GC 2017-05-11 16:36:44 +02:00
zhangxiaoyu-zidif 65080ea1c1 ParsePodFullName():code robustness 2017-05-11 19:14:16 +08:00
Xianglin Gao 0144803c07 Forcibly remove container
Signed-off-by: Xianglin Gao <xlgao@zju.edu.cn>
2017-05-11 18:39:37 +08:00
Kubernetes Submit Queue 873ce9ca4a Merge pull request #45515 from derekwaynecarr/ignore-openrc
Automatic merge from submit-queue (batch tested with PRs 45515, 45579)

Ignore openrc cgroup

**What this PR does / why we need it**:
It is a work-around for the following: https://github.com/opencontainers/runc/issues/1440

**Special notes for your reviewer**:
I am open to a cleaner way to do this, but we have many developer users on Macs that ran containerized kubelets that are not able to run them right now due to the inclusion of openrc tripping up our existence checks.  Ideally, runc can give us a call to say "does this exist according to what runc knows about".  Or we could add a whitelist check.  Right now, this was the smallest hack pending more discussion.
2017-05-10 23:20:40 -07:00
Kubernetes Submit Queue 1f3b158a10 Merge pull request #45194 from yujuhong/rm-cri-flag
Automatic merge from submit-queue

Remove the deprecated `--enable-cri` flag

Except for rkt, CRI is the default and only integration point for
container runtimes.

```release-note
Remove the deprecated `--enable-cri` flag. CRI is now the default, 
and the only way to integrate with kubelet for the container runtimes.
```
2017-05-10 20:46:24 -07:00
yaxinlx c280b7cab7 There is a rule in using go channel: never close a channel in the
receiver side.

fix https://github.com/kubernetes/kubernetes/issues/45215

delete the channel close line

change the event channel element type to struct{}

go fmt

eventCh channel is not essential to be buffered
2017-05-11 10:19:28 +08:00
Kubernetes Submit Queue aacc9729f1 Merge pull request #44781 from wongma7/outervolumespec
Automatic merge from submit-queue (batch tested with PRs 45382, 45384, 44781, 45333, 45543)

Ensure desired state of world populator runs before volume reconstructor

If the kubelet's volumemanager reconstructor for actual state of world runs before the desired state of world has been populated, the pods in the actual state of world will have some incorrect volume information: namely outerVolumeSpecName, which if incorrect leads to part of the issue here https://github.com/kubernetes/kubernetes/issues/43515, because WaitForVolumeAttachAndMount searches the actual state of world with the correct outerVolumeSpecName and won't find it so reports 'timeout waiting....', etc. forever for existing pods. The comments acknowledge that this is a known issue

The all sources ready check doesn't work because the sources being ready doesn't necessarily mean the desired state of world populator added pods from the sources. So instead let's put the all sources ready check in the *populator*, and when the sources are ready, it will be able to populate the desired state of world and make "HasAddedPods()" return true. THEN, the reconstructor may run.

@jingxu97 PTAL, you wrote all of the reconstruction stuff

```release-note
NONE
```
2017-05-10 17:47:43 -07:00
Random-Liu 613c42b89b Make a log line more clear in kuberuntime_manager.go. 2017-05-10 16:32:00 -07:00
David Ashpole b69dacbd86 remove unused fields from Kubelet struct 2017-05-10 16:25:09 -07:00
Matthew Wong 9c6223f885 Don't attempt to make and chmod subPath if it already exists 2017-05-10 18:47:03 -04:00
Yu-Ju Hong daa329c9ae Remove the deprecated `--enable-cri` flag
Except for rkt, CRI is the default and only integration point for
container runtimes.
2017-05-10 13:03:41 -07:00
Kubernetes Submit Queue 77b2e6302c Merge pull request #45236 from verb/sharedpid-2-default
Automatic merge from submit-queue

Enable shared PID namespace by default for docker pods

**What this PR does / why we need it**: This PR enables PID namespace sharing for docker pods by default, bringing the behavior of docker in line with the other CRI runtimes when used with docker >= 1.13.1.

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

**Special notes for your reviewer**: cc @dchen1107 @yujuhong 

**Release note**:

```release-note
Kubernetes now shares a single PID namespace among all containers in a pod when running with docker >= 1.13.1. This means processes can now signal processes in other containers in a pod, but it also means that the `kubectl exec {pod} kill 1` pattern will cause the pod to be restarted rather than a single container.
```
2017-05-10 12:06:01 -07:00
Derek Carr 4e002eacb1 Do not fail cgroup exists checks for unknown controllers 2017-05-10 14:52:09 -04:00
Kubernetes Submit Queue 51a3413371 Merge pull request #45307 from yujuhong/mv-docker-client
Automatic merge from submit-queue (batch tested with PRs 45453, 45307, 44987)

Migrate the docker client code from dockertools to dockershim

Move docker client code from dockertools to dockershim/libdocker. This includes
DockerInterface (renamed to Interface), FakeDockerClient, etc.

This is part of #43234
2017-05-09 20:23:44 -07:00
Lee Verberne f83337a8ac Fix AssertCalls usage for kubelet fake runtimes
Despite its name, AssertCalls() does not assert anything. It returns an
error that must be checked. This was causing false negatives for
a handful of unit tests.
2017-05-10 01:40:58 +00:00
Matthew Wong bbe82a2688 Ensure desired state of world populator runs before volume reconstructor 2017-05-09 18:25:59 -04:00
Kubernetes Submit Queue 76889118d7 Merge pull request #45280 from JulienBalestra/run-pod-inside-unique-netns
Automatic merge from submit-queue

rkt: Generate a new Network Namespace for each Pod

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

This PR concerns the Kubelet with the Container runtime rkt.
Currently, when a Pod stops and the kubelet restart it, the Pod will use the **same network namespace** based on its PodID.

When the Garbage Collection is triggered, it delete all the old resources and the current network namespace.

The Pods and all containers inside it loose the _eth0_ interface.
I explained more in details in #45149 how to reproduce this behavior.

This PR generates a new unique network namespace name for each new/restarting Pod.
The Garbage collection retrieve the correct network namespace and remove it safely.

**Which issue this PR fixes** : 

fix #45149 

**Special notes for your reviewer**:

Following @yifan-gu guidelines, so maybe expecting him for the final review.

**Release note**:

`NONE`
2017-05-09 15:07:34 -07:00
Kubernetes Submit Queue aee07e9464 Merge pull request #45446 from zdj6373/cni
Automatic merge from submit-queue

cni Log changes

Newly modified log error, modified
2017-05-09 14:23:32 -07:00
Kubernetes Submit Queue b60d322c27 Merge pull request #44991 from aaronlevy/cns
Automatic merge from submit-queue

Skip inspecting pod network if unknown namespace

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

If we fail to determine the network namespace of a container we still try to inspect the state - even though there is no way for it to succeed. This leads to errors like:

> NetworkPlugin cni failed on the status hook for pod "X": Unexpected command output nsenter: cannot open : No such file or directory

Instead, if we cannot determine the network namespace, we should just exit with a (hopefully) more clear error message.

I left the wording as assuming a terminated pod, based on:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/dockershim/helpers.go#L208-L211

ref: 
https://github.com/kubernetes-incubator/bootkube/issues/475
https://github.com/coreos/coreos-kubernetes/issues/856
2017-05-09 13:36:56 -07:00
JulienBalestra 7a2e0e24f7 Generate a new Network Namespace for each Pod. 2017-05-09 09:59:00 +02:00
Kubernetes Submit Queue f036725a0e Merge pull request #45018 from ravisantoshgudimetla/cleanup_qos#39148
Automatic merge from submit-queue (batch tested with PRs 45018, 45330)

Clean up for qos.go

**What this PR does / why we need it**:
Seems we are not using any of those functions. 

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



**Release note**:

```release-note
A small clean up to remove unnecessary functions.
```
2017-05-08 23:00:36 -07:00
Kubernetes Submit Queue f263fbe5e1 Merge pull request #45200 from jcbsmpsn/init-certificate-manager-no-certs
Automatic merge from submit-queue (batch tested with PRs 45200, 45203)

Allow certificate manager to be initialized with no certs.

Adds support to the certificate manager so it can be initialized with no
certs and only a connection to the certificate request signing API. This
specifically covers the scenario for the kubelet server certificate,
where there is a request signing client but on first boot there is no
bootstrapping or local certs.
2017-05-08 17:43:40 -07:00
Kubernetes Submit Queue 60e02711d4 Merge pull request #44126 from xiangpengzhao/fix-const
Automatic merge from submit-queue (batch tested with PRs 45508, 44258, 44126, 45441, 45320)

Use existing global var criSupportedLogDrivers

**What this PR does / why we need it**:
Use existing global var `criSupportedLogDrivers` defined in docker_service.go. If CRI supports other log drivers in the future, we will only need to modify that global var.

cc @Random-Liu
2017-05-08 16:34:44 -07:00
Kubernetes Submit Queue a062782524 Merge pull request #44258 from wlan0/master
Automatic merge from submit-queue (batch tested with PRs 45508, 44258, 44126, 45441, 45320)

cloud initialize node in external cloud controller

@thockin This PR adds support in the `cloud-controller-manager` to initialize nodes (instead of kubelet, which did it previously)

This also adds support in the kubelet to skip node cloud initialization when `--cloud-provider=external`

Specifically,

Kubelet

1. The kubelet has a new flag called `--provider-id` which uniquely identifies a node in an external DB
2. The kubelet sets a node taint - called "ExternalCloudProvider=true:NoSchedule" if cloudprovider == "external"

Cloud-Controller-Manager

1. The cloud-controller-manager listens on "AddNode" events, and then processes nodes that starts with that above taint. It performs the cloud node initialization steps that were previously being done by the kubelet.
2. On addition of node, it figures out the zone, region, instance-type, removes the above taint and updates the node.
3. Then periodically queries the cloudprovider for node addresses (which was previously done by the kubelet) and updates the node if there are new addresses

```release-note
NONE  
```
2017-05-08 16:34:43 -07:00
Kubernetes Submit Queue f4fc4be805 Merge pull request #44727 from x1957/master
Automatic merge from submit-queue

adds log when gpuManager.start() failed

If gpuManager.start() returns error, there is no log.

We confused with scheduler do not schedule any pod(with gpu) to one node.
kubectl describe node xxx shows there is no gpu on that node, because the gpu driver do not work on that node, gpuManager.start() failed, but we can not see anything in log.
2017-05-08 14:27:48 -07:00
zdj6373 aa86d7734b Log changes 2017-05-06 11:22:37 +08:00
wlan0 45d2bc06b7 cloud initialize node in external cloud controller 2017-05-05 16:51:45 -07:00
Kubernetes Submit Queue b5831357dc Merge pull request #45305 from jwforres/fix-error-msg-spelling
Automatic merge from submit-queue (batch tested with PRs 43006, 45305, 45390, 45412, 45392)

Fix spelling in container manager error message
2017-05-05 16:39:06 -07:00
Kubernetes Submit Queue 069a25f378 Merge pull request #43006 from apilloud/fix_failure_crash
Automatic merge from submit-queue

Fix crash on Pods().Get() failure

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

Fixes a potential crash in syncPod when Pods().Get() returns an error other than NotFound. This is unlikely to occur with the standard client, but easily shows up with a stub kube client that returns Unimplemented to everything. Updates the unit test as well.

**Release note**:
`NONE`
2017-05-05 16:25:23 -07:00
Kubernetes Submit Queue 17d33ea82e Merge pull request #44830 from NickrenREN/remove-NodeLegacyHostIP
Automatic merge from submit-queue

Remove deprecated NodeLegacyHostIP

**Release note**:
```release-note
Remove deprecated node address type `NodeLegacyHostIP`.
```

ref #44807
2017-05-05 15:38:58 -07:00
Yu-Ju Hong cf3635c876 Update bazel BUID files 2017-05-05 11:48:08 -07:00
Yu-Ju Hong 8cc4b3a81e Move legacy log symlink to kuberuntime
Also remove the dockertools.DockerType constant.
2017-05-05 11:48:08 -07:00
Yu-Ju Hong 389c140eaf Move docker client code from dockertools to dockershim/dockerlib
The code affected include DockerInterface (renamed to Interface),
FakeDockerClient, etc.
2017-05-05 11:48:08 -07:00
allencloud 503c19aec3 use make slice to store objects to improve efficiency
Signed-off-by: allencloud <allen.sun@daocloud.io>
2017-05-05 23:25:56 +08:00
Jamie Hannaford 9440a68744 Use dedicated Unix User and Group ID types 2017-05-05 14:07:38 +02:00
Carlory 849454cd72 fix typo in docker_container.go
Signed-off-by: Carlory <fanbaofa@gmail.com>
2017-05-05 10:38:44 +00:00
Andrew Pilloud b8dca4dd9d Refactor syncPod to fix panics on error 2017-05-04 10:18:24 -07:00
Kubernetes Submit Queue d41b11b8fb Merge pull request #45329 from supereagle/remove-useless-code
Automatic merge from submit-queue

remove useless code in kubelet

**What this PR does / why we need it**:
This code has logical error as the etc-hosts file will be recreated even it already exists. In addition, if do not recreate etc-hosts file when it exists, the pod ip in it will be out of date when pod ips change. So remove this code as it is not needed.

**Which issue this PR fixes**: 

**Special notes for your reviewer**:
xrefer: #44481, #44473

**Release note**:
```release-note
NONE
```
2017-05-04 09:06:33 -07:00
Kubernetes Submit Queue f6ec7bade1 Merge pull request #45316 from yujuhong/dockershim-plugin-settings
Automatic merge from submit-queue (batch tested with PRs 45316, 45341)

Pass NoOpLegacyHost to dockershim in --experimental-dockershim mode

This allows dockershim to use network plugins, if needed.

/cc @Random-Liu
2017-05-04 05:19:49 -07:00
supereagle b186e367e1 remove useless code in kubelet 2017-05-04 13:53:48 +08:00
Kubernetes Submit Queue 3a259d38b2 Merge pull request #45292 from yujuhong/seccomp_test
Automatic merge from submit-queue (batch tested with PRs 44068, 45292)

Add the seccomp profile loading test to dockershim

The test was originally in docker_manager_test.go (now removed). I
copied and adapated the logic for the new test. Also move the origina
test fixtures needed for the test.

ref: the original test is at https://github.com/kubernetes/kubernetes/blob/v1.6.2/pkg/kubelet/dockertools/docker_manager_linux_test.go#L294

This is part of #43234
2017-05-03 20:50:00 -07:00
Kubernetes Submit Queue 08a825c9e9 Merge pull request #44068 from mkumatag/k8s_add_apiversion
Automatic merge from submit-queue

Use Docker API Version instead of docker version

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

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
Fixes #42492
**Special notes for your reviewer**:

**Release note**:

`Update cadvisor to latest head to use docker APIversion exposed by cadvisor`
2017-05-03 20:21:45 -07:00
Kubernetes Submit Queue 482e3501dc Merge pull request #44904 from feiskyer/status
Automatic merge from submit-queue (batch tested with PRs 45056, 44904, 45312)

CRI: clarify the behavior of PodSandboxStatus and ContainerStatus

**What this PR does / why we need it**:
Currently, we define that ImageStatus should return `nil, nil` when requested image doesn't exist, and kubelet is relying on this behavior now.

However, we haven't clearly defined the behavior of PodSandboxStatus and ContainerStatus. Currently, they return error when requested sandbox/container doesn't exist, and kubelet is also relying on this behavior.

**Which issue this PR fixes** 

Fixes #44885.

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-03 19:44:02 -07:00
xiangpengzhao 9af3b0a406 Use existed global var criSupportedLogDrivers and helper function IsCRISupportedLogDriver 2017-05-04 10:25:21 +08:00
Kubernetes Submit Queue 84f41f3388 Merge pull request #41733 from feiskyer/images
Automatic merge from submit-queue (batch tested with PRs 45314, 45250, 41733)

CRI: add ImageFsInfo API

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

kubelet currently relies on cadvisor to get the ImageFS info for supported runtimes, i.e., docker and rkt. This PR adds ImageFsInfo API to CRI so kubelet could get the ImageFS correctly for all runtimes.

**Which issue this PR fixes** 

First step for  #33048 ~~also reverts temporary ImageStats in #33870~~.

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-03 18:47:04 -07:00
Yu-Ju Hong 40b0474956 pass noopnetworkhost to dockershim 2017-05-03 16:32:01 -07:00