Skip to content

Commit

Permalink
Merge pull request #184 from blackpiglet/6115_fix
Browse files Browse the repository at this point in the history
Add snapshot data mover logic in PVC RIA v2.
  • Loading branch information
blackpiglet committed Jun 26, 2023
2 parents aa06f02 + f9c3ffd commit 6b59bde
Show file tree
Hide file tree
Showing 7 changed files with 620 additions and 50 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.2
// TODO: need to use velero v1.12.0 after releasing.
github.com/vmware-tanzu/velero v0.0.0-20230612131245-c86018a0f891
github.com/vmware-tanzu/velero v0.0.0-20230620063525-6f3adcf7282b
k8s.io/api v0.25.6
k8s.io/apimachinery v0.25.6
k8s.io/client-go v0.25.6
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69
github.com/tg123/go-htpasswd v1.2.1 h1:i4wfsX1KvvkyoMiHZzjS0VzbAPWfxzI8INcZAKtutoU=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/vmware-tanzu/velero v0.0.0-20230612131245-c86018a0f891 h1:74uNecHF4T8FIQS9b39jgV4zPtb3fsKIjXudwTF7wS8=
github.com/vmware-tanzu/velero v0.0.0-20230612131245-c86018a0f891/go.mod h1:URz7drKyNV58T6MuVdDH/iATs3/DorJI+IEVPZwdHZE=
github.com/vmware-tanzu/velero v0.0.0-20230620063525-6f3adcf7282b h1:mrsiuap4DAaF5ukPvJrFAiELcuHmLF2QVswJpIyVSP8=
github.com/vmware-tanzu/velero v0.0.0-20230620063525-6f3adcf7282b/go.mod h1:URz7drKyNV58T6MuVdDH/iATs3/DorJI+IEVPZwdHZE=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
Expand Down
2 changes: 1 addition & 1 deletion internal/backup/pvc_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (p *PVCBackupItemAction) Execute(item runtime.Unstructured, backup *velerov
var itemToUpdate []velero.ResourceIdentifier

if boolptr.IsSetToTrue(backup.Spec.SnapshotMoveData) {
operationID = label.GetValidName(string(backup.UID) + "." + string(pvc.UID))
operationID = label.GetValidName(string(util.AsyncOperationIDPrefixDataUpload) + string(backup.UID) + "." + string(pvc.UID))
dataUploadLog := p.Log.WithFields(logrus.Fields{
"Source PVC": fmt.Sprintf("%s/%s", pvc.Namespace, pvc.Name),
"VolumeSnapshot": fmt.Sprintf("%s/%s", upd.Namespace, upd.Name),
Expand Down
6 changes: 3 additions & 3 deletions internal/backup/pvc_action_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ import (
snapshotfake "github.com/kubernetes-csi/external-snapshotter/client/v4/clientset/versioned/fake"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"
"github.com/vmware-tanzu/velero-plugin-for-csi/internal/util"
velerofake "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/fake"
corev1 "k8s.io/api/core/v1"
storagev1 "k8s.io/api/storage/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/fake"

"github.com/vmware-tanzu/velero-plugin-for-csi/internal/util"
"github.com/vmware-tanzu/velero/pkg/apis/velero/shared"
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
velerov2alpha1 "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1"
"github.com/vmware-tanzu/velero/pkg/builder"
velerofake "github.com/vmware-tanzu/velero/pkg/generated/clientset/versioned/fake"
"github.com/vmware-tanzu/velero/pkg/plugin/velero"
)

Expand Down Expand Up @@ -89,7 +89,7 @@ func TestExecute(t *testing.T) {
velerov1api.BackupNameLabel: "test",
velerov1api.BackupUIDLabel: "",
velerov1api.PVCUIDLabel: "",
util.AsyncOperationIDLabel: ".",
util.AsyncOperationIDLabel: "du-.",
},
OwnerReferences: []metav1.OwnerReference{
{
Expand Down
Loading

0 comments on commit 6b59bde

Please sign in to comment.