Commit Graph

81 Commits

Author SHA1 Message Date
Jurj Andrei George
8f6fa99b49 Skip failing Windows unit tests (volume)
As discussed during the SIG Testing meeting on January 10, 2023, failing
Windows unit tests are now skipped.
These changes should be reverted when the unit tests wil get fixed.
Mentioned SIG Testing meeting:
https://docs.google.com/document/d/1z8MQpr_jTwhmjLMUaqQyBk1EYG_Y_3D4y4YdMJ7V1Kk/edit#heading=h.qwblxf2uhgoo
2023-01-24 11:02:44 +02:00
Claudiu Belu
4dc7a260ec unittests: Fixes unit tests for Windows (part 4)
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- paths not properly joined (filepath.Join should be used).
- files not closed, which means that they cannot be removed / renamed.
- time.Now() is not as precise on Windows, which means that 2
  consecutive calls may return the same timestamp.
2022-11-29 16:32:26 +00:00
Jan Safranek
fc245b339b Refactor ConstructVolumeSpec
Return a struct from ConstructVolumeSpec to be able to add more fields to
it later.
2022-11-03 16:55:13 +01: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
Cheng Xing
0e315355df Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
mengjiao.liu
c24b87b133 Fixed a possible nil pointer dereference caused by variable plug 2021-05-21 10:17:04 +08:00
he.qingguo
3e4e50a3b9 Fix typo in pkg/volume/rbd/rbd_test.go
Signed-off-by: he.qingguo <he.qingguo@zte.com.cn>
2020-12-30 13:58:41 +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
Shihang Zhang
d2859cd89b plumb service account token down to csi driver 2020-11-12 09:26:43 -08:00
Srini Brahmaroutu
fbe5daed73 Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
Kubernetes Prow Robot
2e59a17dc1
Merge pull request #92288 from zhijianli88/cleanup-tempfiles
Cleanup tempfiles
2020-08-27 17:56:54 -07:00
haleygo
d6cf8d3e57 update static check failed from pkg/volume/rbd
remove field from staticcheck_failures
2020-06-27 02:21:51 +08:00
Li Zhijian
02eaa4f354 cleanup tempfiles in unit test
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
2020-06-23 11:47:18 +08:00
pohsienshih
9bfe818229 Fixed golint issues in RBD code 2020-02-29 23:36:58 +08:00
Maxime VISONNEAU
bea4b61158
Fixed a failing test on a RBD mount scenario 2020-01-28 12:44:34 +00:00
David Zhu
21f7060c8f Plumb test state through to fake volume host creation for error handling 2019-11-18 14:45:01 -08:00
Travis Rhoden
0c5c3d8bb9
Remove pkg/util/mount (moved out of tree)
This patch removes pkg/util/mount completely, and replaces it with the
mount package now located at k8s.io/utils/mount. The code found at
k8s.io/utils/mount was moved there from pkg/util/mount, so the code is
identical, just no longer in-tree to k/k.
2019-11-15 08:29:12 -07:00
Travis Rhoden
1fd8921546
Move mount/fake.go to mount/fake_mount.go
This patch moves fake.go to mount_fake.go, and follows to principle of
always returning a discrete type rather than an Interface. All callers
of "FakeMounter" are changed to instead use "NewFakeMounter()". The
FakeMounter "Log" struct member is changed to not be exported, and
instead only access through a new "GetLog()" method.
2019-11-08 08:07:41 -07:00
Jeremy Xu
d8fc13791a Avoid RbdDiskManager's DetachDisk never execute again 2019-07-16 18:13:38 +08:00
Robert Krawitz
5b97b2860d Change fsGroup to mounterArgs in volume.SetUp() to allow for future extension. 2019-05-29 15:12:28 -04:00
mlmhl
34a2f23dc1 use json format to get rbd image size 2018-12-29 19:45:13 +08:00
jianglingxia
aeef7fdca2 Add UT to RBD volume test of TestGetAccessModes and TestRequiresRemount 2018-07-26 10:00:44 +08:00
Kubernetes Submit Queue
1bdee5636a
Merge pull request #64555 from wenlxie/upstream.master.fixrbdblockmode
Automatic merge from submit-queue (batch tested with PRs 65254, 64837, 64782, 64555, 64850). 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>.

fix rbd device works at block mode not get mapped to container 

In my environment, restart docker will caused all of the container restart(our kernel is a bit old). 
Kubelet will also be restart.
After the  container up , I checked the container and find the RBD block device is not mapped to container.
When I inspect the container, its {HostConfig.Devices[]} field is empty.
I did some debug,  then find that  at code https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L113
The volName is empty. 

```release-notes
Fix issues for block device not mapped to container.
```
2018-06-20 11:28:17 -07:00
wenlxie
ca276336e1 1. fix rbd device works at block mode not get mapped to container when docker restart
2. Add unit test case for rbd
2018-06-05 13:21:54 +08:00
Tardis Xu
015871bf57 Format 2018-05-25 00:07:41 +08:00
Tardis Xu
56289ef3f8 Fix issue 64119. 2018-05-24 23:48:19 +08:00
Tardis Xu
6d3b41cd85 Fix issue #63183 that pods on different nodes mount Ceph RBD PVC stuck on ContainerCreating. 2018-05-09 16:04:24 +08:00
Ian Chakeres
470980d4a8 Skip volume unit tests that don't work on osx. 2018-03-26 12:47:36 -07:00
linyouchong
e92f6eb0fe fix incorrect logic in canSupport 2018-02-09 11:45:15 +08:00
mlmhl
2ccf22a5d0 fix rbd ConstructVolumeSpec bug 2018-01-09 10:27:05 +08:00
Serguei Bezverkhi
335c5d959f Adding support for Block Volume to rbd plugin 2018-01-05 23:56:37 -05:00
NickrenREN
6f7a1983ef Support ceph rbd resize 2017-11-22 19:48:02 +08:00
Clayton Coleman
b844ac44f5
Tmpdir can be a symlink, also fake mount needs to call nested mounter 2017-11-03 22:21:29 -04:00
Kubernetes Submit Queue
6d73f03d2b
Merge pull request #54549 from linyouchong/linyouchong-20171025
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>.

fix incorrect log

**What this PR does / why we need it**:
fix incorrect log in nfs_test.go
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
NONE
**Special notes for your reviewer**:
NONE
**Release note**:
NONE
2017-10-27 11:02:42 -07:00
linyouchong
02e8ffe13c fix incorrect log 2017-10-26 01:40:24 +08:00
Yecheng Fu
f2af1af82f RBD Plugin: No need to acquire advisory lock any more!
With central attachdetach controller, we don't need to lock the image
any more. But for backward compatibility, we should:

1) Check if the image is still used by nodes running old kubelet in
attaching.
2) Clean old rbd.json file and remove lock if found in detaching.
2017-10-25 18:31:57 +08:00
Yecheng Fu
ba0d275f3b RBD Plugin: Implement Attacher/Detacher interfaces.
1) Modify rbdPlugin to implement volume.AttachableVolumePlugin
   interface.
2) Add rbdAttacher/rbdDetacher structs to implement
   volume.Attacher/Detacher interfaces.
3) Add mount.SafeFormatAndMount/mount.Exec fields to rbdPlugin, and
   setup them in rbdPlugin.Init for later uses.
   Attacher/Mounter/Unmounter/Detacher reference rbdPlugin to use mounter
   and exec. This simplifies code.
4) Add testcase struct to abstract RBD Plugin test case, etc.
5) Add newRBD constructor to unify rbd struct initialization.
2017-10-25 17:43:17 +08:00
Serguei Bezverkhi
1411c2698e Refactor RBD volume 2017-10-23 16:59:34 -04:00
Yecheng Fu
8fa92e48a8 RBD Plugin: Omit volume.MetricsProvider field and add some testcases. 2017-09-11 02:18:52 +00:00
Cheng Xing
396c3c7c6f Adding dynamic Flexvolume plugin discovery capability, using filesystem watch. 2017-08-25 11:42:32 -07:00
Kubernetes Submit Queue
d3dc9cd9ba Merge pull request #51114 from jsafrane/exec-rbd
Automatic merge from submit-queue (batch tested with PRs 51114, 51233, 51024, 51053, 51197)

rbd: Use VolumeHost.GetExec() to execute stuff in volume plugins

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

This PR updates rbd volume plugin to use `VolumeHost.GetExec()` to execute utilities like mkfs and lsblk instead of simple `os/exec`. This prepares the volume plugin to run these utilities in containers instead of running them on the host + makes the volume plugin more independent and less hardcoded.

See proposal in https://github.com/kubernetes/community/pull/589.

Note that this PR does **not** change place where the utilities are executed - `VolumeHost.GetExec()` still leads directly to `os/exec`. It will be changed when the aforementioned proposal is merged and implemented.

@kubernetes/sig-storage-pr-reviews 

**Release note**:
```release-note
NONE
```
2017-08-25 06:22:09 -07:00
xiangpengzhao
35b45d60b2 Use Fatalf instead of Errorf when mounter/unmounter if nil in volume tests 2017-08-23 10:29:30 +08:00
Jan Safranek
73b101c14b rbd: Use VolumeHost.GetExec() to execute stuff in volume plugins 2017-08-22 15:49:21 +02:00
Jacob Simpson
29c1b81d4c Scripted migration from clientset_generated to client-go. 2017-07-17 15:05:37 -07:00
Chao Xu
60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu
f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
deads2k
5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
deads2k
ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
Clayton Coleman
9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k
6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00