-
Notifications
You must be signed in to change notification settings - Fork 201
Store NodeID in annotation #86
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
Conversation
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
208c2da to
8c00225
Compare
|
@davidz627, PTAL |
davidz627
left a comment
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.
some small comments
| return va, nil, fmt.Errorf("could not add VolumeAttachment finalizer: %s", err) | ||
| originalVA := va | ||
| va, finalizerAdded := h.prepareVAFinalizer(va) | ||
| va, nodeIDAdded := h.prepareVANodeID(va, nodeID) |
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 is not clear the copy semantics here. In fact I looked through and it seems like both prepare functions do a deepcopy of the va. Since these two functions are both only called together here, wondering if we can wrap both in one prepareVA function that does the deepcopy so we are not repeating work.
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 can do DeepCopy() before calling prepareVAFinalizer, but then I do DeepCopy even when no change is needed. Now I do two DeepCopies when one is needed and zero copies when none is needed.
I'd like to avoid funky bool parameters to prepareVAFinalizer or prepareVANodeID if they should do the clone by themselves or it has been already cloned by previous method.
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 I see what you mean. I am ok with either option, feel free to revert if you think the other way is better.
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 restored double DeepCopy()
| if finalizerAdded || nodeIDAdded { | ||
| va, err = h.saveVA(va) | ||
| if err != nil { | ||
| // va modification failed, return the original va that's still on API server |
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.
is this necessarily true, could we have error type where API Server has been modified yet error isi still returned. How bad is returning the incorrect VA here (it might not be that important).
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 code tries to save error to va.Status. It's likely fail if the error was conflict, but who knows... I try to keep va to the last state acknowledged by API server.
| addedVA: va(false, fin, ann), | ||
| expectedActions: []core.Action{ | ||
| core.NewUpdateAction(vaGroupResourceVersion, metav1.NamespaceNone, vaWithAttachError(va(false, fin), "node \"node1\" has no NodeID annotation")), | ||
| core.NewUpdateAction(vaGroupResourceVersion, metav1.NamespaceNone, vaWithAttachError(va(false, fin, ann), "node \"node1\" has no NodeID annotation")), |
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.
wonder if this should work now cause we get the nodeid from the VA
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.
Again, this is about attach. It should fail if driver is not registered to the node.
|
/lgtm |
3c94251 to
7ab7ad0
Compare
7ab7ad0 to
b5f9184
Compare
So the node / CSINodeInfo object can be deleted and detach continutes to work.
1e1e3c6 to
cc01f60
Compare
|
squashed, rebased, restored double |
|
/lgtm |
|
/hold cancel |
STOR-2392: Rebase to upstream v4.9.0 for OCP 4.20
So the node / CSINodeInfo object can be deleted and detach continutes to work.
Fixes: #83