Commit Graph

5463 Commits (9807360fe30d2947eea5833aeaf19d47c9c3c89c)

Author SHA1 Message Date
Kubernetes Submit Queue a9e244d81f Merge pull request #53564 from supereagle/remove-network-plugin-dir-flag
Automatic merge from submit-queue (batch tested with PRs 53743, 53564). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubelet: remove the --network-plugin-dir flag

**What this PR does / why we need it**:
This flag has been replaced with `--cni-bin-dir`,  and has been deprecated in Kubernetes 1.7.
It is safe to remove in Kubernetes 1.9 according to the deprecation policy.

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

**Special notes for your reviewer**:
/assign @mtaufen @freehan @dchen1107

**Release note**:
```release-note
Remove the --network-plugin-dir flag.
```
2017-10-23 13:39:12 -07:00
Kubernetes Submit Queue c1925d4944 Merge pull request #52747 from RenaudWasTaken/connexion-closed
Automatic merge from submit-queue (batch tested with PRs 52747, 54329). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Device Plugin Endpoints correctly closes client connexion

**What this PR does / why we need it**:
Endpoints in the device plugin may unexpectedly end. Currently the connexion will not be properly closed.
This commit aims to fix this
Related issues #51993

**Special notes for your reviewer**: @jiayingz @mindprince @vishh 

**Release note**:
```release-note
NONE
```
2017-10-20 20:41:06 -07:00
Kubernetes Submit Queue c434e85f55 Merge pull request #52147 from lichuqiang/cleanupOnly
Automatic merge from submit-queue (batch tested with PRs 52147, 54309). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Deviceplugin refactoring: cleanup some unnecessary functions

**What this PR does / why we need it**:
cleanup some of unnecessary functions of deviceplugin to improve code readability 

**Which issue this PR fixes** 
 fixes #51993 
Part1

**Special notes for your reviewer**:
Currently, it seems that func `IsResourceNameValid` is not used outside and could be changed to internal.
But as Renaud commented, it is designed for potential usage from users outside. 
And I could not find a better position to place the func, except for file `utils.go`. So, shall we just retain the `utils.go` file, and maybe for possible expansion in the future?

/cc @jiayingz @RenaudWasTaken @vishh 

**Release note**:

```release-note
NONE
```
2017-10-20 14:58:11 -07:00
Kubernetes Submit Queue 4892b54c26 Merge pull request #53194 from dixudx/cleanup_kubelet_multiple_convert_validation
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

avoid kubelet converts and validates pods multiple times

**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 #53171

**Special notes for your reviewer**:
/assign @yujuhong @caesarxuchao 

**Release note**:

```release-note
None
```
2017-10-20 03:10:08 -07:00
Kubernetes Submit Queue ba66fcb63d Merge pull request #54125 from feiskyer/docker-images
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix dockershim panic when listing images

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

dockershim panic when listing containers because of `opts.Filters` not initialized:

505ccb88da/pkg/kubelet/dockershim/docker_image.go (L35-L39)

Also when imgSpec.Image is empty string, dockershim returns an empty image list which is not expected. (We should not set opts.Filters in this case).

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-19 23:03:26 -07:00
lichuqiang fd8b04649e unnecessary functions cleanup for deviceplugin 2017-10-20 09:37:59 +08:00
Kubernetes Submit Queue c3d47b683b Merge pull request #53031 from vishh/device-id
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make AllocateResponse artifacts global across all devices per container in device plugin API

The current version of Device plugins returns artifacts (env vars, mounts, devices) per device, per container. This is not necessary and results in complex merging issues on kubelet side

There can still be a conflict if the artifacts returned by device plugin conflicts with the pod spec. In that case, I'd recommend failing pods in kubelet. This is yet to be addressed.

The go package name for device plugin apis is updated from `pkg/kubelet/apis/deviceplugin/v1alpha1` to `pkg/kubelet/apis/deviceplugin/v1alpha` (sub-version dropped) because we expect the alpha version to change until it graduates to beta and changing the go package everytime the actual alpha version changes is too tedious.

```release-note
Device plugin Alpha API no longer supports returning artifacts per device as part of AllocateResponse.
```

