diff --git a/pkg/exposer/csi_snapshot.go b/pkg/exposer/csi_snapshot.go index 9fb4e42e0..4017ce4e8 100644 --- a/pkg/exposer/csi_snapshot.go +++ b/pkg/exposer/csi_snapshot.go @@ -471,8 +471,8 @@ func (e *csiSnapshotExposer) createBackupVSC(ctx context.Context, ownerObject co https://github.com/kubernetes-csi/external-snapshotter/tree/4cedb3f45790ac593ebfa3324c490abedf739477?tab=readme-ov-file#distributed-snapshotting https://github.com/kubernetes-csi/external-snapshotter/blob/4cedb3f45790ac593ebfa3324c490abedf739477/pkg/utils/util.go#L158 */ - if manager, ok := snapshotVSC.Labels["snapshot.storage.kubernetes.io/managed-by"]; ok { - vsc.ObjectMeta.Labels["snapshot.storage.kubernetes.io/managed-by"] = manager + if manager, ok := snapshotVSC.Labels[kube.VolumeSnapshotContentManagedByLabel]; ok { + vsc.ObjectMeta.Labels[kube.VolumeSnapshotContentManagedByLabel] = manager } return e.csiSnapshotClient.VolumeSnapshotContents().Create(ctx, vsc, metav1.CreateOptions{}) diff --git a/pkg/util/kube/utils.go b/pkg/util/kube/utils.go index eab3193fc..1720f614f 100644 --- a/pkg/util/kube/utils.go +++ b/pkg/util/kube/utils.go @@ -53,6 +53,11 @@ const ( KubeAnnSelectedNode = "volume.kubernetes.io/selected-node" ) +// 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. +const VolumeSnapshotContentManagedByLabel = "snapshot.storage.kubernetes.io/managed-by" + var ErrorPodVolumeIsNotPVC = errors.New("pod volume is not a PVC") // NamespaceAndName returns a string in the format /