Commit Graph

145 Commits (13b12e89408869c5b560a81e95bca33267bdb8e1)

Author SHA1 Message Date
Cao Shufeng 0c9bb5a964 remove useless function hasHostPortConflicts
`hasHostPortConflicts` is not used anywhere. Delete it.
2017-12-18 16:14:26 +08:00
Davanum Srinivas 7568462ec3 Remove hacks added for mesos
Since Mesos is no longer in your main repository and since we have
things like dynamic kubelet configuration in progress, we should
drop these undocumented, untested, private hooks.

cmd/kubelet/app/server.go::CreateAPIServerClientConfig
CreateAPIServerClientConfig::getRuntime
pkg/kubelet/kubelet_pods.go::getPhase

Also remove stuff from Dependencies struct that were specific to
the Mesos integration (ContainerRuntimeOptions and Options)

Also remove stale references in test/e2e and and test owners file
2017-12-03 13:52:30 -05:00
Kubernetes Submit Queue 83e46f0a9e
Merge pull request #55902 from yguo0905/annotations
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>.

Expose single annotation/label via downward API

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

https://github.com/kubernetes/community/blob/master/contributors/design-proposals/node/annotations-downward-api.md

Support exposing single annotation via both env and volume downward API using the following syntax:

```
metadata.annotations['key']
metadata.labels['key']
```

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

#31218

**Special notes for your reviewer**:

This PR takes over the work in https://github.com/kubernetes/kubernetes/pull/41648.

**Release note**:

```
A single value in metadata.annotations/metadata.labels can be passed into the containers via Downward API
```

/assign @thockin @vishh
2017-11-22 18:54:29 -08:00
Yang Guo 34a7b3dea8 Create a separate conversion function for the field labels used by downward API 2017-11-22 11:02:20 -08:00
mtanino 8903e8cd85 BlockVolumesSupport: CRI, VolumeManager and OperationExecutor changes
This patch contains following changes.
- container runtime changes for adding block devices
- volumemanager changes
- operationexecutor changes
2017-11-20 14:10:26 -05:00
Kubernetes Submit Queue 01c74145c7
Merge pull request #55665 from brendandburns/path
Automatic merge from submit-queue (batch tested with PRs 55908, 55829, 55293, 55653, 55665). 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>.

If mountPath is missing, prefix with root dir.

If `mountPath` is not absolute, add the os-specific root directory as a prefix.

Ref: https://github.com/kubernetes/kubernetes/pull/51240
https://groups.google.com/forum/#!topic/kubernetes-sig-storage/k_0Wr2kYkpU

@thockin @saad-ali @andyzhangx 

Note to @thockin I left the validation in place, in seems like it is a net win, since it will give a decent
error message to most people, but the fall-back defaulting is there if it doesn't catch 'c:'

I'm happy to rip out the validation if that is preferable to everyone.  Let me know.

```release-note
If a non-absolute mountPath is passed to the kubelet, prefix it with the appropriate root path.
```
2017-11-17 17:11:16 -08:00
Brendan Burns 1b7f028ecb If mountPath is missing, prefix with root dir. 2017-11-16 05:30:53 +00:00
Zihong Zheng 0bc2e1f62f Move DNS related kubelet codes into its own package 2017-11-15 10:56:44 -08:00
Dr. Stefan Schimanski 012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Zihong Zheng c1a959c660 Clean up redundant DNS related kubelet codes
Signed-off-by: Zihong Zheng <zihongz@google.com>
2017-11-04 12:33:32 -07:00
Kubernetes Submit Queue 2084f7f4f3
Merge pull request #54488 from lichuqiang/plugin_base
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>.

Add admission handler for device resources allocation

**What this PR does / why we need it**:
Add admission handler for device resources allocation to fail fast during pod creation

**Which issue this PR fixes** 
fixes #51592

**Special notes for your reviewer**:
@jiayingz Sorry, there is something wrong with my branch in #51895. And I think the existing comments in the PR might be too long for others to view. So I closed it and opened the new one, as we have basically reach an agreement on the implement :)
I have covered the functionality and unit test part here, and would set about the e2e part ASAP

/cc @jiayingz @vishh @RenaudWasTaken 

