Commit Graph

10 Commits

Author SHA1 Message Date
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
Giuseppe Scrivano
eee5fa8b8d
volume: use the effective uid
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-08-02 23:47:58 +02:00
Mengjiao Liu
beda4cafb6 kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00
Hemant Kumar
27d1e9a4e2 Remove all references to ConfigurableFSGroupPolicy feature gate 2021-11-10 14:24:08 -05:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Mauricio Vásquez
119040ac77 volume: Add unit test for SetVolumeOwnership owners
Former TestSetVolumeOwnership only checks the mode of the files. This commit
adds a new TestSetVolumeOwnershipOwner that checks the ownership of the files.
2020-11-11 09:23:16 -05:00
jornshen
4ed7709774 Report a metric for time taken to perform recursive permission change 2020-10-26 21:04:30 +08:00
Hemant Kumar
6362a616ec Force sgid bit to be off before checking volume permission 2020-04-01 11:20:38 -04:00
Hemant Kumar
b132959687 Start adding tests for verifying correct modes
Add an example for permission bits checking
2020-03-05 08:00:27 -05:00
Hemant Kumar
c52d4bf32f Implement changes into volume plugins for skipping chown
Add a separate function for walking directories
2020-03-04 21:23:31 -05:00