-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Data upload controller #6337
Conversation
24aae49
to
e4b8859
Compare
5f98bc2
to
9a957d3
Compare
} | ||
|
||
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") |
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 message looks like trivial, so suggest to change it to debug log
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.
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) |
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.
Do we need to call errorOut so as to mark the CR as failed?
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.
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 { |
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.
Since the snapshot type for the du is arbitrary here, it is not a good practice to refer to u.Spec.CSISnapshot
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.
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{}?
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.
Yes, we can put the snapshot ID to the parameter interface
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'm not sure why we need snapshot ID as parameter?
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.
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) |
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.
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.
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.
modified
9c86e7a
to
79b0da3
Compare
79b0da3
to
6155110
Compare
config/rbac/role.yaml
Outdated
- apiGroups: | ||
- velero.io | ||
resources: | ||
- dataupload |
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 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
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.
yes, I've removed it
95fe9dd
to
0efdc38
Compare
// 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 |
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.
black->block
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.
modified
0efdc38
to
857598f
Compare
Signed-off-by: Ming <[email protected]>
857598f
to
b3e99a7
Compare
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:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.