**Release note**:

```release-note
NONE
```
2017-11-02 17:24:06 -07:00
lichuqiang ebd445eb8c add admission handler for device resources allocation 2017-11-02 09:17:48 +08:00
Kevin 4c8539cece use core client with explicit version globally 2017-10-27 15:48:32 +08:00
David Ashpole 42a2a2fafe fix #54499. Removed containers are not waiting 2017-10-25 16:33:00 -07:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Michael Taufen 8180536bed Mulligan: Remove deprecated and experimental fields from KubeletConfiguration
Revert "Merge pull request #51857 from kubernetes/revert-51307-kc-type-refactor"

This reverts commit 9d27d92420, reversing
changes made to 2e69d4e625.

See original: #51307

We punted this from 1.8 so it could go through an API review. The point
of this PR is that we are trying to stabilize the kubeletconfig API so
that we can move it out of alpha, and unblock features like Dynamic
Kubelet Config, Kubelet loading its initial config from a file instead
of flags, kubeadm and other install tools having a versioned API to rely
on, etc.

We shouldn't rev the version without both removing all the deprecated
junk from the KubeletConfiguration struct, and without (at least
temporarily) removing all of the fields that have "Experimental" in
their names. It wouldn't make sense to lock in to deprecated fields.
"Experimental" fields can be audited on a 1-by-1 basis after this PR,
and if found to be stable (or sufficiently alpha-gated), can be restored
to the KubeletConfiguration without the "Experimental" prefix.
2017-10-11 09:52:39 -07:00
Michelle Au 266120c189 Don't skip mounts if we can't find the volume 2017-10-09 14:00:23 -07:00
David Ashpole 4300c75d48 fix #52462. Do not GC exited containers in running pods 2017-09-28 09:37:21 -07:00
Kubernetes Submit Queue ae6b329368 Merge pull request #51644 from sjenning/init-container-status-fix
Automatic merge from submit-queue (batch tested with PRs 51239, 51644, 52076)

do not update init containers status if terminated

fixes #29972 #41580

This fixes an issue where, if a completed init container is removed while the pod or subsequent init containers are still running, the status for that init container will be reset to `Waiting` with `PodInitializing`.  

This can manifest in a number of ways.

If the init container is removed why the main pod containers are running, the status will be reset with no functional problem but the status will be reported incorrectly in `kubectl get pod` for example

If the init container is removed why a subsequent init container is running, the init container will be **re-executed** leading to all manner of badness.

@derekwaynecarr @bparees
2017-09-07 14:31:23 -07:00
David Ashpole 9ac30e2c28 wait for container cleanup before deletion 2017-09-04 17:38:09 -07:00
Kubernetes Submit Queue 11a836078d Merge pull request #46444 from jsafrane/node-mount-propagation
Automatic merge from submit-queue (batch tested with PRs 45724, 48051, 46444, 51056, 51605)

Mount propagation in kubelet

Together with #45724 it implements mount propagation as proposed in https://github.com/kubernetes/community/pull/659

There is:

- New alpha annotation that allows user to explicitly set propagation mode for each `VolumeMount` in pod containers (to be replaced with real `VolumeMount.Propagation` field during beta) + validation + tests. "Private" is the default one (= no change to existing pods).

  I know about proposal for real API fields for alpha feature in https://docs.google.com/document/d/1wuoSqHkeT51mQQ7dIFhUKrdi3-1wbKrNWeIL4cKb9zU/edit, but it seems it's not implemented yet. It would save me quite lot of code and ugly annotation.

- Updated CRI API to transport chosen propagation to Docker.

