controllers support message in progress

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2026-09-04 14:28:31 +08:00
parent 67923bca6f
commit 1048f26c20
4 changed files with 52 additions and 8 deletions
+13 -2
View File
@@ -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")