diff --git a/pkg/common-controller/framework_test.go b/pkg/common-controller/framework_test.go index 63f337c0a..3beaf61b0 100644 --- a/pkg/common-controller/framework_test.go +++ b/pkg/common-controller/framework_test.go @@ -1346,16 +1346,6 @@ func newGroupSnapshotContentArray(groupSnapshotContentName, boundToGroupSnapshot } } -func withSnapshotContentInvalidLabel(contents []*crdv1.VolumeSnapshotContent) []*crdv1.VolumeSnapshotContent { - for i := range contents { - if contents[i].ObjectMeta.Labels == nil { - contents[i].ObjectMeta.Labels = make(map[string]string) - } - contents[i].ObjectMeta.Labels[utils.VolumeSnapshotContentInvalidLabel] = "" - } - return contents -} - func withContentAnnotations(contents []*crdv1.VolumeSnapshotContent, annotations map[string]string) []*crdv1.VolumeSnapshotContent { for i := range contents { if contents[i].ObjectMeta.Annotations == nil { @@ -1559,40 +1549,6 @@ func newSnapshotArray( } } -func withSnapshotInvalidLabel(snapshots []*crdv1.VolumeSnapshot) []*crdv1.VolumeSnapshot { - for i := range snapshots { - if snapshots[i].ObjectMeta.Labels == nil { - snapshots[i].ObjectMeta.Labels = make(map[string]string) - } - snapshots[i].ObjectMeta.Labels[utils.VolumeSnapshotInvalidLabel] = "" - } - return snapshots -} - -func newSnapshotClass(snapshotClassName, snapshotClassUID, driverName string, isDefaultClass bool) *crdv1.VolumeSnapshotClass { - sc := &crdv1.VolumeSnapshotClass{ - ObjectMeta: metav1.ObjectMeta{ - Name: snapshotClassName, - Namespace: testNamespace, - UID: types.UID(snapshotClassUID), - ResourceVersion: "1", - SelfLink: "/apis/snapshot.storage.k8s.io/v1/namespaces/" + testNamespace + "/volumesnapshotclasses/" + snapshotClassName, - }, - Driver: driverName, - } - if isDefaultClass { - sc.Annotations = make(map[string]string) - sc.Annotations[utils.IsDefaultSnapshotClassAnnotation] = "true" - } - return sc -} - -func newSnapshotClassArray(snapshotClassName, snapshotClassUID, driverName string, isDefaultClass bool) []*crdv1.VolumeSnapshotClass { - return []*crdv1.VolumeSnapshotClass{ - newSnapshotClass(snapshotClassName, snapshotClassUID, driverName, isDefaultClass), - } -} - // newClaim returns a new claim with given attributes func newClaim(name, claimUID, capacity, boundToVolume string, phase v1.PersistentVolumeClaimPhase, class *string, bFinalizer bool) *v1.PersistentVolumeClaim { claim := v1.PersistentVolumeClaim{ diff --git a/pkg/utils/util.go b/pkg/utils/util.go index e5b8c5e06..004f282ee 100644 --- a/pkg/utils/util.go +++ b/pkg/utils/util.go @@ -157,12 +157,6 @@ const ( // to create snapshot if the snapshot belongs to a group. VolumeGroupSnapshotHandleLabel = "groupsnapshot.storage.k8s.io/volumeGroupSnapshotHandle" - // VolumeSnapshotContentInvalidLabel is applied to invalid content as a label key. The value does not matter. - // See https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md#automatic-labelling-of-invalid-objects - VolumeSnapshotContentInvalidLabel = "snapshot.storage.kubernetes.io/invalid-snapshot-content-resource" - // VolumeSnapshotInvalidLabel is applied to invalid snapshot as a label key. The value does not matter. - // See https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/177-volume-snapshot/tighten-validation-webhook-crd.md#automatic-labelling-of-invalid-objects - VolumeSnapshotInvalidLabel = "snapshot.storage.kubernetes.io/invalid-snapshot-resource" // VolumeSnapshotContentManagedByLabel is applied by the snapshot controller to the VolumeSnapshotContent object in case distributed snapshotting is enabled. // The value contains the name of the node that handles the snapshot for the volume local to that node. VolumeSnapshotContentManagedByLabel = "snapshot.storage.kubernetes.io/managed-by"