Skip to content

Commit

Permalink
remove unused labels and functions
Browse files Browse the repository at this point in the history
this commit removes unsed labels and functions

Signed-off-by: yati1998 <[email protected]>
  • Loading branch information
yati1998 committed Nov 21, 2024
1 parent 3c79996 commit 6534141
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
44 changes: 0 additions & 44 deletions pkg/common-controller/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 0 additions & 6 deletions pkg/utils/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6534141

Please sign in to comment.