Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable volume expansion for migrated volumes #301

Merged

Conversation

divyenpatel
Copy link
Member

@divyenpatel divyenpatel commented Aug 4, 2020

What this PR does / why we need it:
This PR is disabling volume expansion for migrated volumes.

Which issue this PR fixes
fixes #300

Special notes for your reviewer:

Testing done

Unit Test

=== RUN   TestMigratedExtendVolume
{"level":"info","time":"2020-08-07T12:45:21.721805-07:00","caller":"vanilla/controller.go:758","msg":"ControllerExpandVolume: called with args {VolumeId:[vsanDatastore] 08281a5f-a21d-1eff-62d6-02009d0f19a1/004dbb1694f14e3598abef852b113e3b.vmdk CapacityRange:required_bytes:1024  Secrets:map[] VolumeCapability:<nil> XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}","TraceId":"7b8be6d6-1fd1-462b-84f2-8a053cb525bc"}
{"level":"error","time":"2020-08-07T12:45:21.721817-07:00","caller":"vanilla/controller.go:762","msg":"Cannot expand migrated vSphere volume. :\"[vsanDatastore] 08281a5f-a21d-1eff-62d6-02009d0f19a1/004dbb1694f14e3598abef852b113e3b.vmdk\"","TraceId":"7b8be6d6-1fd1-462b-84f2-8a053cb525bc","stacktrace":"sigs.k8s.io/vsphere-csi-driver/pkg/csi/service/vanilla.(*controller).ControllerExpandVolume\n\t/Users/divyenp/go/src/github.com/divyenpatel/vsphere-csi-driver/pkg/csi/service/vanilla/controller.go:762\nsigs.k8s.io/vsphere-csi-driver/pkg/csi/service/vanilla.TestMigratedExtendVolume\n\t/Users/divyenp/go/src/github.com/divyenpatel/vsphere-csi-driver/pkg/csi/service/vanilla/controller_test.go:535\ntesting.tRunner\n\t/usr/local/go/src/testing/testing.go:909"}
--- PASS: TestMigratedExtendVolume (0.00s)
    controller_test.go:534: ControllerExpandVolume will be called with req +{[vsanDatastore] 08281a5f-a21d-1eff-62d6-02009d0f19a1/004dbb1694f14e3598abef852b113e3b.vmdk required_bytes:1024  map[] <nil> {} [] 0}
    controller_test.go:537: Expected error received. migrated volume with VMDK path can not be expanded

E2E Test Manual

  1. upgraded csi-translation-lib in the external resizer to include vSphere translation library and build it locally.
  2. Deployed CSI driver using this locally build resizer.
  3. verified volume expansion is not permitted for migrated volume.
# kubectl describe pvc
Name:          vcppvc
Namespace:     default
StorageClass:  vcpsc
Status:        Bound
Volume:        pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68
Labels:        <none>
Annotations:   pv.kubernetes.io/bind-completed: yes
               pv.kubernetes.io/bound-by-controller: yes
               pv.kubernetes.io/migrated-to: csi.vsphere.vmware.com
               volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
               volume.kubernetes.io/storage-resizer: csi.vsphere.vmware.com
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      2Gi
Access Modes:  RWO
VolumeMode:    Filesystem
Mounted By:    <none>
Conditions:
  Type       Status  LastProbeTime                     LastTransitionTime                Reason  Message
  ----       ------  -----------------                 ------------------                ------  -------
  Resizing   True    Mon, 01 Jan 0001 00:00:00 +0000   Tue, 04 Aug 2020 12:58:45 -0700           
Events:
  Type     Reason                 Age              From                                     Message
  ----     ------                 ----             ----                                     -------
  Normal   ProvisioningSucceeded  2m59s            persistentvolume-controller              Successfully provisioned volume pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68 using kubernetes.io/vsphere-volume
  Normal   ExternalExpanding      5s               volume_expand                            CSI migration enabled for kubernetes.io/vsphere-volume; waiting for external resizer to expand the pvc
  Normal   Resizing               2s (x3 over 5s)  external-resizer csi.vsphere.vmware.com  External resizer is resizing volume pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68
  Warning  VolumeResizeFailed     2s (x3 over 5s)  external-resizer csi.vsphere.vmware.com  resize volume pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68 failed: rpc error: code = Unimplemented desc = Cannot expand in-tree volume. :"[vsanDatastore] 56631b5f-627a-7a01-5b88-02009d31bab6/kubernetes-dynamic-pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68.vmdk"

Controller Logs

2020-08-04T20:00:49.800518381Z 2020-08-04T20:00:49.797Z INFO vanilla/controller.go:758 ControllerExpandVolume: called with args {VolumeId:[vsanDatastore] 56631b5f-627a-7a01-5b88-02009d31bab6/kubernetes-dynamic-pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68.vmdk CapacityRange:required_bytes:3221225472 Secrets:map[] VolumeCapability:mount:<fs_type:"ext4" > access_mode:<mode:SINGLE_NODE_WRITER > XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0} {"TraceId": "2e294a6d-1636-4b5c-8258-415eb824a308"}

2020-08-04T20:00:49.800576742Z 2020-08-04T20:00:49.797Z DEBUG k8sorchestrator/k8sorchestrator.go:162 Feature: csi-migration state is set to true {"TraceId": "2e294a6d-1636-4b5c-8258-415eb824a308"}

2020-08-04T20:00:49.800652495Z 2020-08-04T20:00:49.797Z ERROR vanilla/controller.go:768 Cannot expand in-tree volume. :"[vsanDatastore] 56631b5f-627a-7a01-5b88-02009d31bab6/kubernetes-dynamic-pvc-aadea07e-9e59-40a9-b9a8-62b9e5c0de68.vmdk" {"TraceId": "2e294a6d-1636-4b5c-8258-415eb824a308"}

Release note:

disable volume expansion for migrated volumes

@xing-yang @SandeepPissay @chethanv28 Can you reviwe this PR?

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 4, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: divyenpatel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 4, 2020
@svcbot-qecnsdp
Copy link

Can one of the admins verify this patch?

@divyenpatel divyenpatel force-pushed the disable-volume-expansion branch 2 times, most recently from 5163b13 to aa76ff2 Compare August 4, 2020 23:46
@divyenpatel
Copy link
Member Author

/retest

@SandeepPissay
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 7, 2020
@k8s-ci-robot k8s-ci-robot merged commit 165f4eb into kubernetes-sigs:master Aug 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-2.1.0-candidate release-2.1.0-cherry-picked size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

disable volume expansion for migrated volumes
6 participants