TODO:
- [x] Bump kubelet side API version
- [X] Post an updated device plugin image that works with the new API version
- [ ] Stabilize e2es (This PR needs to be merged since there is a dependency on the plugin side for vendoring)
2017-10-19 12:43:52 -07:00
Vishnu kannan 16b0363b95 Disabling k8s.io/kubernetes/pkg/kubelet/cm TestPodContainerDeviceAllocation due to #54100
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-10-19 10:35:24 -07:00
Vishnu kannan e0032af916 bump device plugin version to v1alpha2 to reflect the change to AllocateResponce API
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-10-19 10:35:24 -07:00
Vishnu kannan 18eee1eaa0 Make AllocateResponse artifacts global across all devices per container in device plugin API
There is no use case known for passing artifacts per device as it currently exists. The current API is also
complex to use for simple clients. Hence this PR creates a flat namespace where artifacts like environment variables
and mount points apply globally to all devices returned as part of AllocateResponse proto.

Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-10-19 10:34:00 -07:00
Kubernetes Submit Queue 3667154d85 Merge pull request #54154 from mtaufen/deprecate-enable-custom-metrics
Automatic merge from submit-queue (batch tested with PRs 54154, 54192). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move --enable-cusom-metrics to KubeletFlags and mark it deprecated

With respect to https://github.com/kubernetes/kubernetes/pull/53833#issuecomment-336890235, EnableCustomMetrics should be marked deprecated and should not remain in the KubeletConfiguration struct. 

Broader issue: https://github.com/kubernetes/features/issues/281

```release-note
The Kubelet's --enable-custom-metrics flag is now marked deprecated.
```
2017-10-19 03:41:11 -07:00
Pengfei Ni 77ed72f583 Fix dockershim panic when listing images 2017-10-19 08:32:50 +08:00
Kubernetes Submit Queue d196a4abbb Merge pull request #54062 from porridge/fix-typo-method
Automatic merge from submit-queue (batch tested with PRs 43661, 54062). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix typo in function name.

Also remove a superfluous comment.

**Release note**:
```release-note
NONE
```
2017-10-18 13:11:23 -07:00
Kubernetes Submit Queue 257b6f38e9 Merge pull request #43661 from xiangpengzhao/revert-genmac
Automatic merge from submit-queue (batch tested with PRs 43661, 54062). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix #43583 (kubenet: remove code forcing bridge MAC address)

**What this PR does / why we need it**:
*kubenet: remove code forcing bridge MAC address*

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```

cc @dcbw @freehan
2017-10-18 13:11:20 -07:00
Kubernetes Submit Queue 09a42ba9e0 Merge pull request #47717 from chentao1596/remove-extra-log-parameter
Automatic merge from submit-queue (batch tested with PRs 47717, 53896). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Delete the redundant parameter flag

What this PR does / why we need it:

  Delete redundant parameter flag, otherwise the log will be show like:

  Warning: path "/var/lib/kubelet/pods/3c6c4869-4d02-11e7-9685-fa163eeda0fa/volumes" does not exist: %!q(MISSING)

  thank you!
2017-10-18 11:52:03 -07:00
Kubernetes Submit Queue 2d914ee703 Merge pull request #53984 from sttts/sttts-legacyscheme
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

pkg/api: extract Scheme/Registry/Codecs into pkg/api/legacyscheme

This serves as

- a preparation for the pkg/api->pkg/apis/core move
- and makes the dependency to the scheme explicit when vizualizing
  left depenncies.

The later helps with our our efforts to split up the monolithic repo
into self-contained sub-repos, e.g. for kubectl, controller-manager
and kube-apiserver in the future.
2017-10-18 10:49:10 -07:00
Michael Taufen 50b5a124bf Move --enable-cusom-metrics to KubeletFlags and mark it deprecated 2017-10-18 10:28:07 -07:00
Dr. Stefan Schimanski cad0364e73 Update bazel 2017-10-18 17:24:04 +02:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Kubernetes Submit Queue b958430ec2 Merge pull request #53965 from Random-Liu/add-extra-info-in-cri
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

CRI: Add extra information in status functions in CRI.

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

@yujuhong @feiskyer @mrunalp 
/cc @kubernetes/sig-node-api-reviews 

```release-note
Verbose option is added to each status function in CRI. Container runtime could return extra information in status response for debugging.
```
2017-10-18 03:02:29 -07:00
Kubernetes Submit Queue a1e786f138 Merge pull request #54059 from porridge/fix-lint-err
Automatic merge from submit-queue (batch tested with PRs 53696, 54059). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix lint warnings for useless err checks.

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

This check was recently added to golint.

**Which issue this PR fixes**

Related to #37254

**Release note**:
```release-note
NONE
```
2017-10-18 00:58:59 -07:00
Kubernetes Submit Queue a3a659b8ca Merge pull request #53696 from drinktee/kuberuntimeunitest
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Increases test coverage for kubelet/kuberuntime

What this PR does / why we need it:
Increases test coverage for kubelet/kuberuntime
#46123

Which issue this PR fixes:
#46123

/assign @feiskyer
2017-10-18 00:43:08 -07:00
supereagle 0b88971505 kubelet: remove the --network-plugin-dir flag 2017-10-18 09:37:19 +08:00
Kubernetes Submit Queue e3e2e24cc5 Merge pull request #52503 from joelsmith/journald-log-fallback
Automatic merge from submit-queue (batch tested with PRs 54040, 52503). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Get fallback termination msg from docker when using journald log driver

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

When using the legacy docker container runtime and when a container has `terminationMessagePolicy=FallbackToLogsOnError` and when docker is configured with a log driver other than `json-log` (such as `journald`), the kubelet should not try to get the container's log from the json log file (since it's not there) but should instead ask docker for the logs.

**Which issue this PR fixes** fixes #52502

**Special notes for your reviewer**:

**Release note**:
```release-note
Fixed log fallback termination messages when using docker with journald log driver
```
2017-10-17 13:18:15 -07:00
Kubernetes Submit Queue 86f7e2706a Merge pull request #54040 from dixudx/fix_kubelet_runtime_version_parsing
Automatic merge from submit-queue (batch tested with PRs 54040, 52503). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

falls back to parse Docker runtime version as generic if not semver

**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 #54039

**Special notes for your reviewer**:
/assign @tallclair @vishh 

**Release note**:

```release-note
falls back to parse Docker runtime version as generic if not semver
```
2017-10-17 13:18:12 -07:00
Kubernetes Submit Queue abb7789cd8 Merge pull request #54073 from liggitt/node-default-label
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Do not remove kubelet labels during startup

Fixes #54070 

```release-note
kubelet: prevent removal of default labels from Node API objects on startup
```
2017-10-17 10:55:40 -07:00
Kubernetes Submit Queue dfdfb8932f Merge pull request #52052 from joelsmith/master
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Clean up kublet secret and configmap unit test

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

These changes are clean-up items to fix confusing code encountered while investigating #52043. No actual bugs are fixed here (except, maybe, correcting unit tests that had actual/expected swapped).

A summary of the changes, as listed in the commit:

* Expected value comes before actual value in assert.Equal()
* Use `assert.Equal()` instead of `assert.True()` when possible
* Add a unit test that verifies no-op pod updates to the `secret_manager` and the `configmap_manager`
* Add a clarifying comment about why it's good to seemingly delete a secret on updates.
* Fix (for now, non-buggy) variable shadowing issue

**Special notes for your reviewer**:

N/A

**Release note**:
```release-note
NONE
```
2017-10-17 10:06:16 -07:00
Jordan Liggitt 9df1f7ef11
Do not remove kubelet labels during startup 2017-10-17 11:49:02 -04:00
Kubernetes Submit Queue d91e97f243 Merge pull request #53037 from smarterclayton/verify_client_cert
Automatic merge from submit-queue (batch tested with PRs 53978, 54008, 53037). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Verify the bootstrap client cert before using it
2017-10-17 04:53:42 -07:00
Marcin Owsiany 49553d4a7a Fix lint warnings for useless err checks.
This check was recently added to golint.
2017-10-17 12:52:54 +02:00
chenguoyan01 6a9070a59d add TestStatus to instrumented_services_test
Change-Id: Ib2fafd714ed0a48a4dbb3b9fb406e516d5587ae4
2017-10-17 18:33:02 +08:00
Kubernetes Submit Queue 1d8f1e268f Merge pull request #47699 from supereagle/fix-typos
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

fix typos: remove duplicated word in comments

**What this PR does / why we need it**: Remove the duplicated word `the` in comments

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

**Special notes for your reviewer**:

```release-note
NONE
```
2017-10-17 02:35:52 -07:00
Marcin Owsiany 36dc1c4515 Fix typo in function name.
Also remove a superfluous comment.
2017-10-17 11:31:46 +02:00
Di Xu 8f61376d05 kubelet falls back to parse generic version string if not semver 2017-10-17 14:31:18 +08:00
Lantao Liu c6ddc749e8 Add extra information in status functions in CRI. 2017-10-17 04:11:34 +00:00
chentao1596 42845e19bf Delete redundant parameter flag 2017-10-17 08:31:50 +08:00
Clayton Coleman 5649f9a578 Move pkg/kubelet/util/csr into client-go
Everything else it depends on was already there, and now we have a
somewhat consistent code chain.
2017-10-16 16:05:48 +02:00
Clayton Coleman b3a11aa635
Have the certificate manager decide if the server is healthy
Prevent a Kubelet from shutting down when the server isn't responding to
us but we cannot get a new certificate. This allows a cluster to coast
if the master is unresponsive or a node is partitioned and their client
cert expires.
2017-10-16 14:27:03 +02:00
Clayton Coleman cbecf17727
cache.ListWatchUntil should return err.ErrWaitTimeout
Clients shouldn't have to know about watch.ErrWatchClosed, which is
typically a server side decision to close and always means "Timeout" in
this conetxt.
2017-10-16 14:27:03 +02:00
Clayton Coleman 7555dec82e
Kubelet should exit if the current client cert has expired
The client cert manager uses the most recent cert to request new
certificates. If that certificate is expired, it will be unable to
complete new CSR requests. This commit alters the manager to force
process exit if no further client cert rotation is possible, which
is expected to trigger a restart of the kubelet and either a
re-bootstrap from the bootstrap kubeconfig or a re-read of the
current disk state (assuming that some other agent is managing the
bootstrap configuration).

This prevents the Kubelet from wedging in a state where it cannot make
API calls.
2017-10-16 14:27:03 +02:00
Clayton Coleman c3bea24ab6
Collapse duplicate code into pkg/util/csr
There is no reason to duplicate this code into two places.
2017-10-16 14:27:03 +02:00
Clayton Coleman de3d7d1881
If CSR is deleted, exit immediately
No point in waiting
2017-10-16 14:27:02 +02:00
Clayton Coleman 710dfb3427
Delete the private key for the bootstrap client cert on failure
Ensures that in a crash loop state we can make forward progress by
generating a new key and hence new CSR. If we do not delete the key, an
expired CSR may block startup.

Also more aggressively delete a bad cert path
2017-10-16 14:27:02 +02:00
Clayton Coleman 74a0abb699
An expired certificate is not compatible
If the certificate in the CSR is expired, it's no good to the code.
Error out with the correct message.
2017-10-16 14:27:02 +02:00
Clayton Coleman ae6ee96b36
Verify the bootstrap client cert before using it
Before the bootstrap client is used, check a number of conditions that
ensure it can be safely loaded by the server. If any of those conditions
are invalid, re-bootstrap the node. This is primarily to force
bootstrapping without human intervention when a certificate is expired,
but also handles partial file corruption.
2017-10-16 14:26:56 +02:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Kubernetes Submit Queue 0ba7c52b8c Merge pull request #53458 from dims/fix-pkg-cmd-dependencies
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix pkg/ depends on cmd/ problems

**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 #

Partial fix for https://github.com/kubernetes/kubernetes/issues/53341

**Special notes for your reviewer**:
No logic changes, Just moving things around

**Release note**:

```release-note
NONE
```
2017-10-13 23:56:55 -07:00
Kubernetes Submit Queue 3deab69d3b Merge pull request #53790 from yanxuean/cgroupredundancy
Automatic merge from submit-queue (batch tested with PRs 52959, 53790). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

remove redundancy code in setCPUCgroupConfig

fix #53925

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>



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

The check of burstableCPUShares is redundancy. We have done it in MilliCPUToShares. It is responsibility of MilliCPUToShares.
```
func (m *qosContainerManagerImpl) setCPUCgroupConfig(configs map[v1.PodQOSClass]*CgroupConfig) error {
        ........
	// set burstable shares based on current observe state
	burstableCPUShares := MilliCPUToShares(burstablePodCPURequest)
	if burstableCPUShares < uint64(MinShares) {
		burstableCPUShares = uint64(MinShares)
	}
```
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
Improveing code.

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-10-13 19:19:32 -07:00
Kubernetes Submit Queue e6e23ae163 Merge pull request #53857 from derekwaynecarr/sync-event
Automatic merge from submit-queue (batch tested with PRs 51840, 53542, 53857, 53831, 53702). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

kubelet sync pod throws more detailed events

**What this PR does / why we need it**:
If there are errors in the kubelet sync pod iteration, it is difficult to determine the problem.

This provides more specific events for errors that occur in the syncPod iteration to help perform problem isolation.

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

**Special notes for your reviewer**:
It is safer to dispatch more specific events now that we have an event budget per object enforced via https://github.com/kubernetes/kubernetes/pull/47367

**Release note**:
```release-note
kubelet provides more specific events when unable to sync pod
```
2017-10-13 12:44:52 -07:00
Kubernetes Submit Queue 1ee617c871 Merge pull request #53542 from dashpole/priority_eviction
Automatic merge from submit-queue (batch tested with PRs 51840, 53542, 53857, 53831, 53702). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Kubelet Evictions take Priority into account

Issue: https://github.com/kubernetes/kubernetes/issues/22212
This implements the eviction strategy documented here: https://github.com/kubernetes/community/pull/1162, and discussed here: https://github.com/kubernetes/community/pull/846.
When priority is not enabled, all pods are treated as equal priority.

This PR makes the following changes:

1. Changes the eviction ordering strategy to (usage < requests, priority, usage - requests)
2. Changes unit testing to account for this change in eviction strategy (including tests where priority is disabled).
3. Adds a node e2e test which tests the eviction ordering of pods with different priorities.

/assign @dchen1107 @vishh 
cc @bsalamat @derekwaynecarr 

```release-note
Kubelet evictions take pod priority into account
```
2017-10-13 12:44:50 -07:00