-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backup: init migrate controller #408
Conversation
✅ Deploy Preview for kurator-dev canceled.
|
please rebase |
done |
Signed-off-by: Xieql <xieqianglong@huawei.com>
migrate.Status.Phase = backupapi.MigratePhaseInProgress | ||
log.Info("Migrate Phase changes", "phase", backupapi.MigratePhaseInProgress) | ||
// Ensure the restore point is created after the backup. | ||
time.Sleep(MigrationDelay) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain why we need sleep, because i see in above L173, we guaranteed backup is complete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable is no longer needed.
The previous version of the code, written last month, lacked the condition, leading to the current redundant use of time.Sleep(MigrationDelay).
conditions.MarkTrue(migrate, backupapi.SourceReadyCondition) | ||
} | ||
|
||
return ctrl.Result{}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't requeue after if veleroBackup.Status.Phase != velerov1.BackupPhaseCompleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check alreay in here:
// reconcileMigrateRestore handles the restore stage of the migration process.
func (m *MigrateManager) reconcileMigrateRestore(ctx context.Context, migrate *backupapi.Migrate) (ctrl.Result, error) {
log := ctrl.LoggerFrom(ctx)
// If source cluster's backup resource is not ready, return directly.
if !isMigrateSourceReady(migrate) {
return ctrl.Result{RequeueAfter: RequeueAfter}, nil
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your idea is better
} | ||
|
||
if migrate.Status.Phase != backupapi.MigratePhaseInProgress { | ||
migrate.Status.Phase = backupapi.MigratePhaseInProgress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is confusing, InProgress should be the interval between backup begin and restore complete.
if err = getResourceFromClusterClient(ctx, referredBackupName, VeleroNamespace, *clusterAccess, referredVeleroBackup); err != nil { | ||
if apierrors.IsNotFound(err) { | ||
// if not found, requeue with `RequeueAfter` | ||
return ctrl.Result{RequeueAfter: RequeueAfter}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this could not happen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the sync of velero backup may take time, so it could happen. the velero backup need syn from source cluster to target cluster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the velero backup is create in source clusters
, so we need ensure that this can be found in each target clusters
/label tide/merge-method-squash |
@hzxuzhonghu PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
init the migrate controller.
part of #404
this PR's CI checks is rely on #407
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: