-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat: Use flintlock unique id #327
Conversation
Codecov Report
@@ Coverage Diff @@
## main #327 +/- ##
==========================================
- Coverage 57.76% 57.30% -0.47%
==========================================
Files 51 51
Lines 2517 2546 +29
==========================================
+ Hits 1454 1459 +5
- Misses 945 964 +19
- Partials 118 123 +5
Continue to review full report at Codecov.
|
84d9839
to
841dcf3
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.
LGTM
@@ -58,11 +58,13 @@ message CreateMicroVMResponse { | |||
message DeleteMicroVMRequest { | |||
string id = 1; | |||
string namespace = 2; | |||
string uuid = 3; |
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'm not sure about this. I think we need 2 versions of the Delete/Get API methods:
- Delete/Get(name, namespace)
- DeleteById/GetById(id)
I still think its valid to get or delete a microvm based on its namespace/name only
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.
This would probably then mean changing id
to name
throughout flintlock
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 wouldn't let users to delete by ns/name
only because in some cases it will not be only one, same for get. The get endpoint returns one spec, but without the uid, it's not guaranteed that's the only one.
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.
Or we have to update the Get return a list of specs.
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 would even go remove everything from the delete and get and leave it only the uid. So you can Get (single spec response) only with uid and delete the same way.
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.
Yes i think perhaps you are right. Get and delete should only accept the id. I think we should also implement (in a different PR) a Find
that we can use to find by the ns/name.....wdyt?
core/application/commands.go
Outdated
if err != nil { | ||
return nil, fmt.Errorf("creating vmid: %w", err) | ||
} | ||
|
||
mvm.ID = *vmid | ||
} | ||
|
||
uuid, err := a.ports.IdentifierService.GenerateRandom() |
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 infrastructure implementation that we use for the identifier service doesn't generate a UUID but instead a ULID. It does say a ULID is compatible with a UUID but its not formatted as a UUID with this call.
Maybe we need to refer to this as a uid instead of uuid to indicate that its not a UUID? Or something similar.
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, it's even more confusing now. Turned out i used a.ports.IdentifierService.GenerateRandom()
here and in the grpc server uuid.New().String()
which one should we keep?
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'll use ulid to be more consistent with the rest of the system.
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.
Yeah ulid from the identifier service is the best.
845cf75
to
86d92cd
Compare
This commit message will be a QA like ocmmit message Why in the spec and not somewhere else? Historically we are using the same spec in create request an responses, we do not return with status on create request because it's mostly empty. The uuid could be there, but on create there is no status yet. Why is it set on create request? We can't return the uuid in the response if it's not generated and without the uuid they can't delete the resource, it would be a disaster if capmvm sends a request to create ns1/mvm1, then it wants to delete it even before we created the resources. If the delete request would be only ns1/mvm1 it would delete the old one, or basically any other microvms that has the same name and namespace (coming from other management clusters). Why is it global and not microvm specific? It seems logical and generating and maintaining a unique id shouldn't be the job of the microvm provider, their responsibility should be to manage microvms, metadata and other stuffs are provider independent. Fixes liquidmetal-dev#291 rename field to be uid instead of uuid because it is an ulid now remove id and ns from get and delete endpoints
@@ -1,4 +1,5 @@ | |||
{ | |||
"id": "mvm1", | |||
"namespace": "ns1" | |||
"namespace": "ns1", | |||
"uid": "b1c0aa3c-ebba-498a-a7c7-903d91758d83" |
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.
should the other 2 be removed?
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.
yes
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.
But that "tooling" has to be refined after Find.
infrastructure/grpc/server.go
Outdated
/* | ||
if req.Microvm.Uid == nil { | ||
newUID := uuid.New().String() | ||
req.Microvm.Uid = &newUID | ||
} | ||
*/ |
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.
this meant to be here still?
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.
nope XD
Co-authored-by: Claudia <claudiaberesford@gmail.com>
What this PR does / why we need it:
This commit message will be a QA like commit message
Why in the spec and not somewhere else?
Historically we are using the same spec in create request an responses,
we do not return with status on create request because it's mostly
empty. The uuid could be there, but on create there is no status yet.
Why is it set on create request?
We can't return the uuid in the response if it's not generated and
without the uuid they can't delete the resource, it would be a disaster
if capmvm sends a request to create ns1/mvm1, then it wants to delete it
even before we created the resources. If the delete request would be
only ns1/mvm1 it would delete the old one, or basically any other
microvms that has the same name and namespace (coming from other
management clusters).
Why is it global and not microvm specific?
It seems logical and generating and maintaining a unique id shouldn't be
the job of the microvm provider, their responsibility should be to
manage microvms, metadata and other stuffs are provider independent.
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 #291
Special notes for your reviewer:
Checklist: