diff --git a/examples/kubernetes/static-provisioning/README.md b/examples/kubernetes/static-provisioning/README.md new file mode 100644 index 0000000000..c194027a11 --- /dev/null +++ b/examples/kubernetes/static-provisioning/README.md @@ -0,0 +1,52 @@ +# Static Provisioning +This example shows how to create and consume persistence volume from exising EBS using static provisioning. + +## Usage +1. Edit the PersistentVolume spec in [example manifest](./specs/example.yaml). Update `volumeHandle` with EBS volume ID that you are going to use, and update the `fsType` with the filesystem type of the volume. In this example, I have a pre-created EBS volume in us-east-1c availability zone and it is formatted with xfs filesystem. + +``` +apiVersion: v1 +kind: PersistentVolume +metadata: + name: test-pv +spec: + capacity: + storage: 50Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + storageClassName: ebs-sc + csi: + driver: ebs.csi.aws.com + volumeHandle: {volumeId} + fsType: xfs + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: topology.ebs.csi.aws.com/zone + operator: In + values: + - us-east-1c +``` +Note that node affinity is used here since EBS volume is created in us-east-1c, hence only node in the same AZ can consume this persisence volume. + +2. Deploy the example: +```sh +kubectl apply -f specs/ +``` + +3. Verify application pod is running: +```sh +kubectl describe po app +``` + +4. Validate the pod successfully wrote data to the volume: +```sh +kubectl exec -it app cat /data/out.txt +``` + +5. Cleanup resources: +```sh +kubectl delete -f specs/ +``` diff --git a/examples/kubernetes/static-provisioning/specs/example.yaml b/examples/kubernetes/static-provisioning/specs/example.yaml new file mode 100644 index 0000000000..40613d7ffc --- /dev/null +++ b/examples/kubernetes/static-provisioning/specs/example.yaml @@ -0,0 +1,61 @@ +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: ebs-sc +provisioner: ebs.csi.aws.com +volumeBindingMode: WaitForFirstConsumer +reclaimPolicy: Retain +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: test-pv +spec: + capacity: + storage: 50Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + storageClassName: ebs-sc + csi: + driver: ebs.csi.aws.com + volumeHandle: vol-05786ec9ec9526b67 + fsType: xfs + nodeAffinity: + required: + nodeSelectorTerms: + - matchExpressions: + - key: topology.ebs.csi.aws.com/zone + operator: In + values: + - us-east-1c +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: ebs-claim +spec: + accessModes: + - ReadWriteOnce + storageClassName: ebs-sc + resources: + requests: + storage: 50Gi +--- +apiVersion: v1 +kind: Pod +metadata: + name: app +spec: + containers: + - name: app + image: centos + command: ["/bin/sh"] + args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"] + volumeMounts: + - name: persistent-storage + mountPath: /data + volumes: + - name: persistent-storage + persistentVolumeClaim: + claimName: ebs-claim diff --git a/examples/kubernetes/storageclass/specs/example.yaml b/examples/kubernetes/storageclass/specs/example.yaml index 3052d12446..d966a1c1db 100644 --- a/examples/kubernetes/storageclass/specs/example.yaml +++ b/examples/kubernetes/storageclass/specs/example.yaml @@ -5,7 +5,7 @@ metadata: provisioner: ebs.csi.aws.com volumeBindingMode: WaitForFirstConsumer parameters: - fsType: xfs + csi.storage.k8s.io/fstype: xfs type: io1 iopsPerGB: "50" encrypted: "true" diff --git a/hack/run-e2e-test b/hack/run-e2e-test index 7425ea1a35..6e73e7f690 100755 --- a/hack/run-e2e-test +++ b/hack/run-e2e-test @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -uo pipefail +set -euo pipefail OS_ARCH=$(go env GOOS)-amd64 TEST_ID=$RANDOM @@ -47,6 +47,15 @@ chmod +x $KOPS_PATH helm::install +echo "Build and push test driver image" +eval $(aws ecr get-login --region $REGION --no-include-email) +AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) +IMAGE_TAG=$TEST_ID +IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/aws-ebs-csi-driver +docker build -t $IMAGE_NAME:$IMAGE_TAG . +docker push $IMAGE_NAME:$IMAGE_TAG + +set +e echo "Creating cluster $CLUSTER_NAME" CLUSTER_YAML_PATH=$TEST_DIR/$CLUSTER_NAME.yaml SSH_KEY_PATH=$TEST_DIR/id_rsa @@ -77,14 +86,6 @@ while [[ 1 ]]; do fi done; -# Push test driver image -eval $(aws ecr get-login --region $REGION --no-include-email) -AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text) -IMAGE_TAG=$TEST_ID -IMAGE_NAME=$AWS_ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/aws-ebs-csi-driver -docker build -t $IMAGE_NAME:$IMAGE_TAG . -docker push $IMAGE_NAME:$IMAGE_TAG - echo "Deploying driver" helm::init helm::wait_tiller diff --git a/pkg/cloud/cloud.go b/pkg/cloud/cloud.go index cedeeae375..47b89209bc 100644 --- a/pkg/cloud/cloud.go +++ b/pkg/cloud/cloud.go @@ -105,7 +105,6 @@ type Disk struct { VolumeID string CapacityGiB int64 AvailabilityZone string - FsType string } // DiskOptions represents parameters to create an EBS volume diff --git a/pkg/driver/constants.go b/pkg/driver/constants.go index bfb8fb755e..8464a616f6 100644 --- a/pkg/driver/constants.go +++ b/pkg/driver/constants.go @@ -25,9 +25,6 @@ const ( // constants of keys in volume parameters const ( - // FsTypeKey represents key for filesystem type - FsTypeKey = "fstype" - // VolumeTypeKey represents key for volume type VolumeTypeKey = "type" diff --git a/pkg/driver/controller.go b/pkg/driver/controller.go index 98be2c2a8e..5956adc382 100644 --- a/pkg/driver/controller.go +++ b/pkg/driver/controller.go @@ -103,7 +103,6 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol } var ( - fsType string volumeType string iopsPerGB int isEncrypted bool @@ -112,8 +111,8 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol for key, value := range req.GetParameters() { switch strings.ToLower(key) { - case FsTypeKey: - fsType = value + case "fstype": + klog.Warning("\"fstype\" is deprecated, please use \"csi.storage.k8s.io/fstype\" instead") case VolumeTypeKey: volumeType = value case IopsPerGBKey: @@ -136,7 +135,6 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol // volume exists already if disk != nil { - disk.FsType = fsType return newCreateVolumeResponse(disk), nil } @@ -172,7 +170,6 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol } return nil, status.Errorf(errCode, "Could not create volume %q: %v", volName, err) } - disk.FsType = fsType return newCreateVolumeResponse(disk), nil } @@ -488,9 +485,7 @@ func newCreateVolumeResponse(disk *cloud.Disk) *csi.CreateVolumeResponse { Volume: &csi.Volume{ VolumeId: disk.VolumeID, CapacityBytes: util.GiBToBytes(disk.CapacityGiB), - VolumeContext: map[string]string{ - FsTypeKey: disk.FsType, - }, + VolumeContext: map[string]string{}, AccessibleTopology: []*csi.Topology{ { Segments: map[string]string{TopologyKey: disk.AvailabilityZone}, diff --git a/pkg/driver/controller_test.go b/pkg/driver/controller_test.go index 98a0ad0535..4ed71ac051 100644 --- a/pkg/driver/controller_test.go +++ b/pkg/driver/controller_test.go @@ -35,7 +35,6 @@ import ( const ( expZone = "us-west-2b" - expFsType = "ext2" expInstanceId = "i-123456789abcdef01" ) @@ -67,18 +66,12 @@ func TestCreateVolume(t *testing.T) { VolumeCapabilities: stdVolCap, Parameters: nil, } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, - } ctx := context.Background() mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -150,7 +143,7 @@ func TestCreateVolume(t *testing.T) { expVol := &csi.Volume{ CapacityBytes: stdVolSize, VolumeId: "test-vol", - VolumeContext: map[string]string{FsTypeKey: ""}, + VolumeContext: map[string]string{}, } ctx := context.Background() @@ -158,7 +151,6 @@ func TestCreateVolume(t *testing.T) { mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -238,7 +230,6 @@ func TestCreateVolume(t *testing.T) { mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expFsType, } volSizeBytes, err := getVolSizeBytes(req) if err != nil { @@ -295,7 +286,7 @@ func TestCreateVolume(t *testing.T) { expVol := &csi.Volume{ CapacityBytes: cloud.DefaultVolumeSize, VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, + VolumeContext: map[string]string{}, } ctx := context.Background() @@ -303,7 +294,6 @@ func TestCreateVolume(t *testing.T) { mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(cloud.DefaultVolumeSize), } @@ -354,7 +344,7 @@ func TestCreateVolume(t *testing.T) { expVol := &csi.Volume{ CapacityBytes: 2147483648, // 1 GiB + 1 byte = 2 GiB VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, + VolumeContext: map[string]string{}, } ctx := context.Background() @@ -362,7 +352,6 @@ func TestCreateVolume(t *testing.T) { mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(expVol.CapacityBytes), } @@ -394,65 +383,6 @@ func TestCreateVolume(t *testing.T) { } }, }, - { - name: "success with fstype parameter", - testFunc: func(t *testing.T) { - req := &csi.CreateVolumeRequest{ - Name: "vol-test", - CapacityRange: stdCapRange, - VolumeCapabilities: stdVolCap, - Parameters: map[string]string{FsTypeKey: defaultFsType}, - } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: defaultFsType}, - } - - ctx := context.Background() - - mockDisk := &cloud.Disk{ - VolumeID: req.Name, - AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], - CapacityGiB: util.BytesToGiB(stdVolSize), - } - - mockCtl := gomock.NewController(t) - defer mockCtl.Finish() - - mockCloud := mocks.NewMockCloud(mockCtl) - mockCloud.EXPECT().GetDiskByName(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Eq(stdVolSize)).Return(nil, cloud.ErrNotFound) - mockCloud.EXPECT().CreateDisk(gomock.Eq(ctx), gomock.Eq(req.Name), gomock.Any()).Return(mockDisk, nil) - - awsDriver := controllerService{cloud: mockCloud} - - resp, err := awsDriver.CreateVolume(ctx, req) - if err != nil { - srvErr, ok := status.FromError(err) - if !ok { - t.Fatalf("Could not get error status code from error: %v", srvErr) - } - t.Fatalf("Unexpected error: %v", srvErr.Code()) - } - - vol := resp.GetVolume() - if vol == nil { - t.Fatalf("Expected volume %v, got nil", expVol) - } - - if vol.GetCapacityBytes() != expVol.GetCapacityBytes() { - t.Fatalf("Expected volume capacity bytes: %v, got: %v", expVol.GetCapacityBytes(), vol.GetCapacityBytes()) - } - - for expKey, expVal := range expVol.GetVolumeContext() { - ctx := vol.GetVolumeContext() - if gotVal, ok := ctx[expKey]; !ok || gotVal != expVal { - t.Fatalf("Expected volume context for key %v: %v, got: %v", expKey, expVal, gotVal) - } - } - }, - }, { name: "success with volume type io1", testFunc: func(t *testing.T) { @@ -465,18 +395,12 @@ func TestCreateVolume(t *testing.T) { IopsPerGBKey: "5", }, } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, - } ctx := context.Background() mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -509,18 +433,12 @@ func TestCreateVolume(t *testing.T) { VolumeTypeKey: cloud.VolumeTypeSC1, }, } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, - } ctx := context.Background() mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -553,18 +471,12 @@ func TestCreateVolume(t *testing.T) { EncryptedKey: "true", }, } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, - } ctx := context.Background() mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -598,18 +510,12 @@ func TestCreateVolume(t *testing.T) { KmsKeyIdKey: "arn:aws:kms:us-east-1:012345678910:key/abcd1234-a123-456a-a12b-a123b4cd56ef", }, } - expVol := &csi.Volume{ - CapacityBytes: stdVolSize, - VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: ""}, - } ctx := context.Background() mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } @@ -675,9 +581,7 @@ func TestCreateVolume(t *testing.T) { Name: "test-vol", CapacityRange: stdCapRange, VolumeCapabilities: stdVolCap, - Parameters: map[string]string{ - FsTypeKey: expFsType, - }, + Parameters: map[string]string{}, AccessibilityRequirements: &csi.TopologyRequirement{ Requisite: []*csi.Topology{ { @@ -690,9 +594,7 @@ func TestCreateVolume(t *testing.T) { Name: "test-vol", CapacityRange: stdCapRange, VolumeCapabilities: stdVolCap, - Parameters: map[string]string{ - FsTypeKey: expFsType, - }, + Parameters: map[string]string{}, AccessibilityRequirements: &csi.TopologyRequirement{ Requisite: []*csi.Topology{ { @@ -704,7 +606,7 @@ func TestCreateVolume(t *testing.T) { expVol := &csi.Volume{ CapacityBytes: stdVolSize, VolumeId: "vol-test", - VolumeContext: map[string]string{FsTypeKey: expFsType}, + VolumeContext: map[string]string{}, AccessibleTopology: []*csi.Topology{ { Segments: map[string]string{TopologyKey: expZone}, @@ -717,7 +619,6 @@ func TestCreateVolume(t *testing.T) { mockDisk := &cloud.Disk{ VolumeID: req.Name, AvailabilityZone: expZone, - FsType: expVol.VolumeContext[FsTypeKey], CapacityGiB: util.BytesToGiB(stdVolSize), } diff --git a/pkg/driver/node.go b/pkg/driver/node.go index 2d67b09c9c..bbcc7f3cb1 100644 --- a/pkg/driver/node.go +++ b/pkg/driver/node.go @@ -117,6 +117,15 @@ func (d *nodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol return &csi.NodeStageVolumeResponse{}, nil } + mount := volCap.GetMount() + if mount == nil { + return nil, status.Error(codes.InvalidArgument, "NodeStageVolume: mount is nil within volume capability") + } + fsType := mount.GetFsType() + if len(fsType) == 0 { + fsType = defaultFsType + } + if ok := d.inFlight.Insert(req); !ok { msg := fmt.Sprintf("request to stage volume=%q is already in progress", volumeID) return nil, status.Error(codes.Internal, msg) @@ -170,15 +179,8 @@ func (d *nodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol return &csi.NodeStageVolumeResponse{}, nil } - // Get fs type that the volume will be formatted with - attributes := req.GetVolumeContext() - fsType, exists := attributes[FsTypeKey] - if !exists || fsType == "" { - fsType = defaultFsType - } - // FormatAndMount will format only if needed - klog.V(5).Infof("NodeStageVolume: formatting %s and mounting at %s", source, target) + klog.V(5).Infof("NodeStageVolume: formatting %s and mounting at %s with fstype %s", source, target, fsType) err = d.mounter.FormatAndMount(source, target, fsType, nil) if err != nil { msg := fmt.Sprintf("could not format %q and mount it at %q", source, target) @@ -439,8 +441,13 @@ func (d *nodeService) nodePublishVolumeForFileSystem(req *csi.NodePublishVolumeR return status.Errorf(codes.Internal, "Could not create dir %q: %v", target, err) } - klog.V(5).Infof("NodePublishVolume: mounting %s at %s", source, target) - if err := d.mounter.Mount(source, target, "", mountOptions); err != nil { + fsType := mode.Mount.GetFsType() + if len(fsType) == 0 { + fsType = defaultFsType + } + + klog.V(5).Infof("NodePublishVolume: mounting %s at %s with option %s as fstype %s", source, target, mountOptions, fsType) + if err := d.mounter.Mount(source, target, fsType, mountOptions); err != nil { if removeErr := os.Remove(target); removeErr != nil { return status.Errorf(codes.Internal, "Could not remove mount target %q: %v", target, err) } diff --git a/pkg/driver/node_test.go b/pkg/driver/node_test.go index 7097545bfb..d5ea02bef8 100644 --- a/pkg/driver/node_test.go +++ b/pkg/driver/node_test.go @@ -37,7 +37,9 @@ func TestNodeStageVolume(t *testing.T) { devicePath = "/dev/fake" stdVolCap = &csi.VolumeCapability{ AccessType: &csi.VolumeCapability_Mount{ - Mount: &csi.VolumeCapability_MountVolume{}, + Mount: &csi.VolumeCapability_MountVolume{ + FsType: FSTypeExt4, + }, }, AccessMode: &csi.VolumeCapability_AccessMode{ Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, @@ -137,9 +139,17 @@ func TestNodeStageVolume(t *testing.T) { req := &csi.NodeStageVolumeRequest{ PublishContext: map[string]string{DevicePathKey: devicePath}, StagingTargetPath: targetPath, - VolumeCapability: stdVolCap, - VolumeContext: map[string]string{FsTypeKey: FSTypeExt3}, - VolumeId: "vol-test", + VolumeCapability: &csi.VolumeCapability{ + AccessType: &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: FSTypeExt3, + }, + }, + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + }, + VolumeId: "vol-test", } gomock.InOrder( @@ -550,7 +560,7 @@ func TestNodePublishVolume(t *testing.T) { } mockMounter.EXPECT().MakeDir(gomock.Eq(targetPath)).Return(nil) - mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(""), gomock.Eq([]string{"bind"})).Return(nil) + mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(defaultFsType), gomock.Eq([]string{"bind"})).Return(nil) req := &csi.NodePublishVolumeRequest{ PublishContext: map[string]string{DevicePathKey: devicePath}, @@ -566,6 +576,47 @@ func TestNodePublishVolume(t *testing.T) { } }, }, + { + name: "success fstype", + testFunc: func(t *testing.T) { + mockCtl := gomock.NewController(t) + defer mockCtl.Finish() + + mockMetadata := mocks.NewMockMetadataService(mockCtl) + mockMounter := mocks.NewMockMounter(mockCtl) + + awsDriver := &nodeService{ + metadata: mockMetadata, + mounter: mockMounter, + inFlight: internal.NewInFlight(), + } + + mockMounter.EXPECT().MakeDir(gomock.Eq(targetPath)).Return(nil) + mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(FSTypeXfs), gomock.Eq([]string{"bind"})).Return(nil) + + req := &csi.NodePublishVolumeRequest{ + PublishContext: map[string]string{DevicePathKey: devicePath}, + StagingTargetPath: stagingTargetPath, + TargetPath: targetPath, + VolumeCapability: &csi.VolumeCapability{ + AccessType: &csi.VolumeCapability_Mount{ + Mount: &csi.VolumeCapability_MountVolume{ + FsType: FSTypeXfs, + }, + }, + AccessMode: &csi.VolumeCapability_AccessMode{ + Mode: csi.VolumeCapability_AccessMode_SINGLE_NODE_WRITER, + }, + }, + VolumeId: "vol-test", + } + + _, err := awsDriver.NodePublishVolume(context.TODO(), req) + if err != nil { + t.Fatalf("Expect no error but got: %v", err) + } + }, + }, { name: "success readonly", testFunc: func(t *testing.T) { @@ -582,7 +633,7 @@ func TestNodePublishVolume(t *testing.T) { } mockMounter.EXPECT().MakeDir(gomock.Eq(targetPath)).Return(nil) - mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(""), gomock.Eq([]string{"bind", "ro"})).Return(nil) + mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(defaultFsType), gomock.Eq([]string{"bind", "ro"})).Return(nil) req := &csi.NodePublishVolumeRequest{ PublishContext: map[string]string{DevicePathKey: devicePath}, @@ -615,7 +666,7 @@ func TestNodePublishVolume(t *testing.T) { } mockMounter.EXPECT().MakeDir(gomock.Eq(targetPath)).Return(nil) - mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(""), gomock.Eq([]string{"bind", "test-flag"})).Return(nil) + mockMounter.EXPECT().Mount(gomock.Eq(stagingTargetPath), gomock.Eq(targetPath), gomock.Eq(defaultFsType), gomock.Eq([]string{"bind", "test-flag"})).Return(nil) req := &csi.NodePublishVolumeRequest{ PublishContext: map[string]string{DevicePathKey: "/dev/fake"}, diff --git a/tests/e2e/driver/ebs_csi_driver.go b/tests/e2e/driver/ebs_csi_driver.go index e6f7e38cd6..3c88d9d9c1 100644 --- a/tests/e2e/driver/ebs_csi_driver.go +++ b/tests/e2e/driver/ebs_csi_driver.go @@ -103,8 +103,8 @@ func (d *ebsCSIDriver) GetPersistentVolume(volumeID string, fsType string, size // GetParameters returns the parameters specific for this driver func GetParameters(volumeType string, fsType string, encrypted bool) map[string]string { parameters := map[string]string{ - "type": volumeType, - "fsType": fsType, + "type": volumeType, + "csi.storage.k8s.io/fstype": fsType, } if iops := IOPSPerGBForVolumeType(volumeType); iops != "" { parameters["iopsPerGB"] = iops