kubernetes/pkg/volume/flexvolume
Maxim Patlasov 0a37f09c32 Fix directory mismatch for volume.SetVolumeOwnership()
In most cases `dir` arg of `SetUpAt()` method of `volume.Mounter` interface is the same as `mounter.GetPath()` because we usually call `SetUpAt()` from `SetUp()` like this:"
```
func (ed *emptyDir) SetUp(mounterArgs volume.MounterArgs) error {
	return ed.SetUpAt(ed.GetPath(), mounterArgs)
}
```
(this example is from `volume/emptydir/empty_dir.go`, but there are plenty other examples like that in `volume/*`)

However, there is currently one exception. This is from `volume/projected/projected.go`:
```
	if err := wrapped.SetUpAt(dir, mounterArgs); err != nil {
		return err
	}
```
(see 96306f144a/pkg/volume/projected/projected.go (L203))

In this case `dir` is not equal to `wrapped.GetPath()` and `volume.SetVolumeOwnership()` fails when called from `SetUpAt()` of wrapped volume:
```
lstat /var/lib/kubelet/pods/a2f6e58f-7edf-4c48-a97c-ef1b8fd3caf6/volumes/kubernetes.io~empty-dir/wrapped_kube-api-access-knvkv: no such file or directory
```

To fix the issue let's pass `dir` arg to `volume.SetVolumeOwnership()` explicitly, and use it instead of `mounter.GetPath()`.
2023-04-03 12:34:37 -07:00
..
attacher_test.go Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
attacher-defaults.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
attacher.go Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
common_test.go unittests: Fixes unit tests for Windows (part 2) 2022-08-01 18:56:32 +03:00
detacher_test.go
detacher-defaults.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
detacher.go cleanup: fix log capitalization in volume package 2021-04-14 21:58:56 +08:00
driver-call_test.go
driver-call.go simplify returning boolean expression in /pkg/volume 2021-05-25 02:39:55 +00:00
expander-defaults.go switch over k/k to use klog v2 2020-05-16 07:54:27 -04:00
expander.go Move resize function parameters to a new ResizeOptions type 2019-03-08 09:21:44 -05:00
fake_watcher.go
flexvolume_test.go unittests: Fixes unit tests for Windows (part 2) 2022-08-01 18:56:32 +03:00
mounter_test.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
mounter-defaults.go Merge pull request #104732 from mengjiao-liu/remove-flag-experimental-check-node-capabilities-before-mount 2022-02-24 07:56:30 -08:00
mounter.go Fix directory mismatch for volume.SetVolumeOwnership() 2023-04-03 12:34:37 -07:00
OWNERS Cleanup OWNERS files (No Activity in the last year) 2021-12-15 10:34:02 -05:00
plugin_test.go bump k8s.io/utils version 2019-12-21 14:54:44 +08:00
plugin-defaults.go Fix log format in flexvolume 2021-04-13 21:42:07 +08:00
plugin.go Refactor ConstructVolumeSpec 2022-11-03 16:55:13 +01:00
probe_test.go Skip failing Windows unit tests (volume) 2023-01-24 11:02:44 +02:00
probe.go fsnotify: use event.Has instead of "event.Op&h == h" 2022-10-13 13:42:26 +08:00
unmounter_test.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
unmounter-defaults.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
unmounter.go cleanup: fix log capitalization in volume package 2021-04-14 21:58:56 +08:00
util.go cleanup: fix log capitalization in volume package 2021-04-14 21:58:56 +08:00
volume.go Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00