Skip to content
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

Check if the value generated using custom UUID is unique; re-try creation otherwise #102

Open
shubham-pampattiwar opened this issue Oct 17, 2024 · 11 comments

Comments

@shubham-pampattiwar
Copy link
Member

Ref discussion: #101 (comment)

@shubham-pampattiwar shubham-pampattiwar changed the title Check if the VeleroBackup exists for unique name generated using custom UUID and then re-try creation of VelerBackup Check if the VeleroBackup exists for unique name generated using custom UUID and then re-try creation of VeleroBackup Oct 17, 2024
@shawn-hurley
Copy link

Now that we are using labels for the connection between the two, can we use generate name and have the api server deal with this?

@mateusoliveira43
Copy link
Contributor

@shawn-hurley I think that is a good idea. We currently use the value of the label also as the object name (which is 63 char length, but could be 253 char length). Is there a function in the libraries we use that already implements this for us?

@kaovilai
Copy link
Member

Per my comments earlier, apiserver already has retry logic on generateName it creates for objects. I believe Shawn is not asking us to use any libs to implement this.. but to create object without specifying name. Just the generateName in metadata.

Generated values
Some values of an object are typically generated before the object is persisted. It is important not to rely upon the values of these fields set by a dry-run request, since these values will likely be different in dry-run mode from when the real request is made. Some of these fields are:

name: if generateName is set, name will have a unique random name

src

@mpryc
Copy link
Collaborator

mpryc commented Oct 25, 2024

From what is worth I think the retry logic on name is a very corner case now, so I would focus on more important issues to be addressed first.

@kaovilai
Copy link
Member

kaovilai commented Oct 25, 2024

I think this is less about discussing retry (that you consider to be corner case) specifically, but to remove the need for UUID code to exists inside NAC. Just use name generated via generateName from apiserver.

@shubham-pampattiwar
Copy link
Member Author

@kaovilai partially correct. Yes we can use GenerateName instead of using custom UUID for name. Currently custom UUID is used for establishing NAB - VB mapping and also for NAB name (but not a necessity here). GenerateName would be an improvement but we still need custom UUID for mapping purposes we already discussed. So yes we could use GenerateName for NAB name but custom UUID code still needs to reside. Hope this clears up any confusion on this.

@kaovilai
Copy link
Member

kaovilai commented Oct 25, 2024

User create NAB

  • NAB creates VeleroBackup with only generateName and without specifying name with label created-by-nab: <nab-name>
    • NAC lists VeleroBackup created by NAB by label created-by-nab: <nab-name> as needed.
      • Since VeleroBackup name came from generateName (which apiServer already retries for a different name if collide with existing VeleroBackup), we do not need a UUID logic inside NAC.

@shubham-pampattiwar
Copy link
Member Author

yes this wasn't the issue, the problem would arise when we try to sync backups across clusters and in that case we wanted to avoid collisions, thats why we ended up using custom UUID.

@kaovilai
Copy link
Member

kaovilai commented Oct 25, 2024

If NAB syncs across cluster, wouldn't the apiserver generateName logic work in both clusters if both are synced to have the same NABs in the cluster?

@kaovilai
Copy link
Member

Anyway yes as mpyrc said prob more important issues.. I just get excited at deleting code.

@kaovilai
Copy link
Member

If NABs do not sync across cluster, it would be interesting to see how one cluster's NAC read the other.

@mateusoliveira43 mateusoliveira43 changed the title Check if the VeleroBackup exists for unique name generated using custom UUID and then re-try creation of VeleroBackup Check if the value generated using custom UUID is unique; re-try creation otherwise Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants