-
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
Fix data mover controller bugs #6616
Conversation
80abc03
to
7005dcc
Compare
7005dcc
to
6276d02
Compare
b50ba81
to
8c7c199
Compare
8c7c199
to
9279e19
Compare
} | ||
return ctrl.Result{}, errors.Wrap(err, "getting datadownload") | ||
} | ||
if dd.Spec.Cancel { |
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 check for dd.Spec.Cancel
but for isDataDownloadInFinalState(dd)
.
For all terminal statuses, we need to do this, e.g., when prepare timeout happens, the CR will be set to Failed
instead of Cancelled
or dd.Spec.Cancel = true
.
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.
Updated
|
||
// we need to clean up resources as resources created in Expose it later than cancel action | ||
// and need to clean up resources again | ||
if du.Spec.Cancel { |
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 same, check for isDataUploadInFinalState(du)
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.
Updated
func ExclusiveUpdateDataUpload(ctx context.Context, client client.Client, du *velerov2alpha1api.DataUpload, | ||
updateFunc func(*velerov2alpha1api.DataUpload)) (*velerov2alpha1api.DataUpload, bool, error) { | ||
original := du.DeepCopy() | ||
updateFunc(du) |
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.
ExclusiveUpdateDataUpload
is a fundermental function, we don't expect all the callers expect a updated du
, so it is risky to update the du
directly.
Actually, I suggest we leave ExclusiveUpdateDataUpload
as is, and change the function of acceptDataUpload
, the latter is more pure and it is safe to change it.
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've changed back to exclusiveUpdateDataUpload.
But for this function, in the update action, it is not a general usage that coping it before updating, leading to many related UT tests failing with conflict errors.
So I removed the DeepCopy function for the UT, I know your original purpose would be not willing to update the du
directly, but for our current usage scenario there is no effect as we always get the latest CR from the API server instead of memory in each Reconcile
9279e19
to
163737e
Compare
163737e
to
446108c
Compare
446108c
to
f679902
Compare
Codecov Report
@@ Coverage Diff @@
## main #6616 +/- ##
==========================================
+ Coverage 60.18% 60.31% +0.13%
==========================================
Files 242 242
Lines 25639 25924 +285
==========================================
+ Hits 15431 15637 +206
- Misses 9135 9186 +51
- Partials 1073 1101 +28
|
f679902
to
1e23ac3
Compare
1e23ac3
to
3099a0e
Compare
b409b69
to
bbbdbcd
Compare
…6600 Signed-off-by: Ming Qiu <mqiu@vmware.com>
bbbdbcd
to
5485616
Compare
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #(issue)
#6615
#6612
#6550
#6563
#6600
Please indicate you've done the following:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.