Commit Graph

222 Commits (06bc7e3e0026ea25065f59f4bd305c0b7dbbc145)

Author SHA1 Message Date
Daniel Mueller 9050c510e6 Remove unused variables from computePodPhase
The initialized and failed variables in the computePodPhase function are
effectively write only. Remove them.
2019-04-08 09:09:09 -07:00
Davanum Srinivas 33081c1f07
New staging repository for cri-api
Change-Id: I2160b0b0ec4b9870a2d4452b428e395bbe12afbb
2019-03-26 18:21:04 -04:00
Wei Huang c5a96b63f4
Revert "kubelet: return mirror pod in GetActivePods()"
This reverts commit c0c93f4a52.
2019-03-07 11:22:27 -08:00
Kubernetes Prow Robot 98fa2c7d32
Merge pull request #74222 from Huang-Wei/kubelet-mirrorpod
kubelet: return mirror pod in GetActivePods()
2019-03-05 13:22:02 -08:00
Kubernetes Prow Robot 0a4308f641
Merge pull request #74529 from liggitt/kubelet-service-links-error
Kubelet service links error
2019-03-05 09:49:59 -08:00
Travis Rhoden 2c4d748bed Refactor subpath out of pkg/util/mount
This patch moves subpath functionality out of pkg/util/mount and into a
new package pkg/volume/util/subpath. NSEnter funtionality is maintained.
2019-02-26 19:59:53 -07:00
Jordan Liggitt 4ac08be206 prevent panic on nil pod.spec.enableServiceLinks 2019-02-25 10:43:29 -05:00
Jordan Liggitt 9788d401e2 Revert "bug: fix segfault when EnableServiceLinks is nil"
This reverts commit e9f1700512.
2019-02-25 10:35:48 -05:00
Kevin Taylor a64b854137 Implementation of KEP Feature Gate VolumeSubpathEnvExpansion 2019-02-20 01:37:16 +00:00
Wei Huang c0c93f4a52
kubelet: return mirror pod in GetActivePods() 2019-02-18 12:06:43 -08:00
Joe Julian e9f1700512
bug: fix segfault when EnableServiceLinks is nil
When upgrading to 1.13, pods that were created prior to the upgrade have
no pod.Spec.EnableServiceLinks set. This causes a segfault and prevents
the pod from ever starting.

Check and set to the default if nil.

Fixes #71749
2019-01-31 11:07:32 -08:00
Kubernetes Prow Robot ea6acb34d1
Merge pull request #65132 from stewart-yu/stewart-removeunusedtodo
remove unuse todo
2018-12-19 06:51:29 -08:00
stewart-yu 5f11d089b7 remove unused todo in kubelet_pods.go 2018-11-30 12:51:46 +08:00
xichengliudui 68f9dacabf Fix typo: trus->true 2018-11-15 01:36:15 -05:00
Bill Warshaw ab507dfc1f Write HostAliases aliases on same line per host IP
* change HostAliases to put all aliases for an IP
  on the same line in /etc/hosts rather than writing
  one line per IP-alias pair
* having multiple entries in /etc/hosts for the same IP
  causes issues with DNS resolution for some software
* https://unix.stackexchange.com/questions/102660/hosts-file-is-it-incorrect-to-have-the-same-ip-address-on-multiple-lines
2018-11-11 20:54:52 -05:00
Davanum Srinivas 954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
k8s-ci-robot 08351b6d6d
Merge pull request #68230 from bertinatto/remove_mount_propagation_gate
Remove mount propagation feature gate
2018-11-02 01:13:43 -07:00
Fabio Bertinatto 6c9b854542 Remove mount propagation feature gate logic 2018-10-31 15:51:37 +01:00
k8s-ci-robot 63a7e06eb5
Merge pull request #69484 from ddebroy/ddebroy-winpipe1
Correctly handle named pipe host mounts for Windows
2018-10-30 16:15:57 -07:00
Deep Debroy 5da66fd65f Address code review comments
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2018-10-27 00:31:16 -07:00
Deep Debroy 119e2a1d43 Address CR comments and add more tests
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2018-10-26 00:29:27 -07:00
Deep Debroy 2e19f70922 Improve comments for when hostPath in Windows needs to be transformed
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2018-10-25 13:58:16 -07:00
k8s-ci-robot e85cb406eb
Merge pull request #65567 from ceshihao/pod_status_after_eviction
Pod status should contain ContainerStatuses if deadline exceeded
2018-10-17 11:56:41 -07:00
Deep Debroy f8a69f1086 Broaden scope of host path types to skip processing in Windows
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2018-10-12 19:57:08 -07:00
Deep Debroy b4bb5dd430 Correctly handle named pipe host mounts for Windows
Signed-off-by: Deep Debroy <ddebroy@docker.com>
2018-10-05 16:46:04 -07:00
k8s-ci-robot a8e8e891f2
Merge pull request #68289 from denkensk/fix-simple-pkg-kubelet
Simple code fixed in in pkg/kubelet
2018-09-25 06:14:03 -07:00
Brad Hoekstra 69551689d5 Fix spelling 2018-09-22 00:07:08 -04:00
Brad Hoekstra 42da186b62 Address review comments 2018-09-21 20:06:32 -04:00
Brad Hoekstra c4ec40eca8 Update comment to reflect the new logic 2018-09-21 16:26:37 -04:00
Brad Hoekstra e8366c8e99 Fix to inject KUBERNETES_ env vars when enableServiceLinks is
false and the pod is in the master namespace.
2018-09-17 16:28:49 -04:00
Brad Hoekstra ac8799a80d kubelet: Make service environment variables optional 2018-09-17 16:27:36 -04:00
wangqingcan b0c308f082 Simple code and typo fixed in in pkg/kubelet 2018-09-05 21:51:32 +08:00
Jordan Liggitt e309bd3abf
Remove deprecated feature flags 2018-08-28 15:25:46 -04:00
Yu-Ju Hong 390b158db9 kubelet: plumb context for log requests
This allows kubelets to stop the necessary work when the context has
been canceled (e.g., connection closed), and not leaking a goroutine
and inotify watcher waiting indefinitely.
2018-08-10 17:35:46 -07:00
Russ Cox 2bd91dda64 kubernetes: fix printf format errors
These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

Lubomir I. Ivanov <neolit123@gmail.com>
applied ammend for:
  pkg/cloudprovider/provivers/vsphere/nodemanager.go
2018-07-11 00:10:15 +03:00
ceshihao 3b9ed9afff pod status should contain ContainerStatuses after eviction 2018-06-28 11:52:08 +08:00
Minhan Xia 370268f123 Inject ContainersReady 2018-06-05 11:10:38 -07:00
Kubernetes Submit Queue e64b81342b
Merge pull request #64344 from freehan/pod-ready-plus2
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>.

Teach Kubelet about Pod Ready++

Follow up PR of https://github.com/kubernetes/kubernetes/pull/62306 and https://github.com/kubernetes/kubernetes/pull/64057, **Only the last 3 commits are new.** Will rebase once the previous ones are merged.

ref: https://github.com/kubernetes/community/blob/master/keps/sig-network/0007-pod-ready%2B%2B.md


kind/feature
priority/important-soon
sig/network
sig/node

/assign @yujuhong


```release-note
NONE
```
2018-06-05 01:50:27 -07:00
Minhan Xia d46cdbed6c Generate pod ready status with readiness gates 2018-06-04 12:16:56 -07:00
Michelle Au f3f1a04705 Only mount subpath as readonly if specified in volumeMount 2018-06-04 12:05:23 -07:00
Kubernetes Submit Queue d2495b8329
Merge pull request #63143 from jsafrane/containerized-subpath
Automatic merge from submit-queue (batch tested with PRs 63348, 63839, 63143, 64447, 64567). 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>.

Containerized subpath

**What this PR does / why we need it**:
Containerized kubelet needs a different implementation of `PrepareSafeSubpath` than kubelet running directly on the host.

On the host we safely open the subpath and then bind-mount `/proc/<pidof kubelet>/fd/<descriptor of opened subpath>`.

With kubelet running in a container, `/proc/xxx/fd/yy` on the host contains path that works only inside the container, i.e. `/rootfs/path/to/subpath` and thus any bind-mount on the host fails.

Solution:
- safely open the subpath and gets its device ID and inode number
- blindly bind-mount the subpath to `/var/lib/kubelet/pods/<uid>/volume-subpaths/<name of container>/<id of mount>`. This is potentially unsafe, because user can change the subpath source to a link to a bad place (say `/run/docker.sock`) just before the bind-mount.
- get device ID and inode number of the destination. Typical users can't modify this file, as it lies on /var/lib/kubelet on the host.
- compare these device IDs and inode numbers.

**Which issue(s) this PR fixes**
Fixes #61456

**Special notes for your reviewer**:

The PR contains some refactoring of `doBindSubPath` to extract the common code. New `doNsEnterBindSubPath` is added for the nsenter related parts.

**Release note**:

```release-note
NONE
```
2018-06-01 12:12:19 -07:00
Kubernetes Submit Queue 8d10a8f74f
Merge pull request #64006 from Random-Liu/streaming-auth
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 proxy for container streaming in kubelet for streaming auth.

For https://github.com/kubernetes/kubernetes/issues/36666, option 2 of https://github.com/kubernetes/kubernetes/issues/36666#issuecomment-378440458.

This PR:
1. Removed the `DirectStreamingRuntime`, and changed `IndirectStreamingRuntime` to `StreamingRuntime`. All `DirectStreamingRuntime`s, `dockertools` and `rkt`, were removed.
2. Proxy container streaming in kubelet instead of returning redirect to apiserver. This solves the container runtime authentication issue, which is what we agreed on in https://github.com/kubernetes/kubernetes/issues/36666.

Please note that, this PR replaced the redirect with proxy directly instead of adding a knob to switch between the 2 behaviors. For existing CRI runtimes like containerd and cri-o, they should change to serve container streaming on localhost, so as to make the whole container streaming connection secure.

 If a general authentication mechanism proposed in https://github.com/kubernetes/kubernetes/issues/62747 is ready, we can switch back to redirect, and all code can be found in github history.

Please also note that this added some overhead in kubelet when there are container streaming connections. However, the actual bottleneck is in the apiserver anyway, because it does proxy for all container streaming happens in the cluster. So it seems fine to get security and simplicity with this overhead. @derekwaynecarr @mrunalp Are you ok with this? Or do you prefer a knob?

@yujuhong @timstclair @dchen1107 @mikebrow @feiskyer 
/cc @kubernetes/sig-node-pr-reviews 
**Release note**:

```release-note
Kubelet now proxies container streaming between apiserver and container runtime. The connection between kubelet and apiserver is authenticated. Container runtime should change streaming server to serve on localhost, to make the connection between kubelet and container runtime local.

In this way, the whole container streaming connection is secure. To switch back to the old behavior, set `--redirect-container-streaming=true` flag.
```
2018-05-31 22:45:29 -07:00
Lantao Liu 174b6d0e2f Proxy container streaming in kubelet. 2018-05-31 15:26:32 -07:00
Lantao Liu aeb6cacf01 Remove direct and indirect streaming runtime interface. 2018-05-29 15:08:15 -07:00
Kevin Taylor b2d4426f09 Add dynamic environment variable substitution to subpaths 2018-05-29 17:01:09 +01:00
Jan Safranek 7e3fb502a8 Change SafeMakeDir to resolve symlinks in mounter implementation
Kubelet should not resolve symlinks outside of mounter interface.
Only mounter interface knows, how to resolve them properly on the host.

As consequence, declaration of SafeMakeDir changes to simplify the
implementation:
from SafeMakeDir(fullPath string, base string, perm os.FileMode)
to   SafeMakeDir(subdirectoryInBase string, base string, perm os.FileMode)
2018-05-23 10:21:20 +02:00
Jan Safranek 74ba0878a1 Enhance ExistsPath check
It should return error when the check fails (e.g. no permissions, symlink link
loop etc.)
2018-05-23 10:21:20 +02:00
Jan Safranek 97b5299cd7 Add GetMode to mounter interface.
Kubelet must not call os.Lstat on raw volume paths when it runs in a container.
Mounter knows where the file really is.
2018-05-23 10:17:59 +02:00
Kubernetes Submit Queue e6b6e5c4b4
Merge pull request #63045 from msau42/fix-subpath-readonly
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>.

passthrough readOnly to subpath

**What this PR does / why we need it**:
If a volume is mounted as readonly, or subpath volumeMount is configured as readonly, then the subpath bind mount should be readonly.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes issue where subpath readOnly mounts failed
```
2018-05-07 23:36:49 -07:00
Seth Jennings 1fb3b24b63 kubelet: fix warning message to not print pointer addrs 2018-04-30 16:38:43 -05:00