Skip to content

VolumeSnapshot resources still remain after pass the E2E test #264

@inajob

Description

@inajob

What happened:

Run storage E2E test and passed the test, but some VolumeSnapshot resources remain.

What you expected to happen:

VolumeSnapshot resources are deleted after E2E test.

How to reproduce it (as minimally and precisely as possible):

Use https://github.com/zlabjp/kube-conformance .

Below is my testdriver.yaml

ShortName: ontap-block
StorageClass:
  FromName: false
  FromFile: </path/to/storage-class>
SnapshotClass:
  FromName: true
DriverInfo:
  Name: <Name My Storage Driver>
  Capabilities:
    persistence: true
    fsGroup: true
    exec: true
    block: true
    pvcDataSource: true
    controllerExpansion: true
    nodeExpansion: true
    volumeLimits: false
    singleNodeVolume: false
    snapshotDataSource: true
    topoligy: false
  SupportedSizeRange:
   Min: 1Gi
   Max: 10Gi
  RequiredAccessModes:
  - ReadWriteOnce

Anything else we need to know?:

The main cause may be here.

snapshotWorker calls checkAndUpdateSnapshotClass to check VolumeSnapshotClass.
This logic prevent deleting VolumeSnapshot when VolumeSnapshotClass have already deleted.

On the E2E side, here is the logic to cleanup resources.

	cleanupFunc := func() {
		framework.Logf("deleting snapshot %q/%q", snapshot.GetNamespace(), snapshot.GetName())
		err = dynamicClient.Resource(snapshotGVR).Namespace(updatedClaim.Namespace).Delete(snapshot.GetName(), nil)
		if err != nil && !apierrs.IsNotFound(err) {
			framework.Failf("Error deleting snapshot %q. Error: %v", snapshot.GetName(), err)
		}

		framework.Logf("deleting initClaim %q/%q", updatedClaim.Namespace, updatedClaim.Name)
		err = client.CoreV1().PersistentVolumeClaims(updatedClaim.Namespace).Delete(updatedClaim.Name, nil)
		if err != nil && !apierrs.IsNotFound(err) {
			framework.Failf("Error deleting initClaim %q. Error: %v", updatedClaim.Name, err)
		}

		framework.Logf("deleting SnapshotClass %s", snapshotClass.GetName())
		framework.ExpectNoError(dynamicClient.Resource(snapshotClassGVR).Delete(snapshotClass.GetName(), nil))
	}

E2E doesn't wait for finishing to delete the VolumeSnapshot, and delete SnapshotClass.
So that, SnapshotResource can't be deleted.

I think snapshotWorker need not to check VolumeSnapshotClass when delete VolumeSnapshot( and VolumeSnapshotContent).

Environment:

  • Kubernetes version (use kubectl version): v1.17.2
  • Cloud provider or hardware configuration: openstack
  • OS (e.g: cat /etc/os-release): container-linux-2303.3.0
  • Kernel (e.g. uname -a): 4.19.86-coreos
  • Install tools: original

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions