diff --git a/pkg/apis/core/types.go b/pkg/apis/core/types.go index a75ae941fa1..5280cae0d9f 100644 --- a/pkg/apis/core/types.go +++ b/pkg/apis/core/types.go @@ -575,7 +575,7 @@ type GCEPersistentDiskVolumeSource struct { PDName string // Filesystem type to mount. // Must be a filesystem type supported by the host operating system. - // Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + // Ex. "ext4", "xfs", "ntfs". // TODO: how do we prevent errors in the filesystem from compromising the machine // +optional FSType string diff --git a/pkg/volume/csi/csi_attacher.go b/pkg/volume/csi/csi_attacher.go index ec384de815d..1709bbac0f8 100644 --- a/pkg/volume/csi/csi_attacher.go +++ b/pkg/volume/csi/csi_attacher.go @@ -354,10 +354,6 @@ func (c *csiAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMo } fsType := csiSource.FSType - if len(fsType) == 0 { - fsType = defaultFSType - } - err = csi.NodeStageVolume(ctx, csiSource.VolumeHandle, publishVolumeInfo, diff --git a/pkg/volume/csi/csi_mounter.go b/pkg/volume/csi/csi_mounter.go index b6d86956d15..57700895d26 100644 --- a/pkg/volume/csi/csi_mounter.go +++ b/pkg/volume/csi/csi_mounter.go @@ -34,8 +34,6 @@ import ( "k8s.io/kubernetes/pkg/volume/util" ) -const defaultFSType = "ext4" - //TODO (vladimirvivien) move this in a central loc later var ( volDataKey = struct { @@ -177,9 +175,6 @@ func (c *csiMountMgr) SetUpAt(dir string, fsGroup *int64) error { } fsType := csiSource.FSType - if len(fsType) == 0 { - fsType = defaultFSType - } err = csi.NodePublishVolume( ctx, c.volumeID, diff --git a/pkg/volume/csi/csi_mounter_test.go b/pkg/volume/csi/csi_mounter_test.go index d1e942871d0..88b2b1a2d56 100644 --- a/pkg/volume/csi/csi_mounter_test.go +++ b/pkg/volume/csi/csi_mounter_test.go @@ -144,6 +144,12 @@ func TestMounterSetUp(t *testing.T) { if err := csiMounter.SetUp(&fsGroup); err != nil { t.Fatalf("mounter.Setup failed: %v", err) } + + //Test the default value of file system type is not overridden + if len(csiMounter.spec.PersistentVolume.Spec.CSI.FSType) != 0 { + t.Errorf("default value of file system type was overridden by type %s", csiMounter.spec.PersistentVolume.Spec.CSI.FSType) + } + path := csiMounter.GetPath() if _, err := os.Stat(path); err != nil { if os.IsNotExist(err) { diff --git a/staging/src/k8s.io/api/core/v1/types.go b/staging/src/k8s.io/api/core/v1/types.go index 99159ee75a6..8967c602c6e 100644 --- a/staging/src/k8s.io/api/core/v1/types.go +++ b/staging/src/k8s.io/api/core/v1/types.go @@ -635,7 +635,7 @@ type RBDVolumeSource struct { RBDImage string `json:"image" protobuf:"bytes,2,opt,name=image"` // Filesystem type of the volume that you want to mount. // Tip: Ensure that the filesystem type is supported by the host operating system. - // Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. + // Examples: "ext4", "xfs", "ntfs". // More info: https://kubernetes.io/docs/concepts/storage/volumes#rbd // TODO: how do we prevent errors in the filesystem from compromising the machine // +optional