Commit Graph

82 Commits

Author SHA1 Message Date
Fabio Bertinatto
b19172c58f Promote DelegateFSGroupToCSIDriver feature to GA 2022-11-04 07:26:17 -03:00
Jonathan Dobson
5f774832a5 Move CSIInlineVolume feature to GA 2022-08-04 13:06:30 -06:00
Claudiu Belu
38092cb458 unittests: Fixes unit tests for Windows (part 2)
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- volume mounting is a bit different on Windows: Mount will create the
  parent dirs and mklink at the volume path later (otherwise mklink will
  raise an error).
- os.Chmod is not working as intended on Windows.
- path.Dir() will always return "." on Windows, and filepath.Dir()
  should be used instead (which works correctly).
- on Windows, you can't typically run binaries without extensions. If
  the file C:\\foo.bat exists, we can still run C:\\foo because Windows
  will append one of the supported file extensions ($env:PATHEXT) to it
  and run it.
- Windows file permissions do not work the same way as the Linux ones.
- /tmp directory being used, which might not exist on Windows. Instead,
  the OS-specific Temp directory should be used.

Fixes a few other issues:

- rbd.go: Return error in a case in which an error is encountered. This
  will prevent "rbd: failed to setup" and "rbd: successfully setup" log
  messages to be logged at the same time.
2022-08-01 18:56:32 +03:00
Kubernetes Prow Robot
c175418281
Merge pull request #107065 from saikat-royc/fix-node-stage-path
change node staging path for csi driver to PV agnostic
2022-01-21 01:31:58 -08:00
Saikat Roychowdhury
80e0501e89 change staging path for csi driver to pv agnostic 2022-01-20 22:59:29 +00:00
prateekpandey14
f9cf14f3f6 fix static check of importing the same package multiple times
Signed-off-by: prateekpandey14 <prateekpandey14@gmail.com>
2021-12-14 11:06:44 +05:30
Cheng Xing
c50b3074fe Moved VOLUME_MOUNT_GROUP capability check from NodeStageVolume to MountDevice; added log message in SetupAt to indicate FSGroup is delegated to driver 2021-07-03 16:29:42 -07:00
Cheng Xing
794a925a85 Pass FsGroup to NodeStageVolume 2021-07-03 16:29:42 -07:00
Cheng Xing
0e315355df Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
Pushkar Joglekar
1e250610b2 Fix panic in pkg/volume/csi tests
When run as non-root user, TestAttacherMountDevice fails, because of missing
nil check that induces a panic. Fixed by doing err nil check
before using the returned user value from user.Current()
2021-06-24 10:14:20 -07:00
mengjiao.liu
1d764952da Fix incorrect test code in pkg/volume/csi/csi_attacher_test.go file 2021-04-01 15:18:07 +08:00
wzshiming
bc3d9252bc Speed up pkg/volume/csi unit tests 2021-02-27 14:09:38 +08:00
Chris Henzie
f36fec997a Poll for VolumeAttachments in CSI attacher
The CSI attacher that runs inside of the AttachDetachController has
access to a VolumeAttachment lister. By polling this lister for the
status of VolumeAttachments, we can save threads on the API server by
not using watches.
2021-02-23 16:54:18 -08:00
Christian Huffman
15da65d9ae Include unit test 2021-01-19 16:10:51 -05:00
Chris Henzie
736b7e15b7 Remove duplicate test CSI plugin constructor logic 2021-01-06 16:32:41 -08:00
Chris Henzie
359b9e3383 Ensure CSI test plugin informers are synced before returning
This way of syncing informers ensures all informers generated from these
factories are synced. Informers are lazy loaded, and only created once a
user calls .Informer() (which was why the .PollImmediate() worked).
Asserting the number of synced types to ensure everything is set up
correctly.
2021-01-06 16:11:50 -08:00
Chris Henzie
257704b30d Remove setupInformer argument from test CSI plugin constructor 2021-01-06 16:11:50 -08:00
Chris Henzie
70eddfefec Ensure goroutines exit in CSI attacher tests
The reason for adding an expectedVolumeHost field is to prevent a
channel read from hanging when a test fails prior to creating the
VolumeAttachment watch.
2021-01-06 16:11:50 -08:00
Chris Henzie
f098ada9d1 Extract watch reactor out of test CSI plugin constructor 2021-01-06 16:11:50 -08:00
Chris Henzie
195a5af23b Make volume attachment watch timeout configurable for csiAttacher 2021-01-06 16:11:39 -08:00
Chris Henzie
b4e3f272b9 Remove unused waitSleepTime field in csiAttacher 2021-01-06 15:45:56 -08:00
Chris Henzie
9d8f994d4e Separate test Kubelet and AttachDetach VolumeHost types
fakeVolumeHost previously implemented both the KubeletVolumeHost and
AttachDetachVolumeHost interfaces. This design makes it difficult to test the
CSIAttacher since it behaves differently depending on what type of
VolumeHost is supplied.
2020-12-17 15:17:04 -08:00
Kubernetes Prow Robot
2b4be7bb5f
Merge pull request #88759 from andyzhangx/csi-dir-fix
feat: ignore mount dir check in csi node stage/publish
2020-11-09 16:08:40 -08:00
Jan Safranek
55ffd9d5fc Add unit test for staging path creation 2020-11-09 19:22:25 +01:00
knight42
469f59a52a
test(csi): deflake TestAttacherWithCSIDriver
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-09-03 22:39:40 +08:00
Jayasekhar Konduru
2a89577659 CSI: Modify VolumeAttachment check to use Informer/Cache
Change-Id: Ie70c8b6657c67eefbf13042f36d56ca84a2e42bb
2020-06-11 10:34:09 -07:00
Christian Huffman
c6fd25d100 Updated CSIDriver references 2020-03-06 08:21:26 -05:00
Mike Danese
25651408ae generated: run refactor 2020-02-08 12:30:21 -05:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
danielqsj
5bc0e26c19 unify alias of api errors under pkg and staging 2019-12-26 16:42:28 +08:00
Hemant Kumar
4b8e552a88 Use typed errors for special casing volume progress
Use typed errors rather than operation status for
indicating operation progress
2019-12-04 14:48:30 -05:00
Hemant Kumar
cdbd3ba5c2 Change interface of SetUp function 2019-12-02 12:09:38 -05:00
Hemant Kumar
db9ac38592 Change signature of MountDevice function and remove MountDeviceWithStatusTracking 2019-12-02 12:09:38 -05:00
Hemant Kumar
57019e0628 Add tests for verifying in-progress state 2019-12-02 12:09:38 -05:00
David Zhu
21f7060c8f Plumb test state through to fake volume host creation for error handling 2019-11-18 14:45:01 -08:00
David Zhu
1a47bf54e2 De-race some CSI unit tests that were initializing the plugin manager…ger (and plugins) twice. Set some const variables earlier to support node info manager initialization and wait for initialization to complete before finishing plugin setup. 2019-11-15 11:23:32 -08:00
Kubernetes Prow Robot
494d4cb841
Merge pull request #79005 from cwdsuzhou/June/remove_recursion_detach
Remove recursion in waitForVolumeDetachmentInternal
2019-09-10 14:29:01 -07:00
caiweidong
28dc53f727 Remove recursion in waitForVolumeDetachmentInternal 2019-08-28 11:18:23 +08:00
Patrick Ohly
7bbc06fcd4 storage: check CSIDriver.Spec.VolumeLifecycleModes
Using a "normal" CSI driver for an inline ephemeral volume may have
unexpected and potentially harmful effects when the driver gets a
NodePublishVolume call that it isn't expecting. To prevent that mistake,
driver deployments for a driver that supports such volumes must:
- deploy a CSIDriver object for the driver
- set CSIDriver.Spec.VolumeLifecycleModes such that it contains "ephemeral"

The default for that field is "persistent", so existing deployments
continue to work and are automatically protected against incorrect
usage.

For the E2E tests we need a way to specify the driver mode. The
existing cluster-driver-registrar doesn't support that and also was
deprecated, so we stop using it altogether and instead deploy and
patch a CSIDriver object.
2019-08-13 23:12:52 +02:00
Ted Yu
f4fbfcb46a Remove recursion in csiAttacher#waitForVolumeAttachmentInternal 2019-07-23 14:29:24 -07:00
caiweidong
8789143062 Fix csi attacher unit tests using t.Run() 2019-07-22 15:42:31 +08:00
David Zhu
831cd29f4e Add passthrough for MountOptions for NodeStageVolume for CSI 2019-07-16 16:17:47 -07:00
Mucahit Kurt
db1c07750a unit tests for the volume plugin name that's used inside GeneratedUnmapVolumeFunc for csi migration on/off scenarios
Signed-off-by: Mucahit Kurt <mucahitkurt@gmail.com>
2019-06-11 08:32:25 +03:00
Hemant Kumar
0ab6bdfa36 Wait for waitforattach goroutine before exiting
This test suite fails in weird ways without waiting for the
goroutine
2019-05-21 09:57:47 -04:00
Andrew Kim
c919139245 update import of generic featuregate code from k8s.io/apiserver/pkg/util/feature -> k8s.io/component-base/featuregate 2019-05-08 10:01:50 -04:00
Shintaro Murakami
f8e81337da Do not generate unnecessary goroutine 2019-04-23 16:22:14 +09:00
Vladimir Vivien
b138e6d1e2 CSI - Surfaces klog flags; common tests aggregation 2019-04-12 15:38:06 -04:00
Vladimir Vivien
cfafde983b Volume AttachablePlugin.CanAttach() now returns both bool and error 2019-04-08 16:53:22 -04:00
Xing Yang
000ab86788 Move CSIDriver Lister to the controller 2019-04-05 12:20:11 -07:00
Michelle Au
ab6a2530fb return empty devicepath for csi attach 2019-03-27 17:28:21 -07:00