Commit Graph

108 Commits

Author SHA1 Message Date
Jan Safranek
167d27a790 Save SELinux context both in MountDevice and SetUp
And make it feature gated in both places.
2022-11-08 18:10:51 +01:00
Fabio Bertinatto
b19172c58f Promote DelegateFSGroupToCSIDriver feature to GA 2022-11-04 07:26:17 -03:00
Kubernetes Prow Robot
7d9c0e0a78
Merge pull request #113411 from jsafrane/fix-selinux-context-mount
Fix SELinux context mount with unknown context
2022-10-31 17:00:44 -07:00
Jan Safranek
8dd3510032 Fix SELinux context mount with unknown context
Don't mount with SELinux mount option if kubelet does not know the SELinux
context, i.e. MounterArgs.SELinuxLabel is ""
2022-10-31 19:11:48 +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
Jonathan Dobson
5f774832a5 Move CSIInlineVolume feature to GA 2022-08-04 13:06:30 -06:00
Jan Safranek
5c90474f38 Add SELinux mount support to CSI driver
With some minor refactoring to use common getCSIDriver function.
2022-08-04 10:51:45 +02:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Jonathan Dobson
88a1962e56 CSI inline volumes should support fsGroup 2022-03-11 16:14:06 -07:00
Kubernetes Prow Robot
06e107081e
Merge pull request #104732 from mengjiao-liu/remove-flag-experimental-check-node-capabilities-before-mount
kubelet: Remove the deprecated flag `--experimental-check-node-capabilities-before-mount`
2022-02-24 07:56:30 -08:00
Jan Safranek
525b8e5cd6 Rename SupportsSELinux to SELinuxRelabel
The field in fact says that the container runtime should relabel a volume
when running a container with it, it does not say that the volume supports
SELinux. For example, NFS can support SELinux, but we don't want NFS
volumes relabeled, because they can be shared among several Pods.
2022-02-16 10:54:08 +01:00
Mengjiao Liu
beda4cafb6 kubelet: Remove the deprecated flag --experimental-check-node-capabilities-before-mount 2022-01-06 11:47:11 +08:00
Kubernetes Prow Robot
7b9f4f18fe
Merge pull request #105135 from astraw99/fix-nil-mergeMap
Fix nil check in map merge
2021-11-12 02:26:27 -08:00
astraw99
9fe2c30609 fix nil merge map 2021-11-11 10:56:55 +08:00
Jan Safranek
186810eb47 Don't guess SELinux support on error
When GetSELinuxSupport() fails, don't assume a mounted filesystem does not
support SELinux at all. Try again instead in the next SetUp retry.

This may hurt performance a bit, since kubelet will call NodePublishVolume
again, but it's better than providing wrong information to the container
runtime that will then skip relabeling of the volume.
2021-10-27 12:00:07 +02:00
astraw99
5e789f157c fix CSI mount log 2021-10-14 10:27:50 +08:00
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
ae5668edef Pass FsGroup to NodePublishVolume 2021-07-03 16:29:42 -07:00
Shihang Zhang
8231a3e921 CSIServiceAccountToken ga 2021-06-21 11:35:24 -07:00
Shiming Zhang
c065d7c7b3 Fix NPE for CSI mounter 2021-06-08 10:29:46 +08:00
Jonathan Dobson
260426bf44 clarify deprecation comment 2021-04-27 17:52:40 -06:00
Jonathan Dobson
75a7966414 move deprecation comment to TearDownAt function 2021-04-27 11:40:12 -06:00
Jonathan Dobson
e92dc8d9be Deprecate removal of CSI nodepublish path by kubelet (#101332) 2021-04-27 08:41:47 -06: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
Jiawei Wang
43bc6fa806 Add csi_operations_seconds metrics on kubelet 2021-02-17 13:38:27 -08:00
Shihang Zhang
d2859cd89b plumb service account token down to csi driver 2020-11-12 09:26:43 -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
jornshen
db53ca01da change plugin name in fsgroupapplymetrics of csi and flexvolume to
distinguish different driver
2020-11-04 16:28:28 +08:00
jornshen
4ed7709774 Report a metric for time taken to perform recursive permission change 2020-10-26 21:04:30 +08:00
Srini Brahmaroutu
fbe5daed73 Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
Hemant Kumar
ade2f83685 Simplify the code 2020-07-11 23:29:24 -04:00
Christian Huffman
58bd3e5230 Include CSIDriver SupportsFsGroup 2020-07-11 23:29:24 -04:00
Kubernetes Prow Robot
14c69640d0
Merge pull request #87166 from jingxu97/Jan/mountcheckfix
Fix issue in kubelet getMountedVolumePathListFromDisk
2020-06-25 09:45:39 -07:00
Jing Xu
7012994a61 Fix issue in kubelet getMountedVolumePathListFromDisk
This PR fixes issue #74650. It adds the extra check for /mount dir under
pod volume dir. It also adds the unit test for this function
2020-06-22 10:00:43 -07: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
andyzhangx
8d5c65b8cd fix: comments(only create parent dir) 2020-04-21 07:15:02 +00: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
Hemant Kumar
c52d4bf32f Implement changes into volume plugins for skipping chown
Add a separate function for walking directories
2020-03-04 21:23:31 -05:00
andyzhangx
b3a27c44bf fix comments 2020-03-04 11:33:06 +00:00
andyzhangx
0c81a2f6b0 fix: ignore dir check in csi node stage/publish 2020-03-03 11:55:48 +00:00
andyzhangx
5a6435ad76 fix: corrupted mount point in csi driver
add test

fix build failure and bazel

fix golint
2020-02-26 09:43:51 +00:00
Krishnakumar R(KK)
72fe307b35 Move 'path' package usage to 'path/filepath'.
In case of windows, the path package functions such as 'Dir' returns faulty directory path.
For eg: 'path.Dir' on 'c:\var\lib\kubelet\pods' returns '.', where as the result should
have been 'c:\var\lib\kubelet'. The filepath package returns the right values.
2020-01-30 15:53:18 -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
309c6f863a Handle the case of remounts correctly 2019-12-02 12:09:38 -05:00