-
Notifications
You must be signed in to change notification settings - Fork 6
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 multiple ServerClaim
references
#190
Conversation
e763db9
to
ae94060
Compare
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.
@lukasfrank Could you describe the situation when it is possible?
As far as I see in the code, there is three branches:
- ServerClaim has non empty reference to the server - in this case it will try to claim server by reference
- ServerClaim has non empty selector - in this case it will try to claim server by label selector
- If both previous conditions are false, then it will try to pick first available server
- After server picked up, reference to claim object is put to server's spec
- After that reference to server is put to claim's spec.
Therefore, the claimFirstBestServer function will be called only if there is no server reference or label selector in ServerClaim.Spec. The Server.Spec.ServerClaimRef field is cleaned up by the serverClaim finalizer, so you can't delete serverClaim resource without cleaning up the references. In the same time you can't cleanup ServerClaim.Spec.ServerRef field, bc we have validating hook which prevents it.
So, I can imagine the only scenario when you'll have server referencing to claim and the claim without reference to that server: if you'll turn down operator and perform some manual actions, like cleaning up the serverRef field or recreating the claim object. But in case of claim recreating the UID will change and again the check will make no sense.
ServerClaim
references
I'm considering the following case:
If the |
ae94060
to
92e6943
Compare
@lukasfrank I just think that in future we might enable concurrent reconciliation and we'll need another solution rather than straight iterating over all servers. Something like creation of lock object for server when the server is selected and lock deletion when all references are set. I'd also take a look on how it was done for PV-PVC bounding. Anyways, if you're sure and insist this fix is necessary - let's proceed with this. |
Proposed Changes
A
ServerClaim
can update multiple servers.The
claimFirstBestServer
function finds, returns, and updates aServer
. However there is no back-reference to theServer
set.