Merge pull request #4797 from blackpiglet/4758-avoid-duplicate-snapshot-for-csi

Avoid duplicated snapshotting, when CSI is enabled
This commit is contained in:
Xun Jiang/Bruce Jiang
2022-04-14 19:49:34 +08:00
committed by GitHub
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Do not take snapshot for PV to avoid duplicated snapshotting, when CSI feature is enabled.
+7
View File
@@ -39,6 +39,7 @@ import (
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
"github.com/vmware-tanzu/velero/pkg/client"
"github.com/vmware-tanzu/velero/pkg/discovery"
"github.com/vmware-tanzu/velero/pkg/features"
"github.com/vmware-tanzu/velero/pkg/kuberesource"
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
"github.com/vmware-tanzu/velero/pkg/restic"
@@ -415,6 +416,12 @@ func (ib *itemBackupper) takePVSnapshot(obj runtime.Unstructured, log logrus.Fie
}
}
// #4758 Do not take snapshot for CSI PV to avoid duplicated snapshotting, when CSI feature is enabled.
if features.IsEnabled(velerov1api.CSIFeatureFlag) && pv.Spec.CSI != nil {
log.Infof("Skipping snapshot of persistent volume %s, because it's handled by CSI plugin.", pv.Name)
return nil
}
// TODO: -- once failure-domain.beta.kubernetes.io/zone is no longer
// supported in any velero-supported version of Kubernetes, remove fallback checking of it
pvFailureDomainZone, labelFound := pv.Labels[zoneLabel]