mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
fix prepare timeout issue
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -223,9 +223,11 @@ func (r *DataDownloadReconciler) Reconcile(ctx context.Context, req ctrl.Request
|
||||
} else if peekErr := r.restoreExposer.PeekExposed(ctx, getDataDownloadOwnerObject(dd)); peekErr != nil {
|
||||
r.tryCancelAcceptedDataDownload(ctx, dd, fmt.Sprintf("found a dataupload %s/%s with expose error: %s. mark it as cancel", dd.Namespace, dd.Name, peekErr))
|
||||
log.Errorf("Cancel dd %s/%s because of expose error %s", dd.Namespace, dd.Name, peekErr)
|
||||
} else if dd.Status.StartTimestamp != nil {
|
||||
if time.Since(dd.Status.StartTimestamp.Time) >= r.preparingTimeout {
|
||||
r.onPrepareTimeout(ctx, dd)
|
||||
} else if at, found := dd.Annotations[acceptTimeAnnoKey]; found {
|
||||
if t, err := time.Parse(time.RFC3339, at); err == nil {
|
||||
if time.Since(t) >= r.preparingTimeout {
|
||||
r.onPrepareTimeout(ctx, dd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,12 +636,13 @@ func (r *DataDownloadReconciler) acceptDataDownload(ctx context.Context, dd *vel
|
||||
|
||||
updateFunc := func(datadownload *velerov2alpha1api.DataDownload) {
|
||||
datadownload.Status.Phase = velerov2alpha1api.DataDownloadPhaseAccepted
|
||||
labels := datadownload.GetLabels()
|
||||
if labels == nil {
|
||||
labels = make(map[string]string)
|
||||
annotations := datadownload.GetAnnotations()
|
||||
if annotations == nil {
|
||||
annotations = make(map[string]string)
|
||||
}
|
||||
labels[acceptNodeLabelKey] = r.nodeName
|
||||
datadownload.SetLabels(labels)
|
||||
annotations[acceptNodeAnnoKey] = r.nodeName
|
||||
annotations[acceptTimeAnnoKey] = r.Clock.Now().Format(time.RFC3339)
|
||||
datadownload.SetAnnotations(annotations)
|
||||
}
|
||||
|
||||
succeeded, err := r.exclusiveUpdateDataDownload(ctx, updated, updateFunc)
|
||||
|
||||
Reference in New Issue
Block a user