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

Use k8s mount-utils for checking volume resize #1165

Merged
merged 1 commit into from
Jun 27, 2022
Merged

Use k8s mount-utils for checking volume resize #1165

merged 1 commit into from
Jun 27, 2022

Conversation

RomanBednar
Copy link
Contributor

Is this a bug fix or adding new feature?
Refactoring only.

What is this PR about? / Why do we need it?
There was some copy-pasted code from mount utils to get it early. It was needed to check if volume needs resizing.
The code is already released in kuberenes/mount-utils so the copy-pasted code should be removed.

What testing is done?
This is what I did to verify the resize still works fine and did not break:

  1. Prepare at least one snapshot of a claim (size 1G in the example)
$ oc get volumesnapshots
NAME                READYTOUSE   SOURCEPVC   SOURCESNAPSHOTCONTENT   RESTORESIZE   SNAPSHOTCLASS   SNAPSHOTCONTENT                                    CREATIONTIME   AGE
claim-1-snapshot    true         claim-1                             1Gi           csi-aws-vsc     snapcontent-20720ba2-4a60-441e-85c7-7691eab875d5   75m            75m
claim-1-snapshot2   true         claim-1                             1Gi           csi-aws-vsc     snapcontent-90b37edb-3c92-4170-b5dc-1de36fc13b30   2m24s          3m3s
  1. Create and verify a new larger pvc using a snapshot as a source (can be easily done from dashboard - VolumeSnapshots - details - actions - Restore as new PVC)
$ oc get pvc
NAME                        STATUS    VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
claim-1                     Bound     pvc-8526e671-60da-4ec3-91cd-b64a0a958f7b   1Gi        RWO            gp2-csi        78m
claim-1-snapshot2-restore   Pending                                                                        gp2-csi        76s

$ oc get pvc/claim-1-snapshot2-restore -o yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  creationTimestamp: "2022-02-10T12:04:44Z"
  finalizers:
  - kubernetes.io/pvc-protection
  name: claim-1-snapshot2-restore
  namespace: default
  resourceVersion: "62525"
  uid: 07cdce09-1e33-4652-8b17-1d2d1188a0fa
spec:
  accessModes:
  - ReadWriteOnce
  dataSource:
    apiGroup: snapshot.storage.k8s.io
    kind: VolumeSnapshot
    name: claim-1-snapshot2
  resources:
    requests:
      storage: 5Gi
  storageClassName: gp2-csi
  volumeMode: Filesystem
status:
  phase: Pending
  1. create a pod using newly created claim with a mount and verify disk size on node
# lsblk | grep pvc-07cdce09-1e33-4652-8b17-1d2d1188a0fa/mount
nvme2n1     259:6    0     5G  0 disk /var/lib/kubelet/pods/563f6c06-65a1-47e1-9c45-27cd7fd368bd/volumes/kubernetes.io~csi/pvc-07cdce09-1e33-4652-8b17-1d2d1188a0fa/mount
  1. verify the size was extended accordingly inside of a pod
$ oc get pvc/claim-1-snapshot2-restore -o json | jq '.status.capacity.storage'
"5Gi"

$ oc exec example3 -- /bin/sh -c 'df -h | grep mnt'
/dev/nvme2n1    4.9G   20M  4.9G   1% /mnt/test

@k8s-ci-robot
Copy link
Contributor

Welcome @RomanBednar!

It looks like this is your first PR to kubernetes-sigs/aws-ebs-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-ebs-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 10, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @RomanBednar. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 10, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 5, 2022
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 19, 2022
@RomanBednar
Copy link
Contributor Author

/assign @wongma7

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 20, 2022
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 6, 2022
@RomanBednar
Copy link
Contributor Author

@wongma7 Hello Matthew, can you please review?

@wongma7
Copy link
Contributor

wongma7 commented Jun 27, 2022

/ok-to-test
/lgtm
/approve

THX!!

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 27, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RomanBednar, torredil, wongma7

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

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

None yet

4 participants