k3s/pkg/kubelet
Kubernetes Submit Queue 186dd7beb1
Merge pull request #62903 from cofyc/fixfsgroupcheckinlocal
Automatic merge from submit-queue (batch tested with PRs 62657, 63278, 62903, 63375). 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 more volume types in e2e and fix part of them.

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

- Add dir-link/dir-bindmounted/dir-link-bindmounted/bockfs volume types for e2e tests.
- Fix fsGroup related e2e tests partially.
- Return error if we cannot resolve volume path.
  - Because we should not fallback to volume path, if it's a symbolic link, we may get wrong results.

To safely set fsGroup on local volume, we need to implement these two methods correctly for all volume types both on the host and in container:

- get volume path kubelet can access
  - paths on the host and in container are different
- get mount references
  - for directories, we cannot use its mount source (device field) to identify mount references, because directories on same filesystem have same mount source (e.g. tmpfs), we need to check filesystem's major:minor and directory root path on it

Here is current status:

| | (A) volume-path (host) | (B) volume-path (container) | (C) mount-refs (host) | (D) mount-refs (container) |
| --- | --- | --- | --- | --- |
| (1) dir | OK | FAIL | FAIL | FAIL |
| (2) dir-link | OK | FAIL | FAIL | FAIL |
| (3) dir-bindmounted | OK | FAIL | FAIL | FAIL |
| (4) dir-link-bindmounted | OK | FAIL | FAIL | FAIL |
| (5) tmpfs| OK | FAIL | FAIL | FAIL |
| (6) blockfs| OK | FAIL | OK | FAIL |
| (7) block| NOTNEEDED | NOTNEEDED | NOTNEEDED | NOTNEEDED |
| (8) gce-localssd-scsi-fs| NOTTESTED | NOTTESTED | NOTTESTED | NOTTESTED |

- This PR uses `nsenter ... readlink` to resolve path in container as @msau42  @jsafrane [suggested](https://github.com/kubernetes/kubernetes/pull/61489#pullrequestreview-110032850). This fixes B1:B6 and D6, , the rest will be addressed in https://github.com/kubernetes/kubernetes/pull/62102.
- C5:D5 marked `FAIL` because `tmpfs` filesystems can share same mount source, we cannot rely on it to check mount references. e2e tests passes due to we use unique mount source string in tests.
- A7:D7 marked `NOTNEEDED` because we don't set fsGroup on block devices in local plugin. (TODO: Should we set fsGroup on block device?)
- A8:D8 marked `NOTTESTED` because I didn't test it, I leave it to `pull-kubernetes-e2e-gce`. I think it should be same as `blockfs`.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-02 20:13:11 -07:00
..
apis Merge pull request #62662 from wangzhen127/runtime-default 2018-04-26 14:33:53 -07:00
cadvisor Remove rktnetes code 2018-03-27 09:29:35 -07:00
certificate Merge pull request #62805 from awly/take-reviews 2018-04-25 21:24:31 -07:00
checkpoint Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
checkpointmanager Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
client Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
cm Merge pull request #62903 from cofyc/fixfsgroupcheckinlocal 2018-05-02 20:13:11 -07:00
config remove versioning interface 2018-04-27 07:56:42 -04:00
configmap Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
container stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
custommetrics Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
dockershim Merge pull request #62657 from matthyx/master 2018-05-02 19:44:32 -07:00
envvars Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
events Improve messaging on resize 2018-01-29 15:07:51 -05:00
eviction refresh eviction interval periodically 2018-03-06 15:14:05 -08:00
images Promote LocalStorageCapacityIsolation feature to beta 2018-03-02 15:10:08 -08:00
kubeletconfig eliminate indirection from type registration 2018-04-25 09:02:31 -04:00
kuberuntime Make kubelet `ReadLogs` backward compatible. 2018-04-27 16:03:29 -07:00
leaky
lifecycle Support cluster-level extended resources in kubelet and kube-scheduler 2018-02-27 17:25:30 -08:00
logs Generated code 2018-02-23 01:42:35 +00:00
metrics Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
mountpod Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
network Update bazel BUILD files 2018-04-11 09:26:02 -07:00
pleg Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
pod Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
preemption Delete in-tree support for NVIDIA GPUs. 2018-04-02 20:17:01 -07:00
prober reset resultRun to 0 on pod restart 2018-04-19 22:58:19 +08:00
qos Make a few code paths compile cleanly with 32-bit Go. 2018-02-27 13:53:32 -08:00
remote Add level to remote client glog. 2018-04-26 01:21:20 -07:00
secret Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
server Expose kubelet health checks using new prometheus endpoint 2018-03-30 11:08:15 -07:00
stats Update bazel BUILD files 2018-04-11 09:26:02 -07:00
status Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
sysctl Update generated files. 2018-04-11 18:35:24 +02:00
types Merge pull request #61432 from filbranden/killrkt1 2018-03-29 11:46:19 -07:00
util Detect backsteps correctly in base path detection 2018-03-13 02:23:06 -04:00
volumemanager boring 2018-04-18 09:55:57 -07:00
winstats fix "make test" 2018-02-24 17:39:21 +08:00
BUILD Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
OWNERS
active_deadline.go
active_deadline_test.go
doc.go
kubelet.go Timeout on instances.NodeAddresses cloud provider request 2018-04-23 13:28:43 +02:00
kubelet_getters.go Fix issue with race condition during pod deletion 2018-03-15 15:35:37 -07:00
kubelet_getters_test.go
kubelet_network.go Move hairpin mode logic to dockershim 2018-04-11 09:21:17 -07:00
kubelet_network_test.go Move the kubelet network package down to dockershim 2018-04-11 09:25:56 -07:00
kubelet_node_status.go Merge pull request #62543 from ingvagabund/timeout-on-cloud-provider-request 2018-04-23 09:12:42 -07:00
kubelet_node_status_test.go Timeout on instances.NodeAddresses cloud provider request 2018-04-23 13:28:43 +02:00
kubelet_pods.go kubelet: fix warning message to not print pointer addrs 2018-04-30 16:38:43 -05:00
kubelet_pods_test.go stop duplicating preferred version order 2018-04-26 10:03:36 -04:00
kubelet_pods_windows_test.go Lock subPath volumes 2018-03-05 09:14:44 +01:00
kubelet_resources.go
kubelet_resources_test.go
kubelet_test.go Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
kubelet_volumes.go Fix issue with race condition during pod deletion 2018-03-15 15:35:37 -07:00
kubelet_volumes_test.go boring 2018-04-18 09:55:57 -07:00
oom_watcher.go
oom_watcher_test.go
pod_container_deletor.go kubelet: force filterContainerID to empty string when removeAll is true 2018-04-30 16:29:17 -05:00
pod_container_deletor_test.go
pod_workers.go fixes document grammar 2018-02-20 10:38:41 -05:00
pod_workers_test.go
reason_cache.go
reason_cache_test.go
runonce.go fix todo:add function getFailContainer to report which containers failed the pod 2018-03-15 09:38:02 +08:00
runonce_test.go Make 'pod' package to use unified checkpointManager 2018-04-16 01:30:20 -04:00
runtime.go Remove setInitError. 2018-01-29 21:44:54 -08:00
util.go
volume_host.go Only count mounts that are from other pods 2018-04-19 15:40:51 -07:00