Commit Graph

63 Commits

Author SHA1 Message Date
Jan Safranek
e575e60ea4 Reconstruct SELinux mount option
When reconstructing volumes from disk after kubelet restart, reconstruct
also context=XYZ mount option and add it to the ActualStateOfWorld.
2022-11-08 11:17:38 +01: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
Kubernetes Prow Robot
a74e16fc81
Merge pull request #113306 from jsafrane/csidriver-setup
Move CSIDriver checks from NewMounter to SetUpAt
2022-10-26 17:08:43 -07:00
Jan Safranek
483fd45e8e Move fsGroupPolicy from NewMounter to SetUpAt
getFSGroupPolicy needs to get CSIDriver from the API server, which may not
be available during volume reconstruction at kubelet startup.
2022-10-25 11:10:11 +02: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
Jan Safranek
f76efd0400 Move CSI json file saving to SetUpAt()
When saving a json state file in NewMounter, we risk the json file will not
be cleaned when SetUpAt() fails. Move it to SetUpAt() instead.
2022-10-18 14:19:06 +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
cyclinder
6150737d11 remove feature gate GA for 1.25
Signed-off-by: cyclinder qifeng.guo@daocloud.io
2022-05-12 14:15:23 +08: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
卢振兴10069964
b3fea118dc code cleanup for pkg volume csi 2021-04-12 08:36:53 +08:00
Christian Huffman
3bcf407d2f Addresses nitpicks for FSGroupPolicy 2021-04-05 15:45:40 -04:00
wzshiming
bc3d9252bc Speed up pkg/volume/csi unit tests 2021-02-27 14:09:38 +08:00
Chris Henzie
12e85e0e1c Extend test CSI plugin constructor to support multiple volume host types 2021-02-23 16:54:18 -08:00
drfish
d7fbf44361 Remove CSIDriverRegistry, BlockVolume and CSIBlockVolume feature flags 2021-02-19 23:40:28 +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
195a5af23b Make volume attachment watch timeout configurable for csiAttacher 2021-01-06 16:11:39 -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
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
David Zhu
802fe12803 Remove plugin watching of deprecated directory {kubelet_root_dir}/plugins and support for CSI V0 in accordance with deprecation announcement in https://v1-13.docs.kubernetes.io/docs/setup/release/notes/ 2019-11-11 11:42:58 -08:00
haoshuwei
89a6533ef6 fix ineffassign 2019-09-09 11:34:21 +08:00
Patrick Ohly
599a9faf8d storage: make tests independent of CSIInlineVolume default
Some tests assumed instead of ensuring that the CSIInlineVolume
feature is disabled.
2019-08-28 05:32:44 +02: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
Kubernetes Prow Robot
4ce69dd32e
Merge pull request #80848 from cwdsuzhou/Aug/fix_ut
Fix some unreasonable places int csi ut
2019-08-01 03:30:14 -07:00
caiweidong
7b5dac03ce Fix some unreasonable places int csi ut 2019-08-01 14:19:11 +08:00
Patrick Ohly
555ff7ef10 CSI: allow drivers that can handle persistent and ephemeral volumes
The conceptual change is that the mode in which a volume gets handled
is derived from it's spec, not from the ability of the driver. In
practice, that is already how the code worked because it didn't
actually look at CSIDriver.Spec.Mode at all.

Therefore the code change itself is mostly just renaming "driver mode"
to "volume mode". In some places (CanDeviceMount, CanAttach) the
feature check that was used elsewhere seemed to be missing. Now their
code path for ephemeral volumes are also only entered if that feature
is enabled.

The sanity check whether a CSI driver is being used correctly still
needs to be implemented.

Related-to: https://github.com/kubernetes/kubernetes/issues/79624
2019-07-25 16:45:46 +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
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
Kubernetes Prow Robot
e0d39be7b5
Merge pull request #76785 from dims/typo-extra-space-in-fatalf-format-string
typo - extra space - in Fatalf format string
2019-05-06 14:01:39 -07:00
Kubernetes Prow Robot
b5c34d0c43
Merge pull request #74734 from codenrhoden/move-mountspath
Move MountsInGlobalPDPath from mount pkg to volume
2019-05-01 17:28:18 -07:00
Humble Chirammal
a3c1a6da02 Error message corrections
Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
2019-05-01 13:36:52 +05:30
Travis Rhoden
78d109e201 Always use filepath.Join instead of path.Join
This patch cleans up pkg/util/mount/* and pkg/util/volume/* to always
use filepath.Join instead of path.Join. filepath.Join is preferred
because path.Join can have issues on Windows.
2019-04-29 09:56:05 -06:00
Vladimir Vivien
d564d2e74d CSI - Prevents unsupported device mount with CanMountDevice(spec) check 2019-04-18 19:54:28 -04:00
Davanum Srinivas
22ffdc6063
typo - extra space - in Fatalf format string
Change-Id: Ifeff0ee29aa6ccdc4c3ebdd2a071cebfafaf937e
2019-04-18 14:42:21 -04: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
Yecheng Fu
fa926ed6e0 Delay CSI client initialization 2019-03-09 13:45:03 +08:00
Vladimir Vivien
923ad369c8 CSI Inline Volume - Kubelet/Driver code impl 2019-03-08 12:40:09 -05:00
Xing Yang
6265f4f78c CSINodeInfo/CSIDriver controller changes
This is the 2nd PR to move CSINodeInfo/CSIDriver APIs to
v1beta1 core storage APIs. It includes controller side changes.
It depends on the PR with API changes:
https://github.com/kubernetes/kubernetes/pull/73883
2019-03-04 16:41:58 -08:00
David Zhu
5dde1df1cd Migration shim logic for Persistent Volumes for Attach/Detach 2019-02-14 17:04:23 -08:00
Vladimir Vivien
0a653b3b80 Adds method CanAttach() to check plugin attachability 2019-02-08 08:04:15 -05:00
Hannes Hörl
84c46629c5 Refactor to use new csi.DriversList & csi.Driver 2019-01-25 12:23:28 +00:00
saad-ali
18050e308c Allow CSI Drivers suporting 0.x/1.x to use old dir
Allow drivers implmenting both CSI 0.x and 1.x to use the old volume
plugin directory in addition to the the new volume plugin directory.
2018-11-28 11:11:37 -08:00
saad-ali
aa8244beb5 Modify CSI to handle both 0.3 and 1.0
Modify the CSI volume plugin to handle CSI version 0.x as well as 1.x
2018-11-21 18:37:31 -08:00