Skip to content
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

Data upload controller #6337

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

qiuming-best
Copy link
Contributor

@qiuming-best qiuming-best commented Jun 2, 2023

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes #(issue)
#6119

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@qiuming-best qiuming-best added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Jun 2, 2023
@qiuming-best qiuming-best marked this pull request as draft June 2, 2023 02:23
@qiuming-best qiuming-best force-pushed the data-upload-controller branch 5 times, most recently from 24aae49 to e4b8859 Compare June 2, 2023 11:27
@qiuming-best qiuming-best marked this pull request as ready for review June 3, 2023 01:34
@github-actions github-actions bot requested a review from reasonerjt June 3, 2023 01:34
@qiuming-best qiuming-best force-pushed the data-upload-controller branch 2 times, most recently from 5f98bc2 to 9a957d3 Compare June 4, 2023 15:13
}

if du.Spec.DataMover != "" && du.Spec.DataMover != dataMoverType {
log.WithField("Data mover", du.Spec.DataMover).Info("it is not one built-in data mover which is not supported by Velero")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message looks like trivial, so suggest to change it to debug log

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified


ep, ok := r.snapshotExposerList[du.Spec.SnapshotType]
if !ok {
return ctrl.Result{}, fmt.Errorf("%v type of snapshot exposer is not exist", du.Spec.SnapshotType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to call errorOut so as to mark the CR as failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

log.Info("Data upload is accepted")

exposeParam := r.setupExposeParam(&du)
if err := ep.Expose(ctx, getOwnerObject(&du), du.Spec.CSISnapshot.VolumeSnapshot, du.Spec.OperationTimeout.Duration, exposeParam); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the snapshot type for the du is arbitrary here, it is not a good practice to refer to u.Spec.CSISnapshot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about we change the Expose interface to Expose(context.Context, corev1.ObjectReference, interface{}) error
for every specific snapshot type, they could get the parameter values from the interface{}?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can put the snapshot ID to the parameter interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why we need snapshot ID as parameter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can put the snapshot ID to the parameter interface

Sorry for the typo, it should be "snapshot name". I see the current change that move snapshot name and timeout to parameter, it is fine.

log.WithError(err).Error("error updating data upload into canceling status")
return ctrl.Result{}, err
}
ep.CleanUp(ctx, getOwnerObject(&du), du.Spec.CSISnapshot.VolumeSnapshot, du.Spec.SourceNamespace)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't call the CleanUp here, by setting the phase to DataUploadPhaseCanceling, it only means the data mover is notified for cancel, it doesn't mean the data mover has cancelled and the snapshot is released by the data mover.
If we call CleanUp here, it is possible that the snapshot is deleted where the data mover is still trying to access it.

The CleanUp should be called inside the Cancel callback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

@qiuming-best qiuming-best force-pushed the data-upload-controller branch 2 times, most recently from 9c86e7a to 79b0da3 Compare June 5, 2023 14:47
Lyndon-Li
Lyndon-Li previously approved these changes Jun 6, 2023
- apiGroups:
- velero.io
resources:
- dataupload
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look correct, we've already have the role declaration for datauploads in the same file. And datauploads looks to be the correct resource name instead of dataupload

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I've removed it

@qiuming-best qiuming-best force-pushed the data-upload-controller branch 2 times, most recently from 95fe9dd to 0efdc38 Compare June 6, 2023 02:32
// The fresh new DataUpload CR first created will trigger to create one pod (long time, maybe failure or unknown status) by one of the dataupload controllers
// then the request will get out of the Reconcile queue immediately by not blocking others' CR handling, in order to finish the rest data upload process we need to
// re-enqueue the previous related request once the related pod is in running status to keep going on the rest logic. and below logic will avoid handling the unwanted
// pod status and also avoid black others CR handling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

black->block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

@qiuming-best qiuming-best force-pushed the data-upload-controller branch from 0efdc38 to 857598f Compare June 6, 2023 05:37
@qiuming-best qiuming-best force-pushed the data-upload-controller branch from 857598f to b3e99a7 Compare June 6, 2023 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has-changelog has-unit-tests kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants