Commit Graph

30 Commits

Author SHA1 Message Date
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
Jan Safranek
04183005e4 Move lifecycle checks from NewMounter to SetUpAt
The checks need to get CSIDriver from the API server and the API server may
not be the case when NewMounter is called during volume reconstruction.
2022-10-24 17:30:51 +02:00
Humble Chirammal
f22a74aa6a various corrections in pkg/volume
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2022-09-16 16:42:06 +05:30
Jonathan Dobson
5f774832a5 Move CSIInlineVolume feature to GA 2022-08-04 13:06:30 -06:00
Mengjiao Liu
beda4cafb6 kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00
Cheng Xing
0e315355df Pass FsGroup to MountDevice 2021-07-03 16:29:42 -07:00
Kubernetes Prow Robot
dff5940ac3
Merge pull request #97534 from heqg/typo01
fix Spelling error for klog
2021-06-06 22:24:39 -07:00
卢振兴10069964
b3fea118dc code cleanup for pkg volume csi 2021-04-12 08:36:53 +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
Chris Henzie
195a5af23b Make volume attachment watch timeout configurable for csiAttacher 2021-01-06 16:11:39 -08:00
he.qingguo
620c23473f fix Spelling error for klog
Signed-off-by: he.qingguo <he.qingguo@zte.com.cn>
2020-12-28 10:50:06 +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
Christian Huffman
4d2d063635 Included e2e test for CSIDriver FSGroupPolicy 2020-11-12 16:30:38 -05:00
Christian Huffman
01f70d69b7 Move CSIVolumeFSGroupPolicy to beta 2020-11-12 16:28:54 -05:00
Kubernetes Prow Robot
0b8c2bf1a1
Merge pull request #94735 from mikedanese/flake
test flake: fix data race in csi_test.go
2020-09-22 12:24:01 -07:00
knight42
e89e72b637
test: ensure WaitForCacheSync is called after starting sharedInformerFacotry
Signed-off-by: knight42 <anonymousknight96@gmail.com>
2020-09-15 16:02:35 +08:00
Mike Danese
94f4f06d13 test flake: fix data race in csi_test.go
The attach goroutine can currently t.Log/t.Error during or after the
subtest completion. This causes races like:

```
==================
WARNING: DATA RACE
Read at 0x00c000e90ac3 by goroutine 1231:
  testing.(*common).logDepth()
      GOROOT/src/testing/testing.go:736 +0xa9
  testing.(*common).log()
      GOROOT/src/testing/testing.go:729 +0x8f
  testing.(*common).Logf()
      GOROOT/src/testing/testing.go:775 +0x21
  k8s.io/kubernetes/pkg/volume/csi.TestCSI_VolumeAll.func21.1()
      pkg/volume/csi/csi_test.go:313 +0x1a4
Previous write at 0x00c000e90ac3 by goroutine 875:
  testing.tRunner.func1()
      GOROOT/src/testing/testing.go:1113 +0x484
  testing.tRunner()
      GOROOT/src/testing/testing.go:1131 +0x22a
  testing.tRunner()
      GOROOT/src/testing/testing.go:1127 +0x202
Goroutine 1231 (running) created at:
  k8s.io/kubernetes/pkg/volume/csi.TestCSI_VolumeAll.func21()
      pkg/volume/csi/csi_test.go:307 +0xf05
  testing.tRunner()
      GOROOT/src/testing/testing.go:1127 +0x202
Goroutine 875 (running) created at:
  testing.(*T).Run()
      GOROOT/src/testing/testing.go:1178 +0x796
  k8s.io/kubernetes/pkg/volume/csi.TestCSI_VolumeAll()
      pkg/volume/csi/csi_test.go:223 +0xb2c
  testing.tRunner()
      GOROOT/src/testing/testing.go:1127 +0x202
==================
```

See also this comment:

07c1788357/src/testing/testing.go (L1141-L1142)

Noticed in:

https://github.com/kubernetes/kubernetes/pull/94449
https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/94449/pull-kubernetes-bazel-test/1304519003330318337
2020-09-11 22:19:42 -07:00
Jayasekhar Konduru
2a89577659 CSI: Modify VolumeAttachment check to use Informer/Cache
Change-Id: Ie70c8b6657c67eefbf13042f36d56ca84a2e42bb
2020-06-11 10:34:09 -07:00
Mark Janssen
2c61627f8c Fix staticcheck failures for pkg/volume/...
Errors from staticcheck:
pkg/volume/azure_dd/azure_common.go:68:2: var winDiskNumFormat is unused (U1000)
pkg/volume/csi/csi_block.go:97:2: field volumeInfo is unused (U1000)
pkg/volume/csi/csi_block_test.go:56:6: func prepareBlockUnmapperTest is unused (U1000)
pkg/volume/csi/csi_client.go:108:2: const initialDuration is unused (U1000)
pkg/volume/csi/csi_client.go:109:2: const factor is unused (U1000)
pkg/volume/csi/csi_client.go:110:2: const steps is unused (U1000)
pkg/volume/csi/csi_client_test.go:83:8: this value of err is never used (SA4006)
pkg/volume/csi/csi_mounter.go:76:2: field options is unused (U1000)
pkg/volume/csi/csi_mounter_test.go:454:13: this value of err is never used (SA4006)
pkg/volume/csi/csi_plugin_test.go:766:16: this value of err is never used (SA4006)
pkg/volume/csi/csi_plugin_test.go:861:13: this value of err is never used (SA4006)
pkg/volume/csi/csi_plugin_test.go:1186:13: this value of err is never used (SA4006)
pkg/volume/csi/csi_plugin_test.go:1249:13: this value of err is never used (SA4006)
pkg/volume/csi/csi_test.go:305:5: the goroutine calls T.Fatalf, which must be called in the same goroutine as the test (SA2002)
pkg/volume/flexvolume/probe_test.go:67:10: this value of err is never used (SA4006)
pkg/volume/iscsi/iscsi_test.go:95:2: field attachCalled is unused (U1000)
pkg/volume/iscsi/iscsi_test.go:96:2: field detachCalled is unused (U1000)
pkg/volume/iscsi/iscsi_test.go:501:24: this value of err is never used (SA4006)
pkg/volume/iscsi/iscsi_util_test.go:159:2: this value of exist is never used (SA4006)
pkg/volume/local/local.go:351:57: argument devicePath is overwritten before first use (SA4009)
pkg/volume/plugins_test.go:119:2: this value of plug is never used (SA4006)
pkg/volume/plugins_test.go:125:2: this value of plug is never used (SA4006)
pkg/volume/quobyte/quobyte.go:474:23: this result of append is never used, except maybe in other appends (SA4010)
pkg/volume/quobyte/quobyte.go:477:23: this result of append is never used, except maybe in other appends (SA4010)
pkg/volume/quobyte/quobyte.go:480:23: this result of append is never used, except maybe in other appends (SA4010)
pkg/volume/rbd/rbd.go:886:2: field adminSecret is unused (U1000)
pkg/volume/rbd/rbd.go:887:2: field adminID is unused (U1000)
pkg/volume/rbd/rbd.go:888:2: field imageFormat is unused (U1000)
pkg/volume/rbd/rbd.go:889:2: field imageFeatures is unused (U1000)
pkg/volume/storageos/storageos.go:302:2: field secretName is unused (U1000)
pkg/volume/storageos/storageos_util_test.go:43:2: field apiAddr is unused (U1000)
pkg/volume/storageos/storageos_util_test.go:44:2: field apiUser is unused (U1000)
pkg/volume/storageos/storageos_util_test.go:45:2: field apiPass is unused (U1000)
pkg/volume/storageos/storageos_util_test.go:46:2: field apiVersion is unused (U1000)
pkg/volume/util/atomic_writer_test.go:756:49: argument err is overwritten before first use (SA4009)
pkg/volume/util/fsquota/common/quota_linux_common.go:37:2: const acct is unused (U1000)
pkg/volume/util/fsquota/common/quota_linux_common.go:38:2: const enforcing is unused (U1000)
pkg/volume/util/fsquota/project.go:168:31: identical expressions on the left and right side of the '==' operator (SA4000)
pkg/volume/util/fsquota/quota_linux.go:306:50: argument poduid is overwritten before first use (SA4009)
pkg/volume/util/fsquota/quota_linux_test.go:558:16: this value of err is never used (SA4006)
pkg/volume/util/subpath/subpath_linux.go:232:81: argument err is overwritten before first use (SA4009)
pkg/volume/util/subpath/subpath_linux_test.go:579:73: argument err is overwritten before first use (SA4009)
2020-04-09 22:08:07 +02:00
Christian Huffman
c6fd25d100 Updated CSIDriver references 2020-03-06 08:21:26 -05:00
Yuki Ueda
d1bc1875aa Move 'path' package usage to 'path/filepath' 2020-02-05 14:29:27 +09: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
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
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
Robert Krawitz
5b97b2860d Change fsGroup to mounterArgs in volume.SetUp() to allow for future extension. 2019-05-29 15:12:28 -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
d564d2e74d CSI - Prevents unsupported device mount with CanMountDevice(spec) check 2019-04-18 19:54:28 -04:00