-
Notifications
You must be signed in to change notification settings - Fork 295
Copy Events from tmp PVCs during Clone #3933
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
base: main
Are you sure you want to change the base?
Conversation
…rollers Signed-off-by: dsanatar <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Just a quick first pass 👍
Do I understand correctly that the host assisted/upload controllers are already okay? It's just the csi/snap clone that's broken?
BTW, we should be able to unit test this
(we already use record.NewFakeRecorder in some unit test suites)
| // check if target PVC already has this equivalent event | ||
| if _, exists := eventMap[msg]; exists { | ||
| continue | ||
| } |
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.
How do we feel about using the message as a sign of existence?
I can totally imagine some part of the message being dynamic
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.
Depending on your answer (maybe this is somehow a non issue) we can come up with other ideas like a combo of reason and something else
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.
It can't hurt to prepend the reason for a more precise comparison, will address
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.
Actually I think there's a types.UID in the event object
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.
At first I wasn't sure we want to propagate duplicates but as long as our fired events will qualify for aggregation (.count increase instead of lots of CREATEs for every event) we should be good
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.
Correct, any duplicate events that may get re-emitted just increment the event counter.
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.
Hmm yeah as long as we don't do anything funky (reason/event source/etc are all the same) I guess we should be fine. If the message has a dynamic element, the coalescing should break, but, that's not on us - we just propagate existing events.
pkg/controller/common/util.go
Outdated
| } | ||
|
|
||
| // use this to hash each message for quick lookup, value is unused | ||
| eventMap := make(map[string]bool) |
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.
not a huge deal but normally in go you'd use an empty struct instead of the bool in this kind of maps, to spare the allocation:
https://stackoverflow.com/a/22770744
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.
ah ok good to know thanks!
The |
Interesting, does this not achieve that for host clone?
|
I believe this annotation is only used to report specific events from within the controller. The issue seen in the bug report that causes these tmp PVCs to fail is an event failure from the provisioner. I am however using this annotation to get the owner PVC object, so I will need to add this Ann to the snap/csi clone as well. |
Signed-off-by: dsanatar <[email protected]>
After further investigating, it is actually slightly harder to unit test this using the FakeRecorders since the events we are looking for don't get emitted from the normal Reconcile loop, but instead from
|
3a805f0 to
5832cc4
Compare
What this PR does / why we need it:
Extension of #3764
If a clone gets stuck for whatever reason it is helpful to be able to see the original error from the PVC/DV that initiated the clone.
Leveraging the functionality from the above PR to copy events from tmp-pvcs during a clone to the their owner pvc.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
Release note: