diff --git a/pkg/controller/data_download_controller.go b/pkg/controller/data_download_controller.go index e2a62830e..673b82c02 100644 --- a/pkg/controller/data_download_controller.go +++ b/pkg/controller/data_download_controller.go @@ -42,7 +42,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" "github.com/vmware-tanzu/velero/pkg/constant" @@ -609,7 +608,19 @@ func (r *DataDownloadReconciler) OnDataDownloadProgress(ctx context.Context, nam log := r.logger.WithField("datadownload", ddName) if err := UpdateDataDownloadWithRetry(ctx, r.client, types.NamespacedName{Namespace: namespace, Name: ddName}, log, func(dd *velerov2alpha1api.DataDownload) bool { - dd.Status.Progress = shared.DataMoveOperationProgress{TotalBytes: progress.TotalBytes, BytesDone: progress.BytesDone} + if progress.TotalBytes != -1 { + dd.Status.Progress.TotalBytes = progress.TotalBytes + } + + if progress.BytesDone != -1 { + dd.Status.Progress.BytesDone = progress.BytesDone + } + + if progress.Message != "" { + dd.Status.Message += progress.Message + dd.Status.Message += ";" + } + return true }); err != nil { log.WithError(err).Error("Failed to update progress") diff --git a/pkg/controller/data_upload_controller.go b/pkg/controller/data_upload_controller.go index ae50a7741..8c7795765 100644 --- a/pkg/controller/data_upload_controller.go +++ b/pkg/controller/data_upload_controller.go @@ -42,7 +42,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" velerov2alpha1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v2alpha1" "github.com/vmware-tanzu/velero/pkg/constant" @@ -634,7 +633,19 @@ func (r *DataUploadReconciler) OnDataUploadProgress(ctx context.Context, namespa log := r.logger.WithField("dataupload", duName) if err := UpdateDataUploadWithRetry(ctx, r.client, types.NamespacedName{Namespace: namespace, Name: duName}, log, func(du *velerov2alpha1api.DataUpload) bool { - du.Status.Progress = shared.DataMoveOperationProgress{TotalBytes: progress.TotalBytes, BytesDone: progress.BytesDone} + if progress.TotalBytes != -1 { + du.Status.Progress.TotalBytes = progress.TotalBytes + } + + if progress.BytesDone != -1 { + du.Status.Progress.BytesDone = progress.BytesDone + } + + if progress.Message != "" { + du.Status.Message += progress.Message + du.Status.Message += ";" + } + return true }); err != nil { log.WithError(err).Error("Failed to update progress") diff --git a/pkg/controller/pod_volume_backup_controller.go b/pkg/controller/pod_volume_backup_controller.go index c4e68ce33..13d0dd851 100644 --- a/pkg/controller/pod_volume_backup_controller.go +++ b/pkg/controller/pod_volume_backup_controller.go @@ -41,7 +41,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - veleroapishared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" "github.com/vmware-tanzu/velero/pkg/constant" "github.com/vmware-tanzu/velero/pkg/datapath" @@ -628,7 +627,19 @@ func (r *PodVolumeBackupReconciler) OnDataPathProgress(ctx context.Context, name log := r.logger.WithField("pvb", pvbName) if err := UpdatePVBWithRetry(ctx, r.client, types.NamespacedName{Namespace: namespace, Name: pvbName}, log, func(pvb *velerov1api.PodVolumeBackup) bool { - pvb.Status.Progress = veleroapishared.DataMoveOperationProgress{TotalBytes: progress.TotalBytes, BytesDone: progress.BytesDone} + if progress.TotalBytes != -1 { + pvb.Status.Progress.TotalBytes = progress.TotalBytes + } + + if progress.BytesDone != -1 { + pvb.Status.Progress.BytesDone = progress.BytesDone + } + + if progress.Message != "" { + pvb.Status.Message += progress.Message + pvb.Status.Message += ";" + } + return true }); err != nil { log.WithError(err).Error("Failed to update progress") diff --git a/pkg/controller/pod_volume_restore_controller.go b/pkg/controller/pod_volume_restore_controller.go index 4fe9bdaa3..1ca274017 100644 --- a/pkg/controller/pod_volume_restore_controller.go +++ b/pkg/controller/pod_volume_restore_controller.go @@ -44,7 +44,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" "sigs.k8s.io/controller-runtime/pkg/reconcile" - veleroapishared "github.com/vmware-tanzu/velero/pkg/apis/velero/shared" velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" "github.com/vmware-tanzu/velero/pkg/constant" "github.com/vmware-tanzu/velero/pkg/datapath" @@ -905,7 +904,19 @@ func (r *PodVolumeRestoreReconciler) OnDataPathProgress(ctx context.Context, nam log := r.logger.WithField("PVR", pvrName) if err := UpdatePVRWithRetry(ctx, r.client, types.NamespacedName{Namespace: namespace, Name: pvrName}, log, func(pvr *velerov1api.PodVolumeRestore) bool { - pvr.Status.Progress = veleroapishared.DataMoveOperationProgress{TotalBytes: progress.TotalBytes, BytesDone: progress.BytesDone} + if progress.TotalBytes != -1 { + pvr.Status.Progress.TotalBytes = progress.TotalBytes + } + + if progress.BytesDone != -1 { + pvr.Status.Progress.BytesDone = progress.BytesDone + } + + if progress.Message != "" { + pvr.Status.Message += progress.Message + pvr.Status.Message += ";" + } + return true }); err != nil { log.WithError(err).Error("Failed to update progress")