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

Add E2E tests for modifying volumes via annotations #1846

Conversation

AndrewSirenko
Copy link
Contributor

@AndrewSirenko AndrewSirenko commented Nov 24, 2023

Is this a bug fix or adding new feature?
Test-coverage

What is this PR about? / Why do we need it?
Note: This PR has been rebased since merging #1845

The purposes of each commit exclusive to this PR are:

What testing is done?
Running E2E tests locally with volume-modifier-for-k8s deployed while manually confirming state of K8s objects and EBS volumes.

❯ ginkgo --focus='modify-volume' -p
Running Suite: AWS EBS CSI Driver End-to-End Tests - /workplace/andsirey/aws-ebs-csi-driver/tests/e2e
==========================
Random Seed: 1700859607

Will run 7 of 51 specs
Running in parallel across 15 processes
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS•••••••

Ran 7 of 51 Specs in 93.699 seconds
SUCCESS! -- 7 Passed | 0 Failed | 0 Pending | 44 Skipped

Example verbose output of a test:

❯ ginkgo --focus='modify-volume' -v
  W1124 21:04:10.564530   27551 test_context.go:509] Unable to find in-cluster config, using default host : https://127.0.0.1:6443
  Nov 24 21:04:10.564: INFO: The --provider flag is not set. Continuing as if --provider=skeleton had been used.
Running Suite: AWS EBS CSI Driver End-to-End Tests - /workplace/andsirey/aws-ebs-csi-driver/tests/e2e
=====================================================================================================
Random Seed: 1700859846

Will run 7 of 51 specs
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
------------------------------
[ebs-csi-e2e] [single-az] [modify-volume] Modifying a PVC from io2 to gp3 with larger size and new iops and throughput annotations will modify associated PV and EBS Volume
/workplace/andsirey/aws-ebs-csi-driver/tests/e2e/modify_volume.go:127
  STEP: Creating a kubernetes client @ 11/24/23 21:04:10.566
  Nov 24 21:04:10.566: INFO: >>> kubeConfig: /home/andsirey/.kube/config
  STEP: Building a namespace api object, basename ebs @ 11/24/23 21:04:10.568
  STEP: Waiting for a default service account to be provisioned in namespace @ 11/24/23 21:04:11.947
  STEP: Waiting for kube-root-ca.crt to be provisioned in namespace @ 11/24/23 21:04:12.07
  STEP: setting up pvc @ 11/24/23 21:04:12.193
  STEP: setting up the StorageClass @ 11/24/23 21:04:12.194
  STEP: creating a StorageClass  @ 11/24/23 21:04:12.194
  STEP: setting up the PVC and PV @ 11/24/23 21:04:12.259
  STEP: creating a PVC @ 11/24/23 21:04:12.259
  STEP: waiting for PVC to be in phase "Bound" @ 11/24/23 21:04:12.333
  Nov 24 21:04:12.333: INFO: Waiting up to timeout=5m0s for PersistentVolumeClaims [pvc-q2ks7] to have phase Bound
  Nov 24 21:04:12.397: INFO: PersistentVolumeClaim pvc-q2ks7 found but phase is Pending instead of Bound.
  Nov 24 21:04:14.462: INFO: PersistentVolumeClaim pvc-q2ks7 found but phase is Pending instead of Bound.
  Nov 24 21:04:16.528: INFO: PersistentVolumeClaim pvc-q2ks7 found but phase is Pending instead of Bound.
  Nov 24 21:04:18.593: INFO: PersistentVolumeClaim pvc-q2ks7 found and phase=Bound (6.259909505s)
  STEP: checking the PVC @ 11/24/23 21:04:18.593
  STEP: validating provisioned PV @ 11/24/23 21:04:18.657
  STEP: checking the PV @ 11/24/23 21:04:18.721
  STEP: deploying pod continously writing to volume @ 11/24/23 21:04:18.721
  W1124 21:04:18.815721   27551 warnings.go:70] would violate PodSecurity "restricted:latest": allowPrivilegeEscalation != false (container "volume-tester" must set securityContext.allowPrivilegeEscalation=false), unrestricted capabilities (container "volume-tester" must set securityContext.capabilities.drop=["ALL"]), runAsNonRoot != true (pod or container "volume-tester" must set securityContext.runAsNonRoot=true), seccompProfile (pod or container "volume-tester" must set securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")
  STEP: modifying the pvc @ 11/24/23 21:04:31.295
  STEP: resizing the pvc @ 11/24/23 21:04:31.358
  Nov 24 21:04:31.425: INFO: updated pvc: map[ebs.csi.aws.com/iops:4000 ebs.csi.aws.com/throughput:150 ebs.csi.aws.com/volumeType:gp3 pv.kubernetes.io/bind-completed:yes pv.kubernetes.io/bound-by-controller:yes volume.beta.kubernetes.io/storage-provisioner:ebs.csi.aws.com volume.kubernetes.io/storage-provisioner:ebs.csi.aws.com]

  STEP: wait for and confirm pv modification @ 11/24/23 21:04:31.425
  Nov 24 21:04:31.425: INFO: waiting up to 3m0s for pv in namespace "ebs-8170" to be modified
  Nov 24 21:04:41.625: INFO: pv annotations are updated to map[ebs.csi.aws.com/iops:4000 ebs.csi.aws.com/throughput:150 ebs.csi.aws.com/volumeType:gp3 pv.kubernetes.io/provisioned-by:ebs.csi.aws.com volume.kubernetes.io/provisioner-deletion-secret-name: volume.kubernetes.io/provisioner-deletion-secret-namespace:]
  Nov 24 21:04:41.625: INFO: waiting up to 1m0s for pv resize in namespace "ebs-8170" to be complete
  Nov 24 21:04:41.689: INFO: pv size is updated to 11Gi
  Nov 24 21:04:41.689: INFO: deleting Pod "ebs-8170"/"ebs-volume-tester-f7mgr"
  Nov 24 21:04:41.770: INFO: Pod ebs-volume-tester-f7mgr has the following logs:
  STEP: Deleting pod ebs-volume-tester-f7mgr in namespace ebs-8170 @ 11/24/23 21:04:41.77
  Nov 24 21:04:41.837: INFO: deleting PVC "ebs-8170"/"pvc-q2ks7"
  Nov 24 21:04:41.837: INFO: Deleting PersistentVolumeClaim "pvc-q2ks7"
  STEP: waiting for claim's PV "pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568" to be deleted @ 11/24/23 21:04:41.909
  Nov 24 21:04:41.909: INFO: Waiting up to 10m0s for PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 to get deleted
  Nov 24 21:04:41.973: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (64.502569ms)
  Nov 24 21:04:47.041: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (5.132730617s)
  Nov 24 21:04:52.110: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (10.20093835s)
  Nov 24 21:04:57.178: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (15.269120863s)
  Nov 24 21:05:02.246: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (20.337128434s)
  Nov 24 21:05:07.315: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (25.406100254s)
  Nov 24 21:05:12.380: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Bound (30.471429661s)
  Nov 24 21:05:17.449: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Released (35.5401519s)
  Nov 24 21:05:22.517: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Released (40.607836016s)
  Nov 24 21:05:27.585: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 found and phase=Released (45.676542314s)
  Nov 24 21:05:32.653: INFO: PersistentVolume pvc-b6a153b9-01f5-43c2-9fd7-2961e3227568 was removed
  Nov 24 21:05:32.653: INFO: Waiting up to 5m0s for PersistentVolumeClaim pvc-q2ks7 to be removed
  Nov 24 21:05:32.717: INFO: Claim "pvc-q2ks7" in namespace "ebs-8170" doesn't exist in the system
  STEP: Destroying namespace "ebs-8170" for this suite. @ 11/24/23 21:05:32.717
• [82.218 seconds]

NOTE: Tests currently fail because we need to turn volumeModification parameter on in CI. This change should be a part of this PR.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 24, 2023
@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch from 417e416 to 2fbe2ef Compare November 24, 2023 21:07
Copy link

Code Coverage Diff

This PR does not change the code coverage

@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch 3 times, most recently from bbe3bd1 to 95633ff Compare November 30, 2023 18:19
Makefile Outdated Show resolved Hide resolved
@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch from 95633ff to 3286b0b Compare November 30, 2023 22:00
@torredil
Copy link
Member

torredil commented Dec 1, 2023

/retest

1 similar comment
@AndrewSirenko
Copy link
Contributor Author

/retest

@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch from 3286b0b to eed79e9 Compare December 1, 2023 21:01
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 1, 2023
@AndrewSirenko
Copy link
Contributor Author

Note: Rebased PR due to merging #1845

Also squashed the original 2 separate commits into one as requested. If seeing the two separate commits helps in reviewing, they are available here:

Refactor E2E: Extract resize-related helper functions · kubernetes-sigs/aws-ebs-csi-driver@f4b1f56

Add E2E tests for modifying volumes via annotations · kubernetes-sigs/aws-ebs-csi-driver@3286b0b

@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch from eed79e9 to 9e9b6ba Compare December 1, 2023 21:08
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

tests/e2e/testsuites/e2e_utils.go Outdated Show resolved Hide resolved
tests/e2e/testsuites/e2e_utils.go Outdated Show resolved Hide resolved
tests/e2e/testsuites/e2e_utils.go Outdated Show resolved Hide resolved
tests/e2e/testsuites/modify_volume_tester.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2023
@AndrewSirenko
Copy link
Contributor Author

Will integrate EC2 API, like #1847 does, in followup PR.

@ConnorJC3
Copy link
Contributor

lgtm other than what @torredil already pointed out
/lgtm

@AndrewSirenko AndrewSirenko force-pushed the E2EModifyVolumePostRefactor branch from 9e9b6ba to de85e64 Compare December 5, 2023 15:58
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 5, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 5, 2023
@ConnorJC3
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ConnorJC3

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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 5, 2023
@k8s-ci-robot k8s-ci-robot merged commit cb20546 into kubernetes-sigs:master Dec 5, 2023
19 checks passed
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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants