@@ -107,9 +107,6 @@ const (
107107var _ controller.Provisioner = & csiProvisioner {}
108108
109109var (
110- accessType = & csi.VolumeCapability_Mount {
111- Mount : & csi.VolumeCapability_MountVolume {},
112- }
113110 // Each provisioner have a identify string to distinguish with others. This
114111 // identify string will be added in PV annoations under this key.
115112 provisionerIDKey = "storage.kubernetes.io/csiProvisionerIdentity"
@@ -361,9 +358,27 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
361358 return nil , err
362359 }
363360
361+ fsType := ""
362+ for k , v := range options .Parameters {
363+ switch strings .ToLower (k ) {
364+ case "fstype" :
365+ fsType = v
366+ }
367+ }
368+ if len (fsType ) == 0 {
369+ fsType = defaultFSType
370+ }
371+
364372 capacity := options .PVC .Spec .Resources .Requests [v1 .ResourceName (v1 .ResourceStorage )]
365373 volSizeBytes := capacity .Value ()
366374
375+ accessType := & csi.VolumeCapability_Mount {
376+ Mount : & csi.VolumeCapability_MountVolume {
377+ FsType : fsType ,
378+ MountFlags : options .MountOptions ,
379+ },
380+ }
381+
367382 // Get access mode
368383 volumeCaps := make ([]* csi.VolumeCapability , 0 )
369384 for _ , cap := range options .PVC .Spec .AccessModes {
@@ -502,24 +517,14 @@ func (p *csiProvisioner) Provision(options controller.VolumeOptions) (*v1.Persis
502517 return nil , capErr
503518 }
504519
505- fsType := ""
506- for k , v := range options .Parameters {
507- switch strings .ToLower (k ) {
508- case "fstype" :
509- fsType = v
510- }
511- }
512- if len (fsType ) == 0 {
513- fsType = defaultFSType
514- }
515-
516520 pv := & v1.PersistentVolume {
517521 ObjectMeta : metav1.ObjectMeta {
518522 Name : pvName ,
519523 },
520524 Spec : v1.PersistentVolumeSpec {
521525 PersistentVolumeReclaimPolicy : options .PersistentVolumeReclaimPolicy ,
522526 AccessModes : options .PVC .Spec .AccessModes ,
527+ MountOptions : options .MountOptions ,
523528 Capacity : v1.ResourceList {
524529 v1 .ResourceName (v1 .ResourceStorage ): bytesToGiQuantity (respCap ),
525530 },
0 commit comments