- New `kubelet --experimental-mount-propagation` option to enable the previous bullet without modifying types.go (worked around with changing `KubeletDeps`... not nice, but it's better than adding a parameter to `NewMainKubelet` and removing it in the next release...)

```release-note
kubelet has alpha support for mount propagation. It is disabled by default and it is there for testing only. This feature may be redesigned or even removed in a future release.
```

@derekwaynecarr @dchen1107 @kubernetes/sig-node-pr-reviews
2017-09-02 12:11:07 -07:00
Jan Safranek 03b753daad Implement mount propagation in kubelet 2017-09-01 21:36:33 +02:00
Jiaying Zhang 02001af752 Kubelet side extension to support device allocation 2017-09-01 11:56:35 -07:00
Seth Jennings 3b80b9d518 do not update init containers status if terminated 2017-08-30 13:55:17 -04:00
Kubernetes Submit Queue 9537241702 Merge pull request #47115 from zhangxiaoyu-zidif/add-check-err-for-kubelet
Automatic merge from submit-queue (batch tested with PRs 47115, 51196, 51204, 51208, 51206)

Delete redundant err definition

**What this PR does / why we need it**:
Delete reduandant err definition
Line 307 has err definition and initialization.


**Release note**:

```release-note
NONE
```
2017-08-24 07:20:03 -07:00
Kubernetes Submit Queue ef1b835220 Merge pull request #50646 from rickypai/rpai/hostalias_hostnetwork
Automatic merge from submit-queue

Support HostAlias for HostNetwork Pods

**What this PR does / why we need it**: Currently, HostAlias does not support HostNetwork pods because historically, kubelet only manages hosts file for non-HostNetwork pods. With the recent change in https://github.com/kubernetes/kubernetes/pull/49140, kubelet now manages hosts file for all Pods, which enables HostAlias support also.

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

**Special notes for your reviewer**: might be easier to review commit-by-commit

**Release note**:

```release-note
HostAlias is now supported for both non-HostNetwork Pods and HostNetwork Pods.
```

@yujuhong @hongchaodeng @thockin
2017-08-23 22:06:27 -07:00
Kubernetes Submit Queue 6b0d475422 Merge pull request #48699 from blackwoodseven/36031
Automatic merge from submit-queue

Typed static/mirror pod UID translation

Fixes #36031 , partially.

TODO:
- [x] Add types ResolvedPodUID and MirrorPodUID.
- [x] Use the ResolvedPodUID type with minimal changes.
- [x] Use the MirrorPodUID type with minimal changes.
- [x] Clarify whether the new types should be used anywhere else; if so make the agreed upon changes.

```NONE
```
2017-08-14 17:35:08 -07:00
Ricky Pai 4edd92f26d add HostAlias support for HostNetwork pods 2017-08-14 15:28:03 -07:00
Ricky Pai ceb33bde29 refactor entries added by hostAlias into a separate method and be explicit about the source 2017-08-14 14:37:27 -07:00
Ebbe Elsborg a286f25ff4 Typed static/mirror pod UID translation 2017-08-14 14:51:26 +02:00
Ricky Pai fb4bff01c5 Kubelet manage hosts file for HostNetwork Pods instead of Docker 2017-08-10 11:40:57 -07:00
Kubernetes Submit Queue 243e655161 Merge pull request #48986 from timoreimann/relax-env-var-naming-restrictions
Automatic merge from submit-queue (batch tested with PRs 50208, 50259, 49702, 50267, 48986)

Relax restrictions on environment variable names.

Fixes #2707

The POSIX standard restricts environment variable names to uppercase letters, digits, and the underscore character in shell contexts only. For generic application usage, it is stated that all other characters shall be tolerated. (Reference [here](http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html), my prose reasoning [here](https://github.com/kubernetes/kubernetes/issues/2707#issuecomment-285309156).)

This change relaxes the rules to some degree. Namely, we stop requiring environment variable names to be strict `C_IDENTIFIERS` and start permitting lowercase, dot, and dash characters.

Public container images using environment variable names beyond the shell-only context can benefit from this relaxation. Elasticsearch is one popular example.
2017-08-08 01:53:08 -07:00
Timo Reimann 604dfb3197 Relax restrictions on environment variable names.
The POSIX standard restricts environment variable names to uppercase
letters, digits, and the underscore character in shell contexts only.
For generic application usage, it is stated that all other characters
shall be tolerated.

This change relaxes the rules to some degree. Namely, we stop requiring
environment variable names to be strict C_IDENTIFIERS and start
permitting lowercase, dot, and dash characters.

Public container images using environment variable names beyond the
shell-only context can benefit from this relaxation. Elasticsearch is
one popular example.
2017-07-28 22:11:26 +02:00
Michael Taufen 38aee0464d Providing kubeconfig file is now the switch for standalone mode
Replaces use of --api-servers with --kubeconfig in Kubelet args across
the turnup scripts. In many cases this involves generating a kubeconfig
file for the Kubelet and placing it in the correct location on the node.
2017-07-24 11:03:00 -07:00
Kubernetes Submit Queue c0287ce420 Merge pull request #47316 from k82cn/k8s_47315
Automatic merge from submit-queue (batch tested with PRs 48981, 47316, 49180)

Added golint check for pkg/kubelet.

**What this PR does / why we need it**:
Added golint check for pkg/kubelet, and make golint happy.

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

**Release note**:
```release-note-none
```
2017-07-19 11:21:25 -07:00
Klaus Ma 63b78a37e0 Added golint check for pkg/kubelet. 2017-07-19 11:33:06 +08:00
xiangpengzhao 01daf707c5 Refactor: pkg/util into sub-pkgs 2017-07-18 14:34:08 +08:00
Slava Semushin ae147a737c Fix comments and typo in the error message. 2017-07-14 19:17:12 +02:00
Kubernetes Submit Queue 009858f18d Merge pull request #48555 from redbaron/hostPath-and-subPath-symlink
Automatic merge from submit-queue

Fix subPath existence check to not follow symlink

**What this PR does / why we need it**:
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script

**Release note**:
```release-note
Fix pods failing to start when subPath is a dangling symlink from kubelet point of view, which can happen if it is running inside a container
```
2017-07-12 23:43:12 -07:00
Kubernetes Submit Queue 0e461035cb Merge pull request #48734 from tallclair/namechange
Automatic merge from submit-queue (batch tested with PRs 48698, 48712, 48516, 48734, 48735)

Name change: s/timstclair/tallclair/

I changed my name, and I'm migrating my user name to be consistent.
2017-07-12 04:56:32 -07:00
Kubernetes Submit Queue d68e7378f4 Merge pull request #48322 from k82cn/k8s_47867
Automatic merge from submit-queue (batch tested with PRs 48402, 47203, 47460, 48335, 48322)

Added case on 'terminated-but-not-yet-deleted' for Admit.

**What this PR does / why we need it**:
Added case on 'terminated-but-not-yet-deleted' for Admit.

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

**Release note**:

```release-note-none
```
2017-07-11 21:01:39 -07:00
Tim Allclair a2f2e1d491 Name change: s/timstclair/tallclair/ 2017-07-10 14:05:46 -07:00
Maxim Ivanov 020ec43b56 Fix subPath existence check to not follow symlink
Volume mounting logic introduced in #43775 and #45623 checks
for subPath existence before attempting to create a directory,
should subPath not be present.

This breaks if subPath is a dangling symlink, os.Stat returns
"do not exist" status, yet `os.MkdirAll` can't create directory
as symlink is present at the given path.

This patch makes existence check to use os.Lstat which works for
normal files/directories as well as doesn't not attempt to follow
symlink, therefore it's "do not exist" status is more reliable when
making a decision whether to create directory or not.

subPath symlinks can be dangling in situations where kubelet is
running in a container itself with access to docker socket, such
as CoreOS's kubelet-wrapper script
2017-07-07 11:52:16 +01:00
Klaus Ma ddfa04eaac Added case on 'terminated-but-not-yet-deleted' for Admit. 2017-07-01 15:51:03 +08:00
Dan Williams 5b8ad3f7c5 kubelet: remove unused bandwidth shaping teardown code
Since v1.5 and the removal of --configure-cbr0:

0800df74ab "Remove the legacy networking mode --configure-cbr0"

kubelet hasn't done any shaping operations internally.  They
have all been delegated to network plugins like kubenet or
external CNI plugins.  But some shaping code was still left
in kubelet, so remove it now that it's unused.
2017-06-30 11:51:22 -05:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Josh Horwitz 48b3fb84ab do not allow backsteps in host volume plugin
Fixes #47107
2017-06-16 16:48:24 -04:00
zhangxiaoyu-zidif 3d891f960c Delete reduandant err definition 2017-06-07 16:53:59 +08:00
Shyam Jeedigunta 4425864707 Migrate kubelet configmap management logic to an interface 2017-05-31 10:39:36 +02:00