Commit Graph

219 Commits (6d7a9048b67d81e57923892650a23636f1afba42)

Author SHA1 Message Date
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
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
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
Klaus Ma 83b7f77ee2 Moved qos to api.helpers. 2017-05-20 07:17:57 -04:00
David Ashpole 21fb487245 wait for previous evicted pod to be cleaned up 2017-05-16 14:23:42 -07: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
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
Yu-Ju Hong fccf34ccb6 Remove various references of dockertools
Also update the bazel files.
2017-05-11 10:01:41 -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
supereagle b186e367e1 remove useless code in kubelet 2017-05-04 13:53:48 +08:00
Kubernetes Submit Queue c1ebba0ae2 Merge pull request #38925 from xiangpengzhao/fix-volume-panic
Automatic merge from submit-queue

Fix nil pointer issue when making mounts for container

When rebooting one of the nodes in my colleague's cluster, two panics were discovered:

```
E1216 04:07:00.193058    2394 runtime.go:52] Recovered from panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:58
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:51
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:41
/usr/local/go/src/runtime/asm_amd64.s:472
/usr/local/go/src/runtime/panic.go:443
/usr/local/go/src/runtime/panic.go:62
/usr/local/go/src/runtime/sigpanic_unix.go:24
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:1313
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:1473
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/dockertools/docker_manager.go:1495
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/dockertools/docker_manager.go:2125
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/dockertools/docker_manager.go:2093
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:1971
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go:530
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/pod_workers.go:171
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/pod_workers.go:154
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/pod_workers.go:215
/usr/local/go/src/runtime/asm_amd64.s:1998
E1216 04:07:00.275030    2394 runtime.go:52] Recovered from panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:58
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:51
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/runtime/runtime.go:41
/usr/local/go/src/runtime/asm_amd64.s:472
/usr/local/go/src/runtime/panic.go:443
/usr/local/go/src/runtime/panic.go:62
/usr/local/go/src/runtime/sigpanic_unix.go:24
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/server/stats/volume_stat_caculator.go:98
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubelet/server/stats/volume_stat_caculator.go:63
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:86
/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/util/wait/wait.go:87
/usr/local/go/src/runtime/asm_amd64.s:1998
```

kubectl version
```
Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.8", GitCommit:"693ef591120267007be359f97191a6253e0e4fb5", GitTreeState:"clean", BuildDate:"2016-09-28T03:03:21Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.8", GitCommit:"693ef591120267007be359f97191a6253e0e4fb5", GitTreeState:"clean", BuildDate:"2016-09-28T02:52:25Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"linux/amd64"}
```

The second panic had already been fixed by #33616 and #34251. Not sure what caused the first nil pointer issue and whether it has been fixed yet in the master branch. Just fix it by ignoring the nil pointer when making mounts.

cc @jingxu97 @yujuhong
2017-05-01 10:01:16 -07:00
Ricky Pai 407fe8b356 write HostAliases to hosts file 2017-04-29 11:31:24 -07:00
xiangpengzhao db97cba291 Fix nil pointer issue when making mounts for container 2017-04-28 11:41:39 +08:00
Ricky Pai e21da839e5 extract content-generation concern from `ensureHostsFile`
add tests to assert the output of `ensureHostsFile`
2017-04-24 12:33:45 -07:00
Chao Xu 4f9591b1de move pkg/api/v1/ref.go and pkg/api/v1/resource.go to subpackages. move some functions in resource.go to pkg/api/v1/node and pkg/api/v1/pod 2017-04-17 11:38:11 -07:00
Chao Xu d4850b6c2b move pkg/api/v1/helpers.go to subpackage 2017-04-14 14:25:11 -07:00
Kubernetes Submit Queue 4653a9b280 Merge pull request #41543 from dshulyak/decouple_remotecommand
Automatic merge from submit-queue (batch tested with PRs 44406, 41543, 44071, 44374, 44299)

Decouple remotecommand

Refactored unversioned/remotecommand to decouple it from undesirable dependencies:

