Commit Graph

44 Commits

Author SHA1 Message Date
Cheng Xing
794a925a85 Pass FsGroup to NodeStageVolume 2021-07-03 16:29:42 -07:00
Cheng Xing
ae5668edef Pass FsGroup to NodePublishVolume 2021-07-03 16:29:42 -07:00
Niels de Vos
b997e0e4d6 Add SupportsMetrics() for Block-mode volumes
Volumes that are provisioned with `VolumeMode: Block` often have a
MetrucsProvider interface declared in their type. However, the
MetricsProvider should implement a GetMetrics() function. In the cases
where the storage drivers do not implement GetMetrics(), a panic can
occur.

Usual type-assertions are not sufficient in this case. All assertions
assume the interface is present. There is no straight forward way to
verify that a valid GetMetrics() function is provided.

By adding SupportsMetrics(), storage driver implementations require
careful reviewing for metrics support.
2021-05-20 17:10:23 +02:00
Niels de Vos
e99ced3114 Add support for gethering metrics from CSI block-mode volumes 2021-04-22 08:36:20 +02:00
phantooom
82c2266f25 chore: make csi getPodInfoAttrs func private 2021-04-15 20:51:51 +08:00
phantooom
31aa15284f kubelet: fix raw block mode CSI NodePublishVolume stage miss pod info 2021-02-21 23:46:50 +08:00
drfish
d7fbf44361 Remove CSIDriverRegistry, BlockVolume and CSIBlockVolume feature flags 2021-02-19 23:40:28 +08:00
Jiawei Wang
43bc6fa806 Add csi_operations_seconds metrics on kubelet 2021-02-17 13:38:27 -08:00
Hemant Kumar
6342dad709 Ensure that StagingPath is supplied to blockVolume expansion 2020-07-01 12:21:17 -04:00
Hemant Kumar
75e13e370e Supply staging path for block expansion 2020-07-01 11:34:31 -04:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04: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
Jan Safranek
f6fc73573c Call NodeUnpublish after NodePublish timeout
When NodePublish times out and user deletes corresponding pod, the driver
may continue publishing the volume. In order to "cancel" this operation,
Kubernetes must issue NodeUnpublish and wait until it finishes.

Therefore, NodeUnpublish should be called even if the target directory
(created by the driver) does not exist yet.
2020-03-02 12:54:02 +01:00
Jan Safranek
86a5bd98b6 Add uncertain map state to block volumes
Volume mount should be marked as uncertain after NodeStage / NodePublish
timeout or similar error, when the driver can continue with the operation in
background.
2020-03-02 12:54:02 +01:00
Jan Safranek
073d0b2340 Add getPublishDir and getVolumePluginDir
So we don't need to compute these backwards from getPublishPath and
getVolumeDevicePluginDir.
2020-02-17 10:51:39 +01:00
Jan Safranek
0bd2e629c7 Fix unit tests 2020-02-13 12:20:03 +01:00
Jan Safranek
e2d8e575f0 Add CSI block volume directory cleanup
CSI volume plugin creates number of files/directories when processing block
volumes. These files must be cleaned when the plugin is done with the
volume, i.e. at the end on TearDownDevice().
2020-02-13 12:19:31 +01:00
Mike Danese
3aa59f7f30 generated: run refactor 2020-02-07 18:16:47 -08:00
Masaki Kimura
4578c6c8ce Separate staging/publish and unstaging/unpublish logics for block 2019-11-15 01:55:20 +00:00
Masaki Kimura
7caf731773 Change publish path for CSI block volume per pod
This change is to allow CSI driver to publish the same volume for multipe pods on the same node.
2019-11-15 01:55:15 +00:00
Masaki Kimura
f363a03f0b Refactor BlockVolumeMapper and BlockVolumeUnmapper interface
- Rename MapDevice to MapPodDevice in BlockVolumeMapper
- Add UnmapPodDevice in BlockVolumeUnmapper (This will be used by csi driver later)
- Add CustomBlockVolumeMapper and CustomBlockVolumeUnmapper interface
- Move SetUpDevice and MapPodDevice to CustomBlockVolumeMapper
- Move TearDownDevice and UnmapPodDevice to CustomBlockVolumeUnmapper
- Implement CustomBlockVolumeMapper only in local and csi plugin
- Implement CustomBlockVolumeUnmapper only in fc, iscsi, rbd, and csi plugin
- Change MapPodDevice to return path and SetUpDevice not to return path
2019-11-14 22:01:11 +00:00
Masaki Kimura
8a159d7253 Move MapBlockVolume call to operation_generator and add UnmapBlockVolume 2019-11-14 15:58:26 +00:00
David Zhu
8970ec8fa7
Revert "Bugfix: remove PV dir when umount raw block device" 2019-10-01 15:14:35 -07:00
Kubernetes Prow Robot
a392897dec
Merge pull request #79784 from cwdsuzhou/July/RemoveDeviceVolumeDir
Bugfix: remove PV dir when umount raw block device
2019-09-27 02:03:36 -07:00
caiweidong
f30a549eb8 Bugfix: remove PV dir when umount raw block device 2019-09-26 19:46:42 +08:00
ethan
d26e352fe7 cleanup: remove package csi duplicated error log
return err directly in func; delete new line in error message

cleanup: use errors.New(log()) to uniform error message
2019-08-05 20:35:28 +08:00
David Zhu
831cd29f4e Add passthrough for MountOptions for NodeStageVolume for CSI 2019-07-16 16:17:47 -07:00
caiweidong
0c628e101a Bugfix: csi raw block that does not need attach mounted failed
Add unit test

fix verify-test-featurefates failed
2019-07-15 10:34:12 +08:00
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
Yecheng Fu
fa926ed6e0 Delay CSI client initialization 2019-03-09 13:45:03 +08:00
Andrew Kim
01933b02a3 replace usage of v1beta1 VolumeAttachments with v1 2019-02-27 15:42:12 -05:00
David Zhu
5dde1df1cd Migration shim logic for Persistent Volumes for Attach/Detach 2019-02-14 17:04:23 -08:00
danielqsj
657a1a1a34 change import alias of utils/strings 2019-01-30 10:44:09 +08:00
danielqsj
093328e57f migrate to k8s.io/utils/strings 2019-01-30 10:24:00 +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
saad-ali
2b44ec5e9c Reduce csipb dependencies
Remove csipb dependency from everywhere except the CSI client in
preperation for supporting multiple CSI clients.
2018-11-21 18:37:31 -08:00
Masaki Kimura
9c56b53390 Fix the comment for csi block pathes to make look the same to filesystem 2018-11-15 23:26:19 +00:00
Masaki Kimura
6d7b5f1d1b Delegate creation of publishPath to driver and allow creating device file directly 2018-11-15 01:14:12 +00:00
Masaki Kimura
d8c6fe5202 Change stagingPath to be a directory 2018-11-14 20:53:28 +00:00
Masaki Kimura
f0354ad605 Fix for adding block volume support to CSI RBD driver 2018-11-14 19:20:56 +00:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Ben Swartzlander
65d3beb820 Add support for mount options to CSI drivers 2018-10-11 13:39:19 -04:00
Vladimir Vivien
6553e2c849 CSI block fix for mapping path 2018-06-18 12:46:07 -04:00
Vladimir Vivien
5044a3d12c CSI implementation of raw block volume support 2018-06-05 16:53:56 -04:00