- term package now is not required, and functionality required to resize terminal size can be plugged in directly in kubectl
- in order to remove dependency on kubelet package - constants from kubelet/server/remotecommand were moved to separate util package (pkg/util/remotecommand)
- remotecommand_test.go moved to pkg/client/tests module
2017-04-13 19:52:05 -07:00
Dmitry Shulyak f50480c714 Decouple remotecommand client from term/kubelet dependencies
In order to move client/unversioned/remotecommand to client-go as a followup
for this change we have to decouple it from tons of dependencies
2017-04-13 15:56:40 +03:00
Klaus Ma c2b629ee2a Removed hostname/subdomain annotation. 2017-04-10 13:55:40 +08:00
Kubernetes Submit Queue c8f90171e4 Merge pull request #39678 from resouer/extract-resource
Automatic merge from submit-queue (batch tested with PRs 41775, 39678, 42629, 42524, 43028)

Extract resources functions belongs to api/util

Address: extract kubelet resources functions belongs to `pkg/api/v1/resource_helpers.go`
2017-04-07 17:44:14 -07:00
Kubernetes Submit Queue e28cb42706 Merge pull request #42717 from andrewsykim/support-host-ip-downward-api
Automatic merge from submit-queue

Support status.hostIP in downward API

**What this PR does / why we need it**:
Exposes pod's hostIP (node IP) via downward API. 

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

**Special notes for your reviewer**:
Not sure if there's more documentation that's needed, please point me in the right direction and I will add some :)
2017-04-03 15:48:12 -07:00
Harry Zhang efb10b1821 Move extract resources to its pkg
Move ExtractContainerResourceValue
2017-04-03 13:06:48 +08:00
andrewsykim a62653456b use kl.getHostIPAnyWay() to get host ip even if node is not registered 2017-03-30 21:57:08 -04:00
Matthew Wong 25bdad762b Create subPaths and set their permissions like we do mountPaths 2017-03-30 01:52:08 -04:00
andrewsykim 4f6c1b5ad5 call GetHostIP from makeEnvironment 2017-03-28 20:20:21 -04:00
andrewsykim c001deed43 fetch hostIP at runtime since status manager didn't update it yet 2017-03-28 20:20:20 -04:00
andrewsykim 91c027d6cc support hostIP in downward API 2017-03-28 20:20:19 -04:00
NickrenREN 2f89a6bda6 optimize getPullSecretsForPod() and syncPod()
Since getPullSecretsForPod() will never return err,we do not need the second return value,and modify syncPod() function.
2017-03-25 11:05:13 +08:00
Vishnu kannan ff158090b3 use active pods instead of runtime pods in gpu manager
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-03-13 10:58:26 -07:00
Michael Fraenkel c4d07466e8 Invalid environment var names are reported and pod starts
When processing EnvFrom items, all invalid keys are collected and
reported as a single event.

The Pod is allowed to start.
2017-03-09 07:21:53 +00:00
Derek Carr 5ce298c9aa provide active pods to cgroup cleanup 2017-03-06 17:37:26 -05:00
Seth Jennings ccd87fca3f kubelet: add cgroup manager metrics 2017-03-06 08:53:47 -06:00
Kubernetes Submit Queue fa0387c9fe Merge pull request #42195 from Random-Liu/cri-support-non-json-logging
Automatic merge from submit-queue (batch tested with PRs 41931, 39821, 41841, 42197, 42195)

Use `docker logs` directly if the docker logging driver is not `json-file`

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

Post the PR first, I still need to manually test this, because we don't have test coverage for journald logging pluggin.

@yujuhong @dchen1107 
/cc @kubernetes/sig-node-pr-reviews
2017-03-01 20:08:08 -08:00
Kubernetes Submit Queue ddd8b5c1cf Merge pull request #41644 from derekwaynecarr/ensure-pod-cgroup-deleted
Automatic merge from submit-queue (batch tested with PRs 41644, 42020, 41753, 42206, 42212)

Ensure pod cgroup is deleted prior to deletion of pod

**What this PR does / why we need it**:
This PR ensures that the kubelet removes the pod cgroup sandbox prior to deletion of a pod from the apiserver.   We need this to ensure that the default behavior in the kubelet is to not leak resources.
2017-03-01 15:30:30 -08:00
Derek Carr 21a899cf85 Ensure pod cgroup is deleted prior to deletion of pod 2017-03-01 15:29:36 -05:00
Random-Liu 7c261bfed7 Use `docker logs` directly if the docker logging driver is not
supported.
2017-03-01 10:50:11 -08:00
vefimova fc8a37ec86 Added ability for Docker containers to set usage of dns settings along with hostNetwork is true
Introduced chages:
   1. Re-writing of the resolv.conf file generated by docker.
      Cluster dns settings aren't passed anymore to docker api in all cases, not only for pods with host network:
      the resolver conf will be overwritten after infra-container creation to override docker's behaviour.

   2. Added new one dnsPolicy - 'ClusterFirstWithHostNet', so now there are:
      - ClusterFirstWithHostNet - use dns settings in all cases, i.e. with hostNet=true as well
      - ClusterFirst - use dns settings unless hostNetwork is true
      - Default

Fixes #17406
2017-03-01 17:10:00 +00:00
Kubernetes Submit Queue ed479163fa Merge pull request #42116 from vishh/gpu-experimental-support
Automatic merge from submit-queue

Extend experimental support to multiple Nvidia GPUs

Extended from #28216

```release-note
`--experimental-nvidia-gpus` flag is **replaced** by `Accelerators` alpha feature gate along with  support for multiple Nvidia GPUs. 
To use GPUs, pass `Accelerators=true` as part of `--feature-gates` flag.
Works only with Docker runtime.
```

1. Automated testing for this PR is not possible since creation of clusters with GPUs isn't supported yet in GCP.
1. To test this PR locally, use the node e2e.
```shell
TEST_ARGS='--feature-gates=DynamicKubeletConfig=true' FOCUS=GPU SKIP="" make test-e2e-node
```

TODO:

- [x] Run manual tests
- [x] Add node e2e
- [x] Add unit tests for GPU manager (< 100% coverage)
- [ ] Add unit tests in kubelet package
2017-03-01 04:52:50 -08:00
Vishnu kannan 2554b95994 Map nvidia devices one to one.
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-02-28 13:42:08 -08:00
Vishnu kannan 3b0a408e3b improve gpu integration
Signed-off-by: Vishnu kannan <vishnuk@google.com>
2017-02-28 11:27:53 -08:00
Hui-Zhi 57c77ffbdd Add support for multiple nvidia gpus 2017-02-28 11:24:48 -08:00
Seth Jennings b9adb66426 kubelet: cm: refactor QoS logic into seperate interface 2017-02-28 09:19:29 -06:00
Derek Carr a7684569fb Fix get all pods from cgroups logic 2017-02-27 21:24:45 -08:00
Random-Liu 8380148d48 Remove extra operations when generating pod sandbox configuration. 2017-02-24 15:06:03 -08:00
Kubernetes Submit Queue 7236af6162 Merge pull request #39373 from apprenda/fix_configmap
Automatic merge from submit-queue (batch tested with PRs 39373, 41585, 41617, 41707, 39958)

Fix ConfigMaps for Windows

**What this PR does / why we need it**: ConfigMaps were broken for Windows as the existing code used linux specific file paths. Updated the code in `kubelet_getters.go` to use `path/filepath` to get the directories. Also reverted back the code in `secret.go` as updating `kubelet_getters.go` to use `path/filepath` also fixes `secrets`

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

```release-note
Fix ConfigMap for Windows Containers.
```

cc: @pires
2017-02-19 13:50:37 -08:00
Kubernetes Submit Queue 6376ad134d Merge pull request #39606 from NickrenREN/kubelet-pod
Automatic merge from submit-queue (batch tested with PRs 38101, 41431, 39606, 41569, 41509)

optimize killPod() and syncPod() functions

make sure that one of the two arguments must be non-nil: runningPod, status ,just like the function note says
and judge the return value in syncPod() function before setting podKilled
2017-02-16 15:49:17 -08:00
NickrenREN b40e575076 optimize killPod() and syncPod() functions
make sure that one of the two arguments must be non-nil: runningPod, status ,just like the function note says
and judge the return value in syncPod() function before setting podKilled
2017-02-16 09:13:23 +08:00
David Ashpole 1d38818326 Revert "Merge pull request #41202 from dashpole/revert-41095-deletion_pod_lifecycle"
This reverts commit ff87d13b2c, reversing
changes made to 46becf2c81.
2017-02-15 08:44:03 -08:00
Kubernetes Submit Queue dd696683b7 Merge pull request #40647 from NickrenREN/secretManager
Automatic merge from submit-queue (batch tested with PRs 41360, 41423, 41430, 40647, 41352)

optimize NewSimpleSecretManager and cleanupOrphanedPodCgroups
2017-02-15 05:06:11 -08:00
Kubernetes Submit Queue 3a6fa67f59 Merge pull request #39179 from NickrenREN/killpod
Automatic merge from submit-queue (batch tested with PRs 41196, 41252, 41300, 39179, 41449)

record ReduceCPULimits result err info if err returned

record ReduceCPULimits result err info if err returned for debug
2017-02-15 04:14:15 -08:00
Yu-Ju Hong 9fa1ad29fd kubelet: handle containers in the "created" state 2017-02-14 07:51:35 -08:00
NickrenREN 31bfefca3c optimize NewSimpleSecretManager and cleanupOrphanedPodCgroups
remove NewSimpleSecretManager second return value and cleanupOrphanedPodCgroups's return since they will never return err
2017-02-14 09:47:05 +08:00
David Ashpole b224f83c37 Revert "[Kubelet] Delay deletion of pod from the API server until volumes are deleted" 2017-02-09 08:45:18 -08:00
David Ashpole 67cb2704c5 delete volumes before pod deletion 2017-02-08 07:34:49 -08:00
NickrenREN a62da3e22b record ReduceCPULimits result err info if possible
record ReduceCPULimits result err info if possible
2017-02-04 21:12:39 +08:00
Michael Fraenkel 93c11422e4 CRI Portforward needs to forward websocket ports
- adjust ports to int32
- CRI flows the websocket ports as query params

- Do not validate ports since the protocol is unknown
  SPDY flows the ports as headers and websockets uses query params
- Only flow query params if there is at least one port query param
2017-02-01 18:03:42 -07:00
Aleksandra Malinowska 74e1d8078e Revert "Delay deletion of pod from the API server until volumes are deleted" 2017-01-27 13:31:02 +01:00
Kubernetes Submit Queue 7857b9acdf Merge pull request #40239 from dashpole/disk_pod_lifecycle
Automatic merge from submit-queue

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

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

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

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

cc: @vishh @sjenning @derekwaynecarr
2017-01-26 13:46:02 -08:00
David Ashpole 9094b57570 cleanup volumes before deleting from the api server 2017-01-25 10:21:15 -08:00
Jitendra Bhurat 0cbf75c400
kubelet: Fix ConfigMap on Windows. 2017-01-24 18:40:49 +00:00
Michael Fraenkel 7ddad11058 Use SecretManager when getting secrets for EnvFrom 2017-01-24 05:05:48 -07:00
Michael Fraenkel 4e466040d9 Allow Optional ConfigMap and Secrets
- ConfigMaps and Secrets for Env or Volumes are allowed to be optional
2017-01-23 18:59:49 -07:00
Kubernetes Submit Queue 2d4d2f913f Merge pull request #39446 from fraenkel/env_secrets
Automatic merge from submit-queue (batch tested with PRs 39446, 40023, 36853)

Create environment variables from secrets

Allow environment variables to be populated from entire secrets.

**Release note**:
```release-note
Populate environment variables from a secrets.
```
2017-01-19 18:53:45 -08:00
Wojciech Tyczynski 85ee9e570b Create SecretManager interface 2017-01-19 19:47:32 +01:00
Michael Fraenkel 13d693d220 Secrets can populate environment variables 2017-01-19 13:46:05 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Seth Jennings e2402b781b set qos class field in pod status 2017-01-10 16:31:52 -06:00
Michael Fraenkel fb3a1d6851 Avoid panic when stopping the podKiller
use a mutex instead of a channel
2017-01-05 14:52:24 -05:00
Michael Fraenkel f6c9ab4312 Check if key is a valid after prefix is prepended
- Allow invalid keys to become valid by requiring a prefix
2017-01-04 17:26:44 -05:00
Michael Fraenkel 2d803afc98 ConfigMaps populate environment variables 2017-01-03 11:02:15 -05:00
Kubernetes Submit Queue 1d3c7ca758 Merge pull request #38348 from euank/doc-our-privilege
Automatic merge from submit-queue (batch tested with PRs 38727, 38726, 38347, 38348)

Add 'privileged' to sandbox to indicate if any container might be privileged in it, document privileged

Right now, the privileged flag is this magic thing which does "whatever Docker does". This documents it to make it a little less magic.

In addition, due to how rkt uses `systemd-nspawn` as an outer layer of isolation in creating the sandbox, it's helpful to know beforehand whether the pod will be privileged so additional security options can be applied earlier / applied at all.

I suspect the same indication will be useful for userns since userns should also occur at the pod layer, but it's possible that will be a separate/additional field.


cc @lucab @jonboulle @yujuhong @feiskyer @kubernetes/sig-node 


```release-note
NONE
```
2016-12-13 17:31:53 -08:00
Kubernetes Submit Queue 63cf217b92 Merge pull request #38347 from euank/remove-extra-hn-check
Automatic merge from submit-queue (batch tested with PRs 38727, 38726, 38347, 38348)

kubelet: remove redundant hostNetwork helper

Trivial cleanup.
2016-12-13 17:31:51 -08:00
Wojciech Tyczynski e8d1cba875 GetOptions in client calls 2016-12-09 09:42:01 +01:00
Euan Kemp bcd939cb08 kuberuntime: set privileged for sandboxes 2016-12-08 13:11:16 -08:00
Euan Kemp 15fc470343 kubelet: remove redundant hostNetwork helper
It did the same thing as the helper in kubecontainer
2016-12-07 17:24:24 -08:00
Pengfei Ni 1140d31d9b Kubelet: only check podUID when it is actually set 2016-12-07 16:35:25 +08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Tim St. Clair cc801e97e8
[CRI] Manage attach TTY in Kubelet 2016-12-01 18:27:55 -08:00
Chao Xu 5e1adf91df cmd/kubelet 2016-11-23 15:53:09 -08:00
Random-Liu e9f1b0f972 Fix hostname truncate. 2016-11-16 18:09:31 -08:00
pweil- d0d78f478c experimental host user ns defaulting 2016-11-14 10:16:03 -05:00
Rodolfo Carvalho 506129ba4e Add timeout argument to ExecInContainer
This allows us to interrupt/kill the executed command if it exceeds the
timeout (not implemented by this commit).

Set timeout in Exec probes. HTTPGet and TCPSocket probes respect the
timeout, while Exec probes used to ignore it.

Add e2e test for exec probe with timeout. However, the test is skipped
while the default exec handler doesn't support timeouts.
2016-11-07 13:00:59 +01:00
Kubernetes Submit Queue 486a1ad3e4 Merge pull request #31707 from apprenda/windows_infra_container
Automatic merge from submit-queue

Initial work on running windows containers on Kubernetes

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

This is the first stab at getting the Kubelet running on Windows (fixes #30279), and getting it to deploy network-accessible pods that consist of Windows containers. Thanks @csrwng, @jbhurat for helping out.

The main challenge with Windows containers at this point is that container networking is not supported. In other words, each container in the pod will get it's own IP address. For this reason, we had to make a couple of changes to the kubelet when it comes to setting the pod's IP in the Pod Status. Instead of using the infra-container's IP, we use the IP address of the first container.

Other approaches we investigated involved "disabling" the infra container, either conditionally on `runtime.GOOS` or having a separate windows-docker container runtime that re-implemented some of the methods (would require some refactoring to avoid maintainability nightmare). 

Other changes:
- The default docker endpoint was removed. This results in the docker client using the default for the specific underlying OS.

More detailed documentation on how to setup the Windows kubelet can be found at https://docs.google.com/document/d/1IjwqpwuRdwcuWXuPSxP-uIz0eoJNfAJ9MWwfY20uH3Q. 

cc: @ikester @brendandburns @jstarks
2016-11-06 01:30:11 -07:00
Kubernetes Submit Queue f787cea237 Merge pull request #36020 from timstclair/klet-stream
Automatic merge from submit-queue

Separate Direct and Indirect streaming paths, implement indirect path for CRI

This PR refactors the `pkg/kubelet/container.Runtime` interface to remove the `ExecInContainer`, `PortForward` and `AttachContainer` methods. Instead, those methods are part of the `DirectStreamingRuntime` interface which all "legacy" runtimes implement. I also added an `IndirectStreamingRuntime` which handles the redirect path and is implemented by CRI runtimes. To control the size of this PR, I did not fully setup the indirect streaming path for the dockershim, so I left legacy path behind.

Most of this PR is moving & renaming associated with the refactoring. To understand the functional changes, I suggest tracing the code from `getExec` in `pkg/kubelet/server/server.go`, which calls `GetExec` in `pkg/kubelet/kubelet_pods.go` to determine whether to follow the direct or indirect path.

For https://github.com/kubernetes/kubernetes/issues/29579

/cc @kubernetes/sig-node
2016-11-04 11:52:06 -07:00
Kubernetes Submit Queue c4ff44b66d Merge pull request #35597 from feiskyer/gpu
Automatic merge from submit-queue

CRI: Add devices to ContainerConfig

This PR adds devices to ContainerConfig and adds experimental GPU support.

cc/ @yujuhong @Hui-Zhi @vishh @kubernetes/sig-node
2016-11-04 02:30:52 -07:00
Tim St. Clair 86d849e374
Separate Direct and Indirect streaming paths, implement indirect path with CRI 2016-11-03 13:26:33 -07:00
derekwaynecarr 42289c2758 pod and qos level cgroup support 2016-11-02 08:07:04 -04:00
Pengfei Ni e0f89a322b CRI: Add devices implementation and moves GPU to devices 2016-11-02 15:24:45 +08:00
Kubernetes Submit Queue 479ff417b8 Merge pull request #35348 from Random-Liu/kuberuntime-container-logs
Automatic merge from submit-queue

CRI: Add kuberuntime container logs

Based on https://github.com/kubernetes/kubernetes/pull/34858.

The first 2 commits are from #34858. And the last 2 commits are new.

This PR added kuberuntime container logs support and add unit test for it.

I've tested all the functions manually, and I'll send another PR to write a node e2e test for container log.

**_Notice: current implementation doesn't support log rotation**_, which means that:
- It will not retrieve logs in rotated log file.
- If log rotation happens when following the log:
  - If the rotation is using create mode, we'll still follow the old file.
  - If the rotation is using copytruncate, we'll be reading at the original position and get nothing.

To solve these issues, kubelet needs to rotate the log itself, or at least kubelet should be able to control the the behavior of log rotator. These are doable but out of the scope of 1.5 and will be addressed in future release.

@yujuhong @feiskyer @yifan-gu 
/cc @kubernetes/sig-node
2016-11-01 20:47:20 -07:00
Jitendra Bhurat 66a1ef25e0
Fixing Volumes on Windows 2016-11-01 15:48:37 -04:00
Alexander Brand 244152544c
Changes to kubelet to support win containers 2016-10-31 14:20:49 -04:00
Random-Liu 8e376dc843 Add kuberuntime container logs support. 2016-10-26 17:37:09 -07:00
Paul Morie a2d3da52be Remove volume SELinux relabeling when pod uses host IPC or PID ns 2016-10-26 10:39:46 -04:00
Paul Morie ca9a455f2c Mark container hosts file for SELinux relabel 2016-10-26 09:38:03 -04:00
Paul Morie b1f91bd510 Move Kubelet pod-management code into kubelet_pods.go 2016-09-26 17:16:59 -04:00