From 054c6c3be154d288451d07a9f9fb524b24bfd78f Mon Sep 17 00:00:00 2001 From: Balazs Nadasdi Date: Wed, 26 Jan 2022 10:09:30 +0100 Subject: [PATCH] feat: Use flintlock unique id (#327) * feat: Use flintlock unique id 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 #291 rename field to be uid instead of uuid because it is an ulid now remove id and ns from get and delete endpoints * fix e2e * Update core/application/commands.go Co-authored-by: Claudia * address comments Co-authored-by: Claudia --- api/events/spec.go | 6 + api/services/microvm/v1alpha1/microvms.pb.go | 191 ++++++------ .../microvm/v1alpha1/microvms.pb.gw.go | 84 ++--- api/services/microvm/v1alpha1/microvms.proto | 10 +- .../microvm/v1alpha1/microvms.swagger.json | 22 +- api/types/microvm.pb.go | 289 +++++++++--------- api/types/microvm.proto | 6 +- core/application/app_test.go | 75 ++--- core/application/commands.go | 27 +- core/application/errors.go | 12 +- core/application/query.go | 19 +- core/application/reconcile.go | 18 +- core/errors/errors.go | 9 +- core/models/vmid.go | 50 ++- core/models/vmid_test.go | 12 +- core/plans/helper_test.go | 6 +- core/plans/microvm_create_update_test.go | 6 +- core/plans/microvm_delete.go | 3 +- core/plans/microvm_delete_test.go | 9 +- core/ports/repositories.go | 3 +- core/ports/usecases.go | 6 +- core/steps/event/publish_test.go | 7 +- core/steps/microvm/create_test.go | 2 +- core/steps/microvm/delete_test.go | 2 +- core/steps/microvm/start_test.go | 2 +- core/steps/network/interface_create_test.go | 16 +- core/steps/network/interface_delete_test.go | 10 +- core/steps/network/testconst_test.go | 1 + core/steps/runtime/initrd_mount_test.go | 2 +- core/steps/runtime/kernel_mount_test.go | 2 +- core/steps/runtime/repo_release.go | 2 +- core/steps/runtime/repo_release_test.go | 10 +- core/steps/runtime/volume_mount_test.go | 2 +- hack/scripts/payload/DeleteMicroVM.json | 3 +- infrastructure/containerd/content.go | 8 +- .../image_service_integration_test.go | 1 + infrastructure/containerd/repo.go | 16 +- infrastructure/containerd/repo_test.go | 10 +- .../controllers/microvm_controller.go | 8 +- .../controllers/microvm_controller_test.go | 20 +- infrastructure/firecracker/provider.go | 4 +- infrastructure/firecracker/state.go | 2 +- infrastructure/grpc/convert.go | 10 +- infrastructure/grpc/server.go | 12 +- infrastructure/grpc/server_test.go | 32 +- infrastructure/mock/ports.go | 32 +- test/e2e/e2e_test.go | 10 +- test/e2e/utils/utils.go | 10 +- .../grpc/services/microvm/v1alpha1/proto.md | 6 +- userdocs/docs/grpc/types/proto.md | 1 + 50 files changed, 551 insertions(+), 555 deletions(-) diff --git a/api/events/spec.go b/api/events/spec.go index 992634027..d13ac65ec 100644 --- a/api/events/spec.go +++ b/api/events/spec.go @@ -6,6 +6,8 @@ type MicroVMSpecCreated struct { ID string // Namespace is the namespace of the created microvm. Namespace string + // UID is the unique id of the created microvm. + UID string } // MicroVMSpecUpdated is an event for when a microvm spec is updated. @@ -14,6 +16,8 @@ type MicroVMSpecUpdated struct { ID string // Namespace is the namespace of the updated microvm. Namespace string + // UID is the unique id of the updated microvm. + UID string } // MicroVMSpecDeleted is an event for when a microvm spec is deleted. @@ -22,4 +26,6 @@ type MicroVMSpecDeleted struct { ID string // Namespace is the namespace of the deleted microvm. Namespace string + // UID is the unique id of the deleted microvm. + UID string } diff --git a/api/services/microvm/v1alpha1/microvms.pb.go b/api/services/microvm/v1alpha1/microvms.pb.go index 18e4e6cc9..723bfaa2b 100644 --- a/api/services/microvm/v1alpha1/microvms.pb.go +++ b/api/services/microvm/v1alpha1/microvms.pb.go @@ -133,8 +133,7 @@ type DeleteMicroVMRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` } func (x *DeleteMicroVMRequest) Reset() { @@ -169,16 +168,9 @@ func (*DeleteMicroVMRequest) Descriptor() ([]byte, []int) { return file_services_microvm_v1alpha1_microvms_proto_rawDescGZIP(), []int{2} } -func (x *DeleteMicroVMRequest) GetId() string { +func (x *DeleteMicroVMRequest) GetUid() string { if x != nil { - return x.Id - } - return "" -} - -func (x *DeleteMicroVMRequest) GetNamespace() string { - if x != nil { - return x.Namespace + return x.Uid } return "" } @@ -188,8 +180,7 @@ type GetMicroVMRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"` + Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"` } func (x *GetMicroVMRequest) Reset() { @@ -224,16 +215,9 @@ func (*GetMicroVMRequest) Descriptor() ([]byte, []int) { return file_services_microvm_v1alpha1_microvms_proto_rawDescGZIP(), []int{3} } -func (x *GetMicroVMRequest) GetId() string { - if x != nil { - return x.Id - } - return "" -} - -func (x *GetMicroVMRequest) GetNamespace() string { +func (x *GetMicroVMRequest) GetUid() string { if x != nil { - return x.Namespace + return x.Uid } return "" } @@ -466,93 +450,88 @@ var file_services_microvm_v1alpha1_microvms_proto_rawDesc = []byte{ 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x07, 0x6d, - 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x22, 0x44, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, - 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, - 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x41, 0x0a, 0x11, - 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, - 0x48, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, - 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, - 0x52, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x22, 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x73, - 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x4a, - 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, - 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, - 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, - 0x4d, 0x52, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x22, 0x41, 0x0a, 0x0b, 0x4c, 0x69, - 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x69, 0x63, - 0x72, 0x6f, 0x76, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x69, - 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, - 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x32, 0xe5, 0x05, - 0x0a, 0x07, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x95, 0x01, 0x0a, 0x0d, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x33, 0x2e, 0x6d, 0x69, - 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x34, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, - 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, - 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, - 0x6d, 0x12, 0x88, 0x01, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, + 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x22, 0x28, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, + 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, + 0x22, 0x25, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x22, 0x48, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, + 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, + 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, + 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, + 0x6d, 0x22, 0x33, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, + 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x22, 0x4a, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, + 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, + 0x0a, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x18, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, + 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x76, 0x6d, 0x22, 0x41, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x07, 0x6d, 0x69, + 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x32, 0xce, 0x05, 0x0a, 0x07, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, + 0x4d, 0x12, 0x95, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x33, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, - 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, - 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x2a, 0x22, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9d, 0x01, 0x0a, - 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x30, 0x2e, 0x6d, 0x69, - 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, - 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, - 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, - 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x9e, 0x01, 0x0a, - 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x12, 0x32, 0x2e, - 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, - 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, 0x1d, - 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, - 0x6d, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x12, 0x76, 0x0a, - 0x12, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x12, 0x32, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, - 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, + 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, + 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, + 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x22, 0x11, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, + 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x12, 0x7d, 0x0a, 0x0d, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x33, 0x2e, 0x6d, 0x69, 0x63, + 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, + 0x17, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x76, 0x6d, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x92, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, + 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x12, 0x30, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0xda, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x65, 0x61, 0x76, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, 0x2f, - 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2f, 0x76, - 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x92, 0x41, 0x97, 0x01, 0x12, 0x71, 0x0a, 0x15, 0x46, - 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, - 0x20, 0x41, 0x50, 0x49, 0x12, 0x53, 0x54, 0x68, 0x65, 0x20, 0x46, 0x6c, 0x69, 0x6e, 0x74, 0x6c, - 0x6f, 0x63, 0x6b, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x20, 0x41, 0x50, 0x49, 0x20, - 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, - 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x69, 0x6e, 0x67, - 0x20, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x73, 0x32, 0x03, 0x30, 0x2e, 0x31, 0x32, 0x10, - 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, - 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, - 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, + 0x56, 0x4d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31, 0x2e, 0x6d, 0x69, 0x63, 0x72, + 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x63, + 0x72, 0x6f, 0x56, 0x4d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x19, 0x12, 0x17, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, + 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2f, 0x7b, 0x75, 0x69, 0x64, 0x7d, 0x12, 0x9e, 0x01, + 0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x12, 0x32, + 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x33, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, + 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x12, + 0x1d, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x76, 0x6d, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x7d, 0x12, 0x76, + 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x73, 0x53, 0x74, + 0x72, 0x65, 0x61, 0x6d, 0x12, 0x32, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2e, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x31, 0x61, 0x6c, + 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6d, 0x69, 0x63, 0x72, 0x6f, + 0x76, 0x6d, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x30, 0x01, 0x42, 0xda, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x65, 0x61, 0x76, 0x65, 0x77, 0x6f, 0x72, 0x6b, 0x73, + 0x2f, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x2f, + 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x92, 0x41, 0x97, 0x01, 0x12, 0x71, 0x0a, 0x15, + 0x46, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, + 0x4d, 0x20, 0x41, 0x50, 0x49, 0x12, 0x53, 0x54, 0x68, 0x65, 0x20, 0x46, 0x6c, 0x69, 0x6e, 0x74, + 0x6c, 0x6f, 0x63, 0x6b, 0x20, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x20, 0x41, 0x50, 0x49, + 0x20, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x73, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x73, 0x69, 0x6f, + 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x69, 0x6e, + 0x67, 0x20, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x76, 0x6d, 0x73, 0x32, 0x03, 0x30, 0x2e, 0x31, 0x32, + 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, + 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, + 0x73, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/services/microvm/v1alpha1/microvms.pb.gw.go b/api/services/microvm/v1alpha1/microvms.pb.gw.go index 3cae23396..2a52d0d00 100644 --- a/api/services/microvm/v1alpha1/microvms.pb.gw.go +++ b/api/services/microvm/v1alpha1/microvms.pb.gw.go @@ -78,24 +78,14 @@ func request_MicroVM_DeleteMicroVM_0(ctx context.Context, marshaler runtime.Mars _ = err ) - val, ok = pathParams["namespace"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace") - } - - protoReq.Namespace, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err) - } - - val, ok = pathParams["id"] + val, ok = pathParams["uid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") } - protoReq.Id, err = runtime.String(val) + protoReq.Uid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) } msg, err := client.DeleteMicroVM(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -114,24 +104,14 @@ func local_request_MicroVM_DeleteMicroVM_0(ctx context.Context, marshaler runtim _ = err ) - val, ok = pathParams["namespace"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace") - } - - protoReq.Namespace, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err) - } - - val, ok = pathParams["id"] + val, ok = pathParams["uid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") } - protoReq.Id, err = runtime.String(val) + protoReq.Uid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) } msg, err := server.DeleteMicroVM(ctx, &protoReq) @@ -150,24 +130,14 @@ func request_MicroVM_GetMicroVM_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["namespace"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace") - } - - protoReq.Namespace, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err) - } - - val, ok = pathParams["id"] + val, ok = pathParams["uid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") } - protoReq.Id, err = runtime.String(val) + protoReq.Uid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) } msg, err := client.GetMicroVM(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -186,24 +156,14 @@ func local_request_MicroVM_GetMicroVM_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["namespace"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "namespace") - } - - protoReq.Namespace, err = runtime.String(val) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "namespace", err) - } - - val, ok = pathParams["id"] + val, ok = pathParams["uid"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "uid") } - protoReq.Id, err = runtime.String(val) + protoReq.Uid, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "uid", err) } msg, err := server.GetMicroVM(ctx, &protoReq) @@ -323,7 +283,7 @@ func RegisterMicroVMHandlerServer(ctx context.Context, mux *runtime.ServeMux, se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/DeleteMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{namespace}/{id}")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/DeleteMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{uid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -346,7 +306,7 @@ func RegisterMicroVMHandlerServer(ctx context.Context, mux *runtime.ServeMux, se var stream runtime.ServerTransportStream ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/GetMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{namespace}/{id}")) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/GetMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{uid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -458,7 +418,7 @@ func RegisterMicroVMHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/DeleteMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{namespace}/{id}")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/DeleteMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{uid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -478,7 +438,7 @@ func RegisterMicroVMHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/GetMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{namespace}/{id}")) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/microvm.services.api.v1alpha1.MicroVM/GetMicroVM", runtime.WithHTTPPathPattern("/v1alpha1/microvm/{uid}")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -540,9 +500,9 @@ func RegisterMicroVMHandlerClient(ctx context.Context, mux *runtime.ServeMux, cl var ( pattern_MicroVM_CreateMicroVM_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1alpha1", "microvm"}, "")) - pattern_MicroVM_DeleteMicroVM_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"v1alpha1", "microvm", "namespace", "id"}, "")) + pattern_MicroVM_DeleteMicroVM_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "microvm", "uid"}, "")) - pattern_MicroVM_GetMicroVM_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 1, 0, 4, 1, 5, 3}, []string{"v1alpha1", "microvm", "namespace", "id"}, "")) + pattern_MicroVM_GetMicroVM_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "microvm", "uid"}, "")) pattern_MicroVM_ListMicroVMs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1alpha1", "microvm", "namespace"}, "")) diff --git a/api/services/microvm/v1alpha1/microvms.proto b/api/services/microvm/v1alpha1/microvms.proto index ce1c9540d..548e2ae3d 100644 --- a/api/services/microvm/v1alpha1/microvms.proto +++ b/api/services/microvm/v1alpha1/microvms.proto @@ -30,12 +30,12 @@ service MicroVM { } rpc DeleteMicroVM(DeleteMicroVMRequest) returns (google.protobuf.Empty) { option (google.api.http) = { - delete: "/v1alpha1/microvm/{namespace}/{id}" + delete: "/v1alpha1/microvm/{uid}" }; } rpc GetMicroVM(GetMicroVMRequest) returns (GetMicroVMResponse) { option (google.api.http) = { - get: "/v1alpha1/microvm/{namespace}/{id}" + get: "/v1alpha1/microvm/{uid}" }; } rpc ListMicroVMs(ListMicroVMsRequest) returns (ListMicroVMsResponse) { @@ -56,13 +56,11 @@ message CreateMicroVMResponse { } message DeleteMicroVMRequest { - string id = 1; - string namespace = 2; + string uid = 1; } message GetMicroVMRequest { - string id = 1; - string namespace = 2; + string uid = 1; } message GetMicroVMResponse { diff --git a/api/services/microvm/v1alpha1/microvms.swagger.json b/api/services/microvm/v1alpha1/microvms.swagger.json index dfa942ea4..7dab0324e 100644 --- a/api/services/microvm/v1alpha1/microvms.swagger.json +++ b/api/services/microvm/v1alpha1/microvms.swagger.json @@ -69,7 +69,7 @@ ] } }, - "/v1alpha1/microvm/{namespace}/{id}": { + "/v1alpha1/microvm/{uid}": { "get": { "operationId": "MicroVM_GetMicroVM", "responses": { @@ -88,13 +88,7 @@ }, "parameters": [ { - "name": "namespace", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "id", + "name": "uid", "in": "path", "required": true, "type": "string" @@ -122,13 +116,7 @@ }, "parameters": [ { - "name": "namespace", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "id", + "name": "uid", "in": "path", "required": true, "type": "string" @@ -333,6 +321,10 @@ "type": "string", "format": "date-time", "description": "DeletedAt indicates the time the microvm was marked as deleted." + }, + "uid": { + "type": "string", + "description": "UID is a globally unique identifier of the microvm." } }, "description": "MicroVMSpec represents the specification for a microvm." diff --git a/api/types/microvm.pb.go b/api/types/microvm.pb.go index 18687c5cb..ea574e0fa 100644 --- a/api/types/microvm.pb.go +++ b/api/types/microvm.pb.go @@ -271,6 +271,8 @@ type MicroVMSpec struct { UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,13,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // DeletedAt indicates the time the microvm was marked as deleted. DeletedAt *timestamppb.Timestamp `protobuf:"bytes,14,opt,name=deleted_at,json=deletedAt,proto3" json:"deleted_at,omitempty"` + // UID is a globally unique identifier of the microvm. + Uid *string `protobuf:"bytes,15,opt,name=uid,proto3,oneof" json:"uid,omitempty"` } func (x *MicroVMSpec) Reset() { @@ -403,6 +405,13 @@ func (x *MicroVMSpec) GetDeletedAt() *timestamppb.Timestamp { return nil } +func (x *MicroVMSpec) GetUid() string { + if x != nil && x.Uid != nil { + return *x.Uid + } + return "" +} + // Kernel represents the configuration for a kernel. type Kernel struct { state protoimpl.MessageState @@ -1162,7 +1171,7 @@ var file_types_microvm_proto_rawDesc = []byte{ 0x36, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, - 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xdb, 0x06, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xfa, 0x06, 0x0a, 0x0b, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x70, 0x65, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, @@ -1208,149 +1217,151 @@ var file_types_microvm_proto_rawDesc = []byte{ 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x64, - 0x41, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, - 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x69, - 0x6e, 0x69, 0x74, 0x72, 0x64, 0x22, 0xf6, 0x01, 0x0a, 0x06, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, - 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x63, 0x6d, 0x64, 0x6c, 0x69, 0x6e, - 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, - 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, - 0x2e, 0x43, 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, - 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, - 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x64, 0x64, 0x5f, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x10, 0x61, 0x64, 0x64, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x3a, 0x0a, 0x0c, 0x43, 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, + 0x41, 0x74, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x01, 0x52, 0x03, 0x75, 0x69, 0x64, 0x88, 0x01, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, + 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4c, - 0x0a, 0x06, 0x49, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1f, - 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, - 0x0b, 0x0a, 0x09, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x02, 0x0a, - 0x10, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3f, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x66, - 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, - 0x49, 0x66, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, - 0x20, 0x0a, 0x09, 0x67, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x67, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x88, 0x01, - 0x01, 0x12, 0x3d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, - 0x22, 0x21, 0x0a, 0x09, 0x49, 0x66, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, - 0x07, 0x4d, 0x41, 0x43, 0x56, 0x54, 0x41, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x41, - 0x50, 0x10, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, - 0x63, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x76, 0x0a, - 0x0d, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, - 0x77, 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, - 0x65, 0x77, 0x61, 0x79, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61, - 0x6d, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x67, 0x61, - 0x74, 0x65, 0x77, 0x61, 0x79, 0x22, 0xfd, 0x01, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x6e, - 0x6c, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x6f, - 0x69, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, - 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x26, 0x0a, 0x0c, 0x70, 0x61, - 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x48, 0x00, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, - 0x01, 0x01, 0x12, 0x21, 0x0a, 0x0a, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x69, 0x6e, 0x5f, 0x6d, 0x62, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x08, 0x73, 0x69, 0x7a, 0x65, 0x49, 0x6e, - 0x4d, 0x62, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, - 0x69, 0x6e, 0x5f, 0x6d, 0x62, 0x22, 0x53, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, - 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, - 0x00, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, - 0x6e, 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2d, 0x0a, 0x15, 0x43, 0x6f, - 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x6f, 0x75, - 0x72, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x99, 0x05, 0x0a, 0x0d, 0x4d, 0x69, - 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x73, - 0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x66, 0x6c, 0x69, - 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, - 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, - 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x45, - 0x0a, 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2b, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, - 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x76, 0x6f, - 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x0c, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, - 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, - 0x75, 0x6e, 0x74, 0x52, 0x0b, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x4d, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x39, 0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x5f, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, - 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x0b, - 0x69, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x12, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, - 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, - 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, - 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x73, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x1a, 0x59, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, - 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, - 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, - 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x1a, 0x6d, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, - 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, - 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, + 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x69, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x42, 0x06, 0x0a, 0x04, + 0x5f, 0x75, 0x69, 0x64, 0x22, 0xf6, 0x01, 0x0a, 0x06, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x12, + 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x63, 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, + 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x2e, + 0x43, 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x63, 0x6d, + 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1f, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, + 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x64, 0x64, 0x5f, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x10, 0x61, 0x64, 0x64, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x1a, 0x3a, 0x0a, 0x0c, 0x43, 0x6d, 0x64, 0x6c, 0x69, 0x6e, 0x65, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x4c, 0x0a, + 0x06, 0x49, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, + 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x0b, + 0x0a, 0x09, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x8e, 0x02, 0x0a, 0x10, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x42, 0x0a, 0x0c, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0b, - 0x0a, 0x07, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, - 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x4c, 0x45, 0x54, - 0x49, 0x4e, 0x47, 0x10, 0x03, 0x22, 0x3c, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, - 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x05, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x66, 0x6c, 0x69, + 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x3f, 0x0a, + 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x66, 0x6c, + 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x49, + 0x66, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x20, + 0x0a, 0x09, 0x67, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x48, 0x00, 0x52, 0x08, 0x67, 0x75, 0x65, 0x73, 0x74, 0x4d, 0x61, 0x63, 0x88, 0x01, 0x01, + 0x12, 0x3d, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x48, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x88, 0x01, 0x01, 0x22, + 0x21, 0x0a, 0x09, 0x49, 0x66, 0x61, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, + 0x4d, 0x41, 0x43, 0x56, 0x54, 0x41, 0x50, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x54, 0x41, 0x50, + 0x10, 0x01, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x67, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x63, + 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x76, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x07, 0x67, 0x61, 0x74, 0x65, 0x77, + 0x61, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, 0x67, 0x61, 0x74, 0x65, + 0x77, 0x61, 0x79, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61, 0x6d, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x67, 0x61, 0x74, + 0x65, 0x77, 0x61, 0x79, 0x22, 0xfd, 0x01, 0x0a, 0x06, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x69, 0x73, 0x52, 0x65, 0x61, 0x64, 0x4f, 0x6e, 0x6c, + 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x50, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, + 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x26, 0x0a, 0x0c, 0x70, 0x61, 0x72, + 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, + 0x01, 0x12, 0x21, 0x0a, 0x0a, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x69, 0x6e, 0x5f, 0x6d, 0x62, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x08, 0x73, 0x69, 0x7a, 0x65, 0x49, 0x6e, 0x4d, + 0x62, 0x88, 0x01, 0x01, 0x42, 0x0f, 0x0a, 0x0d, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x69, + 0x6e, 0x5f, 0x6d, 0x62, 0x22, 0x53, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x2e, 0x0a, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, + 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, + 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x53, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x88, 0x01, 0x01, 0x42, 0x13, 0x0a, 0x11, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, + 0x65, 0x72, 0x5f, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x2d, 0x0a, 0x15, 0x43, 0x6f, 0x6e, + 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x6f, 0x75, 0x72, + 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x99, 0x05, 0x0a, 0x0d, 0x4d, 0x69, 0x63, + 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x41, 0x0a, 0x05, 0x73, 0x74, + 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x66, 0x6c, 0x69, 0x6e, + 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, + 0x4d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x45, 0x0a, + 0x07, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, + 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, + 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x56, + 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x76, 0x6f, 0x6c, + 0x75, 0x6d, 0x65, 0x73, 0x12, 0x39, 0x0a, 0x0c, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x5f, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, - 0x6e, 0x74, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, - 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x22, 0x0a, 0x09, 0x4d, 0x6f, - 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x45, 0x56, 0x10, 0x00, - 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x4f, 0x53, 0x54, 0x50, 0x41, 0x54, 0x48, 0x10, 0x01, 0x22, 0x79, - 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, - 0x63, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x6f, 0x73, 0x74, - 0x5f, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0e, 0x68, 0x6f, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, - 0x61, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x65, 0x61, 0x76, 0x65, 0x77, 0x6f, 0x72, - 0x6b, 0x73, 0x2f, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x74, 0x52, 0x0b, 0x6b, 0x65, 0x72, 0x6e, 0x65, 0x6c, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x39, 0x0a, 0x0c, 0x69, 0x6e, 0x69, 0x74, 0x72, 0x64, 0x5f, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, + 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x0b, 0x69, + 0x6e, 0x69, 0x74, 0x72, 0x64, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x64, 0x0a, 0x12, 0x6e, 0x65, + 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, + 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, + 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, + 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x11, 0x6e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x72, 0x65, 0x74, 0x72, 0x79, 0x1a, 0x59, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, + 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x33, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, + 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, + 0x01, 0x1a, 0x6d, 0x0a, 0x16, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x66, 0x61, 0x63, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x3d, 0x0a, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x66, + 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4e, + 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x22, 0x42, 0x0a, 0x0c, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x56, 0x4d, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x45, 0x4e, 0x44, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0b, 0x0a, + 0x07, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, + 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x49, + 0x4e, 0x47, 0x10, 0x03, 0x22, 0x3c, 0x0a, 0x0c, 0x56, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x05, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x22, 0x79, 0x0a, 0x05, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x34, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x20, 0x2e, 0x66, 0x6c, 0x69, 0x6e, + 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, + 0x74, 0x2e, 0x4d, 0x6f, 0x75, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x22, 0x0a, 0x09, 0x4d, 0x6f, 0x75, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x45, 0x56, 0x10, 0x00, 0x12, + 0x0c, 0x0a, 0x08, 0x48, 0x4f, 0x53, 0x54, 0x50, 0x41, 0x54, 0x48, 0x10, 0x01, 0x22, 0x79, 0x0a, + 0x16, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, + 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x68, 0x6f, 0x73, 0x74, 0x5f, + 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x68, 0x6f, 0x73, 0x74, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x63, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, + 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x77, 0x65, 0x61, 0x76, 0x65, 0x77, 0x6f, 0x72, 0x6b, + 0x73, 0x2f, 0x66, 0x6c, 0x69, 0x6e, 0x74, 0x6c, 0x6f, 0x63, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/api/types/microvm.proto b/api/types/microvm.proto index 03465009e..c2d506f84 100644 --- a/api/types/microvm.proto +++ b/api/types/microvm.proto @@ -21,7 +21,7 @@ message MicroVMSpec { // If this empty at creation time a ID will be automatically generated. string id = 1; - // Namespace is the name of the namespace the microvm belongs to. + // Namespace is the name of the namespace the microvm belongs to. string namespace = 2; // Labels allows you to include extra data for the microvms. @@ -62,6 +62,10 @@ message MicroVMSpec { // DeletedAt indicates the time the microvm was marked as deleted. google.protobuf.Timestamp deleted_at = 14; + + // UID is a globally unique identifier of the microvm. + optional string uid = 15; + } // Kernel represents the configuration for a kernel. diff --git a/core/application/app_test.go b/core/application/app_test.go index b0d20d987..9d3bfff42 100644 --- a/core/application/app_test.go +++ b/core/application/app_test.go @@ -18,6 +18,10 @@ import ( "github.com/weaveworks/flintlock/pkg/defaults" ) +const ( + testUID = "34b8fc8e-6246-11ec-90d6-0242ac120003" +) + func TestApp_CreateMicroVM(t *testing.T) { frozenTime := time.Now @@ -38,13 +42,15 @@ func TestApp_CreateMicroVM(t *testing.T) { specToCreate: createTestSpec("", ""), expectError: false, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { - im.GenerateRandom().Return("id1234", nil) + im.GenerateRandom().Return("id1234", nil).Times(1) + im.GenerateRandom().Return(testUID, nil).Times(1) rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ Name: "id1234", Namespace: defaults.MicroVMNamespace, + UID: testUID, }), ).Return(nil, nil) @@ -66,6 +72,7 @@ func TestApp_CreateMicroVM(t *testing.T) { gomock.Eq(&events.MicroVMSpecCreated{ ID: "id1234", Namespace: defaults.MicroVMNamespace, + UID: testUID, }), ) }, @@ -75,11 +82,13 @@ func TestApp_CreateMicroVM(t *testing.T) { specToCreate: createTestSpec("id1234", "default"), expectError: false, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { + im.GenerateRandom().Return(testUID, nil).Times(1) rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ Name: "id1234", Namespace: "default", + UID: testUID, }), ).Return( nil, @@ -104,6 +113,7 @@ func TestApp_CreateMicroVM(t *testing.T) { gomock.Eq(&events.MicroVMSpecCreated{ ID: "id1234", Namespace: "default", + UID: testUID, }), ) }, @@ -113,11 +123,13 @@ func TestApp_CreateMicroVM(t *testing.T) { specToCreate: createTestSpec("id1234", "default"), expectError: true, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { + im.GenerateRandom().Return(testUID, nil).Times(1) rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ Name: "id1234", Namespace: "default", + UID: testUID, }), ).Return( createTestSpec("id1234", "default"), @@ -172,30 +184,26 @@ func TestApp_DeleteMicroVM(t *testing.T) { testCases := []struct { name string - toDeleteID string - toDeleteNS string + toDeleteUID string expectError bool expect func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) }{ { name: "empty id, should fail", expectError: true, - toDeleteID: "", - toDeleteNS: "default", + toDeleteUID: "", expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { }, }, { name: "spec exists, should delete", expectError: false, - toDeleteID: "id1234", - toDeleteNS: "default", + toDeleteUID: testUID, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ - Name: "id1234", - Namespace: "default", + UID: testUID, }), ).Return( createTestSpec("id1234", "default"), @@ -218,8 +226,7 @@ func TestApp_DeleteMicroVM(t *testing.T) { gomock.AssignableToTypeOf(context.Background()), gomock.Eq(defaults.TopicMicroVMEvents), gomock.Eq(&events.MicroVMSpecUpdated{ - ID: "id1234", - Namespace: "default", + UID: testUID, }), ) }, @@ -227,14 +234,12 @@ func TestApp_DeleteMicroVM(t *testing.T) { { name: "spec doesn't exist, should not delete", expectError: true, - toDeleteID: "id1234", - toDeleteNS: "default", + toDeleteUID: testUID, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ - Name: "id1234", - Namespace: "default", + UID: testUID, }), ).Return( nil, @@ -273,7 +278,7 @@ func TestApp_DeleteMicroVM(t *testing.T) { ctx := context.Background() app := application.New(&application.Config{}, ports) - err := app.DeleteMicroVM(ctx, tc.toDeleteID, tc.toDeleteNS) + err := app.DeleteMicroVM(ctx, tc.toDeleteUID) if tc.expectError { Expect(err).To(HaveOccurred()) @@ -289,38 +294,26 @@ func TestApp_GetMicroVM(t *testing.T) { tt := []struct { name string - toGetID string - toGetNS string + toGetUID string expectError bool expect func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) }{ { name: "empty id should return an error", - toGetID: "", - toGetNS: "default", - expectError: true, - expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { - }, - }, - { - name: "empty namespace should return an error", - toGetID: "id1234", - toGetNS: "", + toGetUID: "", expectError: true, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { }, }, { name: "spec not found should return an error", - toGetID: "id1234", - toGetNS: "default", + toGetUID: testUID, expectError: true, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ - Name: "id1234", - Namespace: defaults.MicroVMNamespace, + UID: testUID, }), ).Return( nil, @@ -330,15 +323,13 @@ func TestApp_GetMicroVM(t *testing.T) { }, { name: "should return an error when rm.Get returns an error", - toGetID: "id1234", - toGetNS: "default", + toGetUID: testUID, expectError: true, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ - Name: "id1234", - Namespace: defaults.MicroVMNamespace, + UID: testUID, }), ).Return( nil, @@ -348,15 +339,13 @@ func TestApp_GetMicroVM(t *testing.T) { }, { name: "microvm with id exists in namespace and is returned", - toGetID: "id1234", - toGetNS: "default", + toGetUID: testUID, expectError: false, expect: func(rm *mock.MockMicroVMRepositoryMockRecorder, em *mock.MockEventServiceMockRecorder, im *mock.MockIDServiceMockRecorder, pm *mock.MockMicroVMServiceMockRecorder) { rm.Get( gomock.AssignableToTypeOf(context.Background()), gomock.Eq(ports.RepositoryGetOptions{ - Name: "id1234", - Namespace: defaults.MicroVMNamespace, + UID: testUID, }), ).Return( createTestSpec("id1234", "default"), @@ -395,15 +384,13 @@ func TestApp_GetMicroVM(t *testing.T) { ctx := context.Background() app := application.New(&application.Config{}, ports) - mvm, err := app.GetMicroVM(ctx, tc.toGetID, tc.toGetNS) + mvm, err := app.GetMicroVM(ctx, tc.toGetUID) if tc.expectError { Expect(err).To(HaveOccurred()) } else { Expect(err).NotTo(HaveOccurred()) Expect(mvm.Spec).NotTo(BeNil()) - Expect(mvm.ID.Name()).To(Equal(tc.toGetID)) - Expect(mvm.ID.Namespace()).To(Equal(tc.toGetNS)) } }) } @@ -531,7 +518,7 @@ func createTestSpec(name, ns string) *models.MicroVM { if name == "" && ns == "" { vmid = &models.VMID{} } else { - vmid, _ = models.NewVMID(name, ns) + vmid, _ = models.NewVMID(name, ns, testUID) } return &models.MicroVM{ diff --git a/core/application/commands.go b/core/application/commands.go index f178de0ef..fa0cf927b 100644 --- a/core/application/commands.go +++ b/core/application/commands.go @@ -26,7 +26,7 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M return nil, fmt.Errorf("generating random name for microvm: %w", err) } - vmid, err := models.NewVMID(name, defaults.MicroVMNamespace) + vmid, err := models.NewVMID(name, defaults.MicroVMNamespace, "") if err != nil { return nil, fmt.Errorf("creating vmid: %w", err) } @@ -34,9 +34,17 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M mvm.ID = *vmid } + uid, err := a.ports.IdentifierService.GenerateRandom() + if err != nil { + return nil, fmt.Errorf("generating random ID for microvm: %w", err) + } + + mvm.ID.SetUID(uid) + foundMvm, err := a.ports.Repo.Get(ctx, ports.RepositoryGetOptions{ Name: mvm.ID.Name(), Namespace: mvm.ID.Namespace(), + UID: mvm.ID.UID(), }) if err != nil { if !coreerrs.IsSpecNotFound(err) { @@ -48,6 +56,7 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M return nil, specAlreadyExistsError{ name: mvm.ID.Name(), namespace: mvm.ID.Namespace(), + uid: mvm.ID.UID(), } } @@ -64,6 +73,7 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M if err := a.ports.EventService.Publish(ctx, defaults.TopicMicroVMEvents, &events.MicroVMSpecCreated{ ID: mvm.ID.Name(), Namespace: mvm.ID.Namespace(), + UID: mvm.ID.UID(), }); err != nil { return nil, fmt.Errorf("publishing microvm created event: %w", err) } @@ -71,17 +81,16 @@ func (a *app) CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.M return createdMVM, nil } -func (a *app) DeleteMicroVM(ctx context.Context, id, namespace string) error { +func (a *app) DeleteMicroVM(ctx context.Context, uid string) error { logger := log.GetLogger(ctx).WithField("component", "app") logger.Trace("deleting microvm") - if id == "" { - return errIDRequired + if uid == "" { + return errUIDRequired } foundMvm, err := a.ports.Repo.Get(ctx, ports.RepositoryGetOptions{ - Name: id, - Namespace: namespace, + UID: uid, }) if err != nil { return fmt.Errorf("checking to see if spec exists: %w", err) @@ -89,8 +98,7 @@ func (a *app) DeleteMicroVM(ctx context.Context, id, namespace string) error { if foundMvm == nil { return specNotFoundError{ - name: id, - namespace: namespace, + uid: uid, } } @@ -105,8 +113,7 @@ func (a *app) DeleteMicroVM(ctx context.Context, id, namespace string) error { } if err := a.ports.EventService.Publish(ctx, defaults.TopicMicroVMEvents, &events.MicroVMSpecUpdated{ - ID: foundMvm.ID.Name(), - Namespace: foundMvm.ID.Namespace(), + UID: foundMvm.ID.UID(), }); err != nil { return fmt.Errorf("publishing microvm updated event: %w", err) } diff --git a/core/application/errors.go b/core/application/errors.go index 755569ec5..383002890 100644 --- a/core/application/errors.go +++ b/core/application/errors.go @@ -8,28 +8,34 @@ import ( ) var ( - errIDRequired = errors.New("microvm id is required") errNamespaceRequired = errors.New("namespace is required") + errUIDRequired = errors.New("uid is required") ) type specAlreadyExistsError struct { name string namespace string + uid string } // Error returns the error message. func (e specAlreadyExistsError) Error() string { - return fmt.Sprintf("microvm spec %s/%s already exists", e.namespace, e.name) + return fmt.Sprintf("microvm spec %s/%s/%s already exists", e.namespace, e.name, e.uid) } type specNotFoundError struct { name string namespace string + uid string } // Error returns the error message. func (e specNotFoundError) Error() string { - return fmt.Sprintf("microvm spec %s/%s not found", e.namespace, e.name) + if e.name != "" { + return fmt.Sprintf("microvm spec %s/%s/%s not found", e.namespace, e.name, e.uid) + } + + return fmt.Sprintf("microvm spec %s not found", e.uid) } type reachedMaximumRetryError struct { diff --git a/core/application/query.go b/core/application/query.go index ec61ccd76..912493fe6 100644 --- a/core/application/query.go +++ b/core/application/query.go @@ -9,27 +9,26 @@ import ( "github.com/weaveworks/flintlock/pkg/log" ) -func (a *app) GetMicroVM(ctx context.Context, id, namespace string) (*models.MicroVM, error) { +func (a *app) GetMicroVM(ctx context.Context, uid string) (*models.MicroVM, error) { logger := log.GetLogger(ctx).WithField("component", "app") - logger.Tracef("querying microvm: %s, with namespace: %s", id, namespace) + logger.Tracef("querying microvm: %s", uid) - if id == "" { - return nil, errIDRequired + if uid == "" { + return nil, errUIDRequired } - if namespace == "" { - return nil, errNamespaceRequired + getOptions := ports.RepositoryGetOptions{ + UID: uid, } - foundMvm, err := a.ports.Repo.Get(ctx, ports.RepositoryGetOptions{Name: id, Namespace: namespace}) + foundMvm, err := a.ports.Repo.Get(ctx, getOptions) if err != nil { - return nil, fmt.Errorf("error attempting to locate microvm with id: %s, in namespace: %s: %w", id, namespace, err) + return nil, fmt.Errorf("error attempting to locate microvm with uid: %s: %w", uid, err) } if foundMvm == nil { return nil, specNotFoundError{ - name: id, - namespace: namespace, + uid: uid, } } diff --git a/core/application/reconcile.go b/core/application/reconcile.go index 2a4bae1f8..146852dd7 100644 --- a/core/application/reconcile.go +++ b/core/application/reconcile.go @@ -19,14 +19,15 @@ import ( const backoffBaseInSeconds = 20 -func (a *app) ReconcileMicroVM(ctx context.Context, id, namespace string) error { +func (a *app) ReconcileMicroVM(ctx context.Context, vmid models.VMID) error { logger := log.GetLogger(ctx).WithField("action", "reconcile") - logger.Debugf("Getting spec for %s/%s", namespace, id) + logger.Debugf("Getting spec for %s", vmid.String()) spec, err := a.ports.Repo.Get(ctx, ports.RepositoryGetOptions{ - Name: id, - Namespace: namespace, + Name: vmid.Name(), + Namespace: vmid.Namespace(), + UID: vmid.UID(), }) if err != nil { return fmt.Errorf("getting microvm spec for reconcile: %w", err) @@ -95,21 +96,20 @@ func (a *app) reschedule(ctx context.Context, logger *logrus.Entry, spec *models return fmt.Errorf("saving spec failed: %w", err) } - go func(id, ns string, sleepTime time.Duration) { + go func(uid string, sleepTime time.Duration) { time.Sleep(sleepTime) err := a.ports.EventService.Publish( context.Background(), defaults.TopicMicroVMEvents, &events.MicroVMSpecUpdated{ - ID: id, - Namespace: ns, + UID: uid, }, ) if err != nil { - logger.Errorf("failed to publish an update event for %s/%s", ns, id) + logger.Errorf("failed to publish an update event for %s", uid) } - }(spec.ID.Name(), spec.ID.Namespace(), waitTime) + }(spec.ID.UID(), waitTime) return nil } diff --git a/core/errors/errors.go b/core/errors/errors.go index 7057e9d5b..bfba3e8fb 100644 --- a/core/errors/errors.go +++ b/core/errors/errors.go @@ -9,6 +9,7 @@ var ( ErrSpecRequired = errors.New("microvm spec is required") ErrVMIDRequired = errors.New("id for microvm is required") ErrNameRequired = errors.New("name is required") + ErrUIDRequired = errors.New("uid is required") ErrNamespaceRequired = errors.New("namespace is required") ErrKernelImageRequired = errors.New("kernel image is required") ErrVolumeRequired = errors.New("no volumes specified, at least 1 volume is required") @@ -90,11 +91,12 @@ func (e NetworkInterfaceStatusMissingError) Error() string { return fmt.Sprintf("status for network interface %s is not found", e.guestIface) } -func NewSpecNotFound(name, namespace, version string) error { +func NewSpecNotFound(name, namespace, version, uid string) error { return specNotFoundError{ name: name, namespace: namespace, version: version, + uid: uid, } } @@ -102,15 +104,16 @@ type specNotFoundError struct { name string namespace string version string + uid string } // Error returns the error message. func (e specNotFoundError) Error() string { if e.version == "" { - return fmt.Sprintf("microvm spec %s/%s not found", e.namespace, e.name) + return fmt.Sprintf("microvm spec %s/%s/%s not found", e.namespace, e.name, e.uid) } - return fmt.Sprintf("microvm spec %s/%s not found with version %s", e.namespace, e.name, e.version) + return fmt.Sprintf("microvm spec %s/%s/%s not found with version %s", e.namespace, e.name, e.uid, e.version) } // IsSpecNotFound tests an error to see if its a spec not found error. diff --git a/core/models/vmid.go b/core/models/vmid.go index 0fc17a43b..393b9ec05 100644 --- a/core/models/vmid.go +++ b/core/models/vmid.go @@ -10,7 +10,7 @@ import ( ) const ( - numPartsForID = 2 + numPartsForID = 3 ) var ( @@ -23,10 +23,11 @@ var ( type VMID struct { name string namespace string + uid string } -// NewVMID creates a new VMID from a name and namespace. -func NewVMID(name, namespace string) (*VMID, error) { +// NewVMID creates a new VMID from a name, namespace and, UID. +func NewVMID(name, namespace, uid string) (*VMID, error) { if name == "" { return nil, coreerrs.ErrNameRequired } @@ -38,17 +39,28 @@ func NewVMID(name, namespace string) (*VMID, error) { return &VMID{ name: name, namespace: namespace, + uid: uid, }, nil } +// NewVMIDForce creates a new VMID from a name, namespace, and UID, but without +// any checks. In case we want to create a new UID, but ignore checks. +func NewVMIDForce(name, namespace, uid string) *VMID { + return &VMID{ + name: name, + namespace: namespace, + uid: uid, + } +} + // NewVMID creates a new VMID from a string. func NewVMIDFromString(id string) (*VMID, error) { - ns, name, err := splitVMIDFromString(id) + ns, name, uid, err := splitVMIDFromString(id) if err != nil { return nil, fmt.Errorf("populating id from string: %w", err) } - return NewVMID(name, ns) + return NewVMID(name, ns, uid) } // Name returns the name part of the VMID. @@ -61,9 +73,14 @@ func (v *VMID) Namespace() string { return v.namespace } +// UID returns the UID part of the VMID. +func (v *VMID) UID() string { + return v.uid +} + // String returns a string representation of the vmid. func (v VMID) String() string { - return fmt.Sprintf("%s/%s", v.namespace, v.name) + return fmt.Sprintf("%s/%s/%s", v.namespace, v.name, v.uid) } // MarshalText will marshall the vmid to a string representation. @@ -75,13 +92,14 @@ func (v *VMID) MarshalText() (text []byte, err error) { func (v *VMID) UnmarshalText(text []byte) error { id := string(text) - ns, name, err := splitVMIDFromString(id) + ns, name, uid, err := splitVMIDFromString(id) if err != nil { return fmt.Errorf("parsing vmid from string: %w", err) } v.name = name v.namespace = ns + v.uid = uid return nil } @@ -91,19 +109,27 @@ func (v *VMID) IsEmpty() bool { return v.name == "" && v.namespace == "" } -func splitVMIDFromString(id string) (namespace string, name string, err error) { +func (v *VMID) SetUID(uid string) { + v.uid = uid +} + +func splitVMIDFromString(id string) (namespace, name, uid string, err error) { parts := strings.Split(id, "/") if len(parts) != numPartsForID { - return "", "", coreerrs.IncorrectVMIDFormatError{ActualID: id} + return "", "", "", coreerrs.IncorrectVMIDFormatError{ActualID: id} } if parts[0] == "" { - return "", "", coreerrs.ErrNamespaceRequired + return "", "", "", coreerrs.ErrNamespaceRequired } if parts[1] == "" { - return "", "", coreerrs.ErrNameRequired + return "", "", "", coreerrs.ErrNameRequired + } + + if parts[2] == "" { + return "", "", "", coreerrs.ErrUIDRequired } - return parts[0], parts[1], nil + return parts[0], parts[1], parts[2], nil } diff --git a/core/models/vmid_test.go b/core/models/vmid_test.go index ccad1daaf..00b50807b 100644 --- a/core/models/vmid_test.go +++ b/core/models/vmid_test.go @@ -9,6 +9,10 @@ import ( "github.com/weaveworks/flintlock/core/models" ) +const ( + testUID = "344780b0-6249-11ec-90d6-0242ac120003" +) + func TestVMID_New(t *testing.T) { RegisterTestingT(t) @@ -34,7 +38,7 @@ func TestVMID_New(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - vmid, err := models.NewVMID(tc.vmName, tc.vmNamespace) + vmid, err := models.NewVMID(tc.vmName, tc.vmNamespace, testUID) if tc.expectError { Expect(err).To(HaveOccurred()) @@ -58,7 +62,7 @@ func TestVMID_NewFromString(t *testing.T) { }{ { name: "correct structure", - input: "ns1/test1", + input: "ns1/test1/344780b0-6249-11ec-90d6-0242ac120003", expectError: false, expectedNS: "ns1", expectedName: "test1", @@ -99,7 +103,7 @@ func TestVMID_NewFromString(t *testing.T) { func TestVMID_Marshalling(t *testing.T) { RegisterTestingT(t) - id1, err := models.NewVMID("name", "namespace") + id1, err := models.NewVMID("name", "namespace", testUID) Expect(err).ToNot(HaveOccurred()) data, err := json.Marshal(id1) @@ -114,7 +118,7 @@ func TestVMID_Marshalling(t *testing.T) { func TestVMID_EmbeddedMarshalling(t *testing.T) { RegisterTestingT(t) - id1, err := models.NewVMID("name", "namespace") + id1, err := models.NewVMID("name", "namespace", testUID) Expect(err).ToNot(HaveOccurred()) s1 := struct { diff --git a/core/plans/helper_test.go b/core/plans/helper_test.go index 52257119a..a5a031635 100644 --- a/core/plans/helper_test.go +++ b/core/plans/helper_test.go @@ -10,6 +10,10 @@ import ( "github.com/weaveworks/flintlock/infrastructure/mock" ) +const ( + testUID = "ae1ce196-6249-11ec-90d6-0242ac120003" +) + type mockList struct { MicroVMRepository *mock.MockMicroVMRepository EventService *mock.MockEventService @@ -47,7 +51,7 @@ func createTestSpec(name, ns string) *models.MicroVM { if name == "" && ns == "" { vmid = &models.VMID{} } else { - vmid, _ = models.NewVMID(name, ns) + vmid, _ = models.NewVMID(name, ns, testUID) } return &models.MicroVM{ diff --git a/core/plans/microvm_create_update_test.go b/core/plans/microvm_create_update_test.go index f4017712f..1301b9181 100644 --- a/core/plans/microvm_create_update_test.go +++ b/core/plans/microvm_create_update_test.go @@ -31,7 +31,7 @@ func TestMicroVMCreateOrUpdatePlan(t *testing.T) { mList.MicroVMService. EXPECT(). - State(gomock.Any(), gomock.Eq("namespace/vmid")). + State(gomock.Any(), gomock.Eq("namespace/vmid/ae1ce196-6249-11ec-90d6-0242ac120003")). DoAndReturn(func(_ context.Context, _ string) (ports.MicroVMState, error) { return ports.MicroVMStatePending, nil }). @@ -79,7 +79,7 @@ func TestMicroVMCreateOrUpdatePlan(t *testing.T) { gomock.Any(), gomock.Eq(&ports.ImageMountSpec{ ImageName: "docker.io/library/ubuntu:myimage", - Owner: "namespace/vmid", + Owner: "namespace/vmid/ae1ce196-6249-11ec-90d6-0242ac120003", OwnerUsageID: "root", Use: "volume", }), @@ -93,7 +93,7 @@ func TestMicroVMCreateOrUpdatePlan(t *testing.T) { gomock.Any(), gomock.Eq(&ports.ImageMountSpec{ ImageName: "docker.io/linuxkit/kernel:5.4.129", - Owner: "namespace/vmid", + Owner: "namespace/vmid/ae1ce196-6249-11ec-90d6-0242ac120003", OwnerUsageID: "kernel", Use: "kernel", }), diff --git a/core/plans/microvm_delete.go b/core/plans/microvm_delete.go index 9535f9c0e..066ccd569 100644 --- a/core/plans/microvm_delete.go +++ b/core/plans/microvm_delete.go @@ -80,8 +80,7 @@ func (p *microvmDeletePlan) Create(ctx context.Context) ([]planner.Procedure, er publishStep := event.NewPublish( defaults.TopicMicroVMEvents, &events.MicroVMSpecDeleted{ - ID: p.vm.ID.Name(), - Namespace: p.vm.ID.Namespace(), + UID: p.vm.ID.UID(), }, ports.EventService, ) diff --git a/core/plans/microvm_delete_test.go b/core/plans/microvm_delete_test.go index f9505a21b..7512e1901 100644 --- a/core/plans/microvm_delete_test.go +++ b/core/plans/microvm_delete_test.go @@ -8,6 +8,7 @@ import ( "github.com/golang/mock/gomock" . "github.com/onsi/gomega" + "github.com/weaveworks/flintlock/core/models" "github.com/weaveworks/flintlock/core/plans" "github.com/weaveworks/flintlock/core/ports" portsctx "github.com/weaveworks/flintlock/core/ports/context" @@ -35,20 +36,22 @@ func TestMicroVMDeletePlan(t *testing.T) { mList.MicroVMService. EXPECT(). - State(gomock.Any(), gomock.Eq("namespace/vmid")). + State(gomock.Any(), gomock.Eq("namespace/vmid/ae1ce196-6249-11ec-90d6-0242ac120003")). DoAndReturn(func(_ context.Context, _ string) (ports.MicroVMState, error) { return ports.MicroVMStateRunning, nil }).AnyTimes() + vmid := models.NewVMIDForce("vmid", "namespace", testUID) + mList.MicroVMRepository. EXPECT(). - Exists(gomock.Any(), gomock.Eq("vmid"), gomock.Eq("namespace")). + Exists(gomock.Any(), gomock.Eq(*vmid)). Return(true, nil). AnyTimes() mList.MicroVMService. EXPECT(). - Delete(gomock.Any(), gomock.Eq("namespace/vmid")). + Delete(gomock.Any(), gomock.Eq("namespace/vmid/ae1ce196-6249-11ec-90d6-0242ac120003")). Return(nil). Times(1) diff --git a/core/ports/repositories.go b/core/ports/repositories.go index 35f7d2443..e56943e07 100644 --- a/core/ports/repositories.go +++ b/core/ports/repositories.go @@ -10,6 +10,7 @@ type RepositoryGetOptions struct { Name string Namespace string Version string + UID string } // MicroVMRepository is the port definition for a microvm repository. @@ -24,7 +25,7 @@ type MicroVMRepository interface { // details of microvms will be returned. GetAll(ctx context.Context, namespace string) ([]*models.MicroVM, error) // Exists checks to see if the microvm spec exists in the repo. - Exists(ctx context.Context, name, namespace string) (bool, error) + Exists(ctx context.Context, vmid models.VMID) (bool, error) // ReleaseLease will release the supplied lease. ReleaseLease(ctx context.Context, microvm *models.MicroVM) error } diff --git a/core/ports/usecases.go b/core/ports/usecases.go index 7f50734ae..bff797d70 100644 --- a/core/ports/usecases.go +++ b/core/ports/usecases.go @@ -11,13 +11,13 @@ type MicroVMCommandUseCases interface { // CreateMicroVM is a use case for creating a microvm. CreateMicroVM(ctx context.Context, mvm *models.MicroVM) (*models.MicroVM, error) // DeleteMicroVM is a use case for deleting a microvm. - DeleteMicroVM(ctx context.Context, id, namespace string) error + DeleteMicroVM(ctx context.Context, vmid string) error } // MicroVMQueryUseCases is the interface for uses cases that are queries for microvms. type MicroVMQueryUseCases interface { // GetMicroVM is a use case for getting details of a specific microvm. - GetMicroVM(ctx context.Context, id, namespace string) (*models.MicroVM, error) + GetMicroVM(ctx context.Context, vmid string) (*models.MicroVM, error) // GetAllMicroVM is a use case for getting details of all microvms in a given namespace. GetAllMicroVM(ctx context.Context, namespace string) ([]*models.MicroVM, error) } @@ -25,7 +25,7 @@ type MicroVMQueryUseCases interface { // ReconcileMicroVMsUseCase is the interface for use cases that are related to reconciling microvms. type ReconcileMicroVMsUseCase interface { // ReconcileMicroVM is a use case for reconciling a specific microvm. - ReconcileMicroVM(ctx context.Context, id, namespace string) error + ReconcileMicroVM(ctx context.Context, vmid models.VMID) error // ResyncMicroVMs is used to resync the microvms. If a namespace is supplied then it will // resync only the microvms in that namespaces. ResyncMicroVMs(ctx context.Context, namespace string) error diff --git a/core/steps/event/publish_test.go b/core/steps/event/publish_test.go index d1b000050..77b4620ff 100644 --- a/core/steps/event/publish_test.go +++ b/core/steps/event/publish_test.go @@ -16,6 +16,7 @@ const ( testTopic = "test-topic" testVMID = "testvm1" testNamespace = "testns" + testUID = "testuid" ) func TestNewPublish(t *testing.T) { @@ -26,8 +27,7 @@ func TestNewPublish(t *testing.T) { eventService := mock.NewMockEventService(mockCtrl) ctx := context.Background() evt := &events.MicroVMSpecDeleted{ - ID: testVMID, - Namespace: testNamespace, + UID: testUID, } eventService. @@ -57,8 +57,7 @@ func TestNewPublish_eventServiceFailure(t *testing.T) { eventService := mock.NewMockEventService(mockCtrl) ctx := context.Background() evt := &events.MicroVMSpecDeleted{ - ID: testVMID, - Namespace: testNamespace, + UID: testUID, } eventService. diff --git a/core/steps/microvm/create_test.go b/core/steps/microvm/create_test.go index 35731d9cc..bd8881b8c 100644 --- a/core/steps/microvm/create_test.go +++ b/core/steps/microvm/create_test.go @@ -15,7 +15,7 @@ import ( ) func testVMToCreate() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/core/steps/microvm/delete_test.go b/core/steps/microvm/delete_test.go index f509e7d93..18b745935 100644 --- a/core/steps/microvm/delete_test.go +++ b/core/steps/microvm/delete_test.go @@ -15,7 +15,7 @@ import ( ) func testVMToDelete() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/core/steps/microvm/start_test.go b/core/steps/microvm/start_test.go index 179effe94..1f23a4eaa 100644 --- a/core/steps/microvm/start_test.go +++ b/core/steps/microvm/start_test.go @@ -17,7 +17,7 @@ import ( const bootTimeInSeconds = 1 func testVMToStart() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/core/steps/network/interface_create_test.go b/core/steps/network/interface_create_test.go index c14c9b328..94f5304e3 100644 --- a/core/steps/network/interface_create_test.go +++ b/core/steps/network/interface_create_test.go @@ -20,7 +20,7 @@ func TestNewNetworkInterface_everythingIsEmpty(t *testing.T) { g.RegisterTestingT(t) var status *models.NetworkInterfaceStatus - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterface{} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -48,7 +48,7 @@ func TestNewNetworkInterface_doesNotExist(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) status := &models.NetworkInterfaceStatus{} iface := &models.NetworkInterface{ GuestDeviceName: defaultEthDevice, @@ -96,7 +96,7 @@ func TestNewNetworkInterface_emptyStatus(t *testing.T) { g.RegisterTestingT(t) var status *models.NetworkInterfaceStatus - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterface{GuestDeviceName: defaultEthDevice} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -132,7 +132,7 @@ func TestNewNetworkInterface_existingInterface(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterface{ GuestDeviceName: defaultEthDevice, AllowMetadataRequests: false, @@ -186,7 +186,7 @@ func TestNewNetworkInterface_missingInterface(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface, status := fullNetworkInterface() svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -232,7 +232,7 @@ func TestNewNetworkInterface_svcError(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface, status := fullNetworkInterface() svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -261,7 +261,7 @@ func TestNewNetworkInterface_fillChangedStatus(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface, status := fullNetworkInterface() iface.Type = models.IfaceTypeMacvtap svc := mock.NewMockNetworkService(mockCtrl) @@ -299,7 +299,7 @@ func TestNewNetworkInterface_createError(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) status := &models.NetworkInterfaceStatus{} iface := &models.NetworkInterface{GuestDeviceName: defaultEthDevice, Type: models.IfaceTypeTap} svc := mock.NewMockNetworkService(mockCtrl) diff --git a/core/steps/network/interface_delete_test.go b/core/steps/network/interface_delete_test.go index 26f718557..e986b9f49 100644 --- a/core/steps/network/interface_delete_test.go +++ b/core/steps/network/interface_delete_test.go @@ -20,7 +20,7 @@ func TestDeleteNetworkInterface_doesNotExist(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterfaceStatus{HostDeviceName: expectedTapDeviceName} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -54,7 +54,7 @@ func TestDeleteNetworkInterface_emptyStatus(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterfaceStatus{} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -78,7 +78,7 @@ func TestDeleteNetworkInterface_exists(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterfaceStatus{HostDeviceName: expectedTapDeviceName} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -120,7 +120,7 @@ func TestDeleteNetworkInterface_exists_errorDeleting(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterfaceStatus{HostDeviceName: expectedTapDeviceName} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() @@ -162,7 +162,7 @@ func TestDeleteNetworkInterface_IfaceExistsError(t *testing.T) { g.RegisterTestingT(t) - vmid, _ := models.NewVMID(vmName, nsName) + vmid, _ := models.NewVMID(vmName, nsName, vmUID) iface := &models.NetworkInterfaceStatus{HostDeviceName: expectedTapDeviceName} svc := mock.NewMockNetworkService(mockCtrl) ctx := context.Background() diff --git a/core/steps/network/testconst_test.go b/core/steps/network/testconst_test.go index 03490f35a..5a2596e9c 100644 --- a/core/steps/network/testconst_test.go +++ b/core/steps/network/testconst_test.go @@ -5,6 +5,7 @@ import "github.com/weaveworks/flintlock/core/models" const ( vmName = "testvm" nsName = "testns" + vmUID = "testuid" defaultMACAddress = "AA:BB:CC:DD:EE:FF" reverseMACAddress = "FF:EE:DD:CC:BB:AA" expectedTapDeviceName = "testns_testvm_tap" diff --git a/core/steps/runtime/initrd_mount_test.go b/core/steps/runtime/initrd_mount_test.go index 65b6efe30..10ed55d43 100644 --- a/core/steps/runtime/initrd_mount_test.go +++ b/core/steps/runtime/initrd_mount_test.go @@ -15,7 +15,7 @@ import ( ) func testVMWithInitrd() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/core/steps/runtime/kernel_mount_test.go b/core/steps/runtime/kernel_mount_test.go index 70d120148..630b93298 100644 --- a/core/steps/runtime/kernel_mount_test.go +++ b/core/steps/runtime/kernel_mount_test.go @@ -15,7 +15,7 @@ import ( ) func testVMWithKernel() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/core/steps/runtime/repo_release.go b/core/steps/runtime/repo_release.go index ecd26db90..efe971bde 100644 --- a/core/steps/runtime/repo_release.go +++ b/core/steps/runtime/repo_release.go @@ -40,7 +40,7 @@ func (s *repoRelease) ShouldDo(ctx context.Context) (bool, error) { return false, errors.ErrSpecRequired } - exists, err := s.repo.Exists(ctx, s.vm.ID.Name(), s.vm.ID.Namespace()) + exists, err := s.repo.Exists(ctx, s.vm.ID) if err != nil { return false, fmt.Errorf("checking if spec exists: %w", err) } diff --git a/core/steps/runtime/repo_release_test.go b/core/steps/runtime/repo_release_test.go index 652d64f6a..8e30e10f8 100644 --- a/core/steps/runtime/repo_release_test.go +++ b/core/steps/runtime/repo_release_test.go @@ -14,7 +14,7 @@ import ( ) func testVM() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, @@ -47,7 +47,7 @@ func TestNewRepoRelease(t *testing.T) { microVMRepoService. EXPECT(). - Exists(ctx, vm.ID.Name(), vm.ID.Namespace()). + Exists(ctx, vm.ID). Return(true, nil) microVMRepoService. @@ -80,7 +80,7 @@ func TestNewRepoRelease_doesNotExist(t *testing.T) { microVMRepoService. EXPECT(). - Exists(ctx, vm.ID.Name(), vm.ID.Namespace()). + Exists(ctx, vm.ID). Return(false, nil) shouldDo, shouldErr := step.ShouldDo(ctx) @@ -129,7 +129,7 @@ func TestNewRepoRelease_existsCheckFails(t *testing.T) { microVMRepoService. EXPECT(). - Exists(ctx, vm.ID.Name(), vm.ID.Namespace()). + Exists(ctx, vm.ID). Return(false, errors.New("exists check failed")) shouldDo, shouldErr := step.ShouldDo(ctx) @@ -154,7 +154,7 @@ func TestNewRepoRelease_repoServiceError(t *testing.T) { microVMRepoService. EXPECT(). - Exists(ctx, vm.ID.Name(), vm.ID.Namespace()). + Exists(ctx, vm.ID). Return(true, nil) microVMRepoService. diff --git a/core/steps/runtime/volume_mount_test.go b/core/steps/runtime/volume_mount_test.go index f505df582..1fb2cf704 100644 --- a/core/steps/runtime/volume_mount_test.go +++ b/core/steps/runtime/volume_mount_test.go @@ -15,7 +15,7 @@ import ( ) func testVMWithMount() *models.MicroVM { - vmid, _ := models.NewVMID("vm", "ns") + vmid, _ := models.NewVMID("vm", "ns", "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/hack/scripts/payload/DeleteMicroVM.json b/hack/scripts/payload/DeleteMicroVM.json index 13953657d..5e222c12b 100644 --- a/hack/scripts/payload/DeleteMicroVM.json +++ b/hack/scripts/payload/DeleteMicroVM.json @@ -1,4 +1,3 @@ { - "id": "mvm1", - "namespace": "ns1" + "uid": "b1c0aa3c-ebba-498a-a7c7-903d91758d83" } diff --git a/infrastructure/containerd/content.go b/infrastructure/containerd/content.go index 1c2fd2592..78fd8de17 100644 --- a/infrastructure/containerd/content.go +++ b/infrastructure/containerd/content.go @@ -15,10 +15,11 @@ const ( namespaceLabelFormat = "%s/ns" typeLabelFormat = "%s/type" versionLabelFormat = "%s/version" + uidLabelFormat = "%s/uid" ) func contentRefName(microvm *models.MicroVM) string { - return fmt.Sprintf("%s/microvm/%s", defaults.Domain, microvm.ID) + return fmt.Sprintf("%s/microvm/%s", defaults.Domain, microvm.ID.String()) } func labelFilter(name, value string) string { @@ -44,3 +45,8 @@ func TypeLabel() string { func VersionLabel() string { return fmt.Sprintf(versionLabelFormat, defaults.Domain) } + +// UIDLabel is the name of the containerd content store label to hold UID of the content. +func UIDLabel() string { + return fmt.Sprintf(uidLabelFormat, defaults.Domain) +} diff --git a/infrastructure/containerd/image_service_integration_test.go b/infrastructure/containerd/image_service_integration_test.go index f439acc85..c282e4966 100644 --- a/infrastructure/containerd/image_service_integration_test.go +++ b/infrastructure/containerd/image_service_integration_test.go @@ -21,6 +21,7 @@ const ( testImageKernel = "docker.io/linuxkit/kernel:5.4.129" testSnapshotter = "devmapper" testOwnerNamespace = "int_ns" + testOwnerUID = "uid" testOwnerUsageID = "vol1" testOwnerName = "imageservice-get-test" testContainerdNS = "flintlock_test_ctr" diff --git a/infrastructure/containerd/repo.go b/infrastructure/containerd/repo.go index a0535bfd6..4be423721 100644 --- a/infrastructure/containerd/repo.go +++ b/infrastructure/containerd/repo.go @@ -60,6 +60,7 @@ func (r *containerdRepo) Save(ctx context.Context, microvm *models.MicroVM) (*mo existingSpec, err := r.get(ctx, ports.RepositoryGetOptions{ Name: microvm.ID.Name(), Namespace: microvm.ID.Namespace(), + UID: microvm.ID.UID(), }) if err != nil { return nil, fmt.Errorf("getting vm spec from store: %w", err) @@ -127,7 +128,7 @@ func (r *containerdRepo) Get(ctx context.Context, options ports.RepositoryGetOpt } if spec == nil { - return nil, errors.NewSpecNotFound(options.Name, options.Namespace, options.Version) + return nil, errors.NewSpecNotFound(options.Name, options.Namespace, options.Version, options.UID) } return spec, nil @@ -224,8 +225,8 @@ func (r *containerdRepo) Delete(ctx context.Context, microvm *models.MicroVM) er } // Exists checks to see if the microvm spec exists in the containerd content store. -func (r *containerdRepo) Exists(ctx context.Context, name, namespace string) (bool, error) { - mu := r.getMutex(name) +func (r *containerdRepo) Exists(ctx context.Context, vmid models.VMID) (bool, error) { + mu := r.getMutex(vmid.Name()) mu.RLock() defer mu.RUnlock() @@ -233,10 +234,11 @@ func (r *containerdRepo) Exists(ctx context.Context, name, namespace string) (bo digest, err := r.findDigestForSpec( namespaceCtx, - ports.RepositoryGetOptions{Name: name, Namespace: namespace}, + ports.RepositoryGetOptions{Name: vmid.Name(), Namespace: vmid.Namespace(), UID: vmid.UID()}, ) if err != nil { - return false, fmt.Errorf("finding digest for %s/%s: %w", name, namespace, err) + return false, fmt.Errorf( + "finding digest for %s/%s/%s: %w", vmid.Name(), vmid.Namespace(), vmid.UID(), err) } if digest == nil { @@ -286,9 +288,10 @@ func (r *containerdRepo) findDigestForSpec(ctx context.Context, idLabelFilter := labelFilter(NameLabel(), options.Name) nsFilter := labelFilter(NamespaceLabel(), options.Namespace) + uidLabelFilter := labelFilter(UIDLabel(), options.UID) versionFilter := labelFilter(VersionLabel(), options.Version) - combinedFilters := []string{idLabelFilter, nsFilter} + combinedFilters := []string{idLabelFilter, nsFilter, uidLabelFilter} if options.Version != "" { combinedFilters = append(combinedFilters, versionFilter) @@ -367,6 +370,7 @@ func getVMLabels(microvm *models.MicroVM) map[string]string { NamespaceLabel(): microvm.ID.Namespace(), TypeLabel(): MicroVMSpecType, VersionLabel(): strconv.Itoa(microvm.Version), + UIDLabel(): microvm.ID.UID(), } return labels diff --git a/infrastructure/containerd/repo_test.go b/infrastructure/containerd/repo_test.go index c909105e0..6f00ea412 100644 --- a/infrastructure/containerd/repo_test.go +++ b/infrastructure/containerd/repo_test.go @@ -24,7 +24,7 @@ func TestMicroVMRepo_Integration(t *testing.T) { SnapshotterVolume: testSnapshotter, Namespace: testContainerdNS, }, client) - exists, err := repo.Exists(ctx, testOwnerName, testOwnerNamespace) + exists, err := repo.Exists(ctx, *models.NewVMIDForce(testOwnerName, testOwnerNamespace, testOwnerUID)) Expect(err).NotTo(HaveOccurred()) Expect(exists).To(BeFalse()) @@ -40,13 +40,14 @@ func TestMicroVMRepo_Integration(t *testing.T) { Expect(savedVM).NotTo(BeNil()) Expect(savedVM.Version).To(Equal(3)) - exists, err = repo.Exists(ctx, testOwnerName, testOwnerNamespace) + exists, err = repo.Exists(ctx, *models.NewVMIDForce(testOwnerName, testOwnerNamespace, testOwnerUID)) Expect(err).NotTo(HaveOccurred()) Expect(exists).To(BeTrue()) gotVM, err := repo.Get(ctx, ports.RepositoryGetOptions{ Name: testOwnerName, Namespace: testOwnerNamespace, + UID: "uid", }) Expect(err).NotTo(HaveOccurred()) Expect(gotVM).NotTo(BeNil()) @@ -55,6 +56,7 @@ func TestMicroVMRepo_Integration(t *testing.T) { olderVM, err := repo.Get(ctx, ports.RepositoryGetOptions{ Name: testOwnerName, Namespace: testOwnerNamespace, + UID: "uid", Version: "2", }) Expect(err).NotTo(HaveOccurred()) @@ -68,7 +70,7 @@ func TestMicroVMRepo_Integration(t *testing.T) { err = repo.Delete(ctx, testVm) Expect(err).NotTo(HaveOccurred()) - exists, err = repo.Exists(ctx, testOwnerName, testOwnerNamespace) + exists, err = repo.Exists(ctx, *models.NewVMIDForce(testOwnerName, testOwnerNamespace, testOwnerUID)) Expect(err).NotTo(HaveOccurred()) Expect(exists).To(BeFalse()) @@ -110,7 +112,7 @@ func TestMicroVMRepo_Integration_MultipleSave(t *testing.T) { } func makeSpec(name, ns string) *models.MicroVM { - vmid, _ := models.NewVMID(name, ns) + vmid, _ := models.NewVMID(name, ns, "uid") return &models.MicroVM{ ID: *vmid, Version: 1, diff --git a/infrastructure/controllers/microvm_controller.go b/infrastructure/controllers/microvm_controller.go index e34ae14f4..c66884775 100644 --- a/infrastructure/controllers/microvm_controller.go +++ b/infrastructure/controllers/microvm_controller.go @@ -137,7 +137,7 @@ func (r *MicroVMController) processQueueItem(ctx context.Context) bool { return true } - err = r.reconcileUC.ReconcileMicroVM(ctx, vmid.Name(), vmid.Namespace()) + err = r.reconcileUC.ReconcileMicroVM(ctx, *vmid) if err != nil { logger.Errorf("failed to reconcile vmid %s: %s", vmid, err) r.queue.Enqueue(item) @@ -149,13 +149,14 @@ func (r *MicroVMController) processQueueItem(ctx context.Context) bool { } func (r *MicroVMController) handleEvent(envelope *ports.EventEnvelope, logger *logrus.Entry) error { - var name, namespace string + var name, namespace, uid string switch eventType := envelope.Event.(type) { case *events.MicroVMSpecCreated: created, _ := envelope.Event.(*events.MicroVMSpecCreated) name = created.ID namespace = created.Namespace + uid = created.UID case *events.MicroVMSpecDeleted: // Do not enqueue a deleted vmspec. // We can be smarter than this, but for now it's working @@ -165,13 +166,14 @@ func (r *MicroVMController) handleEvent(envelope *ports.EventEnvelope, logger *l updated, _ := envelope.Event.(*events.MicroVMSpecUpdated) name = updated.ID namespace = updated.Namespace + uid = updated.UID default: logger.Debugf("unhandled event type (%T) received", eventType) return nil } - vmid, err := models.NewVMID(name, namespace) + vmid, err := models.NewVMID(name, namespace, uid) if err != nil { return fmt.Errorf("getting vmid from event data: %w", err) } diff --git a/infrastructure/controllers/microvm_controller_test.go b/infrastructure/controllers/microvm_controller_test.go index fba381340..ab6624894 100644 --- a/infrastructure/controllers/microvm_controller_test.go +++ b/infrastructure/controllers/microvm_controller_test.go @@ -13,6 +13,7 @@ import ( lgrtest "github.com/sirupsen/logrus/hooks/test" "github.com/weaveworks/flintlock/api/events" + "github.com/weaveworks/flintlock/core/models" "github.com/weaveworks/flintlock/core/ports" "github.com/weaveworks/flintlock/infrastructure/controllers" "github.com/weaveworks/flintlock/infrastructure/mock" @@ -23,6 +24,7 @@ import ( var ( vmID = "vm1" vmNS = "testns" + vmUID = "uid" ctrNS = "flintlock_test_controller" ) @@ -44,7 +46,7 @@ func TestMicroVMController(t *testing.T) { expect: func(em *mock.MockEventServiceMockRecorder, uc *mock.MockReconcileMicroVMsUseCaseMockRecorder, evtChan chan *ports.EventEnvelope, evtErrCh chan error) { em.SubscribeTopic(gomock.Any(), gomock.Eq(defaults.TopicMicroVMEvents)).Return(evtChan, evtErrCh) - uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(nil) + uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(nil) }, }, { @@ -56,7 +58,7 @@ func TestMicroVMController(t *testing.T) { expect: func(em *mock.MockEventServiceMockRecorder, uc *mock.MockReconcileMicroVMsUseCaseMockRecorder, evtChan chan *ports.EventEnvelope, evtErrCh chan error) { em.SubscribeTopic(gomock.Any(), gomock.Eq(defaults.TopicMicroVMEvents)).Return(evtChan, evtErrCh) - uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(nil) + uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(nil) }, }, { @@ -68,8 +70,7 @@ func TestMicroVMController(t *testing.T) { expect: func(em *mock.MockEventServiceMockRecorder, uc *mock.MockReconcileMicroVMsUseCaseMockRecorder, evtChan chan *ports.EventEnvelope, evtErrCh chan error) { em.SubscribeTopic(gomock.Any(), gomock.Eq(defaults.TopicMicroVMEvents)).Return(evtChan, evtErrCh) - // uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(nil) - uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Times(0) + uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Times(0) }, }, { @@ -82,9 +83,9 @@ func TestMicroVMController(t *testing.T) { expect: func(em *mock.MockEventServiceMockRecorder, uc *mock.MockReconcileMicroVMsUseCaseMockRecorder, evtChan chan *ports.EventEnvelope, evtErrCh chan error) { em.SubscribeTopic(gomock.Any(), gomock.Eq(defaults.TopicMicroVMEvents)).Return(evtChan, evtErrCh) - failed := uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(errors.New("something bad happened")) + failed := uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(errors.New("something bad happened")) - uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(nil).After(failed) + uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(nil).After(failed) }, }, { @@ -97,9 +98,9 @@ func TestMicroVMController(t *testing.T) { expect: func(em *mock.MockEventServiceMockRecorder, uc *mock.MockReconcileMicroVMsUseCaseMockRecorder, evtChan chan *ports.EventEnvelope, evtErrCh chan error) { em.SubscribeTopic(gomock.Any(), gomock.Eq(defaults.TopicMicroVMEvents)).Return(evtChan, evtErrCh) - failed := uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(errors.New("something bad happened")) + failed := uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(errors.New("something bad happened")) - uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(vmID), gomock.Eq(vmNS)).Return(nil).After(failed) + uc.ReconcileMicroVM(gomock.Any(), gomock.Eq(*models.NewVMIDForce(vmID, vmNS, vmUID))).Return(nil).After(failed) }, }, } @@ -175,6 +176,7 @@ func createdEvent(name, namespace string) *ports.EventEnvelope { Event: &events.MicroVMSpecCreated{ ID: name, Namespace: namespace, + UID: vmUID, }, } } @@ -187,6 +189,7 @@ func updatedEvent(name, namespace string) *ports.EventEnvelope { Event: &events.MicroVMSpecUpdated{ ID: name, Namespace: namespace, + UID: vmUID, }, } } @@ -199,6 +202,7 @@ func deletedEvent(name, namespace string) *ports.EventEnvelope { Event: &events.MicroVMSpecDeleted{ ID: name, Namespace: namespace, + UID: vmUID, }, } } diff --git a/infrastructure/firecracker/provider.go b/infrastructure/firecracker/provider.go index 186c14c31..cbeaa89a3 100644 --- a/infrastructure/firecracker/provider.go +++ b/infrastructure/firecracker/provider.go @@ -85,13 +85,13 @@ func (p *fcProvider) Delete(ctx context.Context, id string) error { pid, pidErr := vmState.PID() if pidErr != nil { - return fmt.Errorf("unable to get PID: %w", err) + return fmt.Errorf("unable to get PID: %w", pidErr) } logger.Infof("sending SIGHUP to %d", pid) if sigErr := process.SendSignal(pid, syscall.SIGHUP); sigErr != nil { - return fmt.Errorf("failed to terminate with SIGHUP: %w", err) + return fmt.Errorf("failed to terminate with SIGHUP: %w", sigErr) } ctxTimeout, cancel := context.WithTimeout(ctx, p.deleteVMTimeout) diff --git a/infrastructure/firecracker/state.go b/infrastructure/firecracker/state.go index 96d3f3f66..6693a4eb1 100644 --- a/infrastructure/firecracker/state.go +++ b/infrastructure/firecracker/state.go @@ -38,7 +38,7 @@ type State interface { func NewState(vmid models.VMID, stateDir string, fs afero.Fs) State { return &fsState{ - stateRoot: fmt.Sprintf("%s/%s", stateDir, vmid), + stateRoot: fmt.Sprintf("%s/%s", stateDir, vmid.String()), fs: fs, } } diff --git a/infrastructure/grpc/convert.go b/infrastructure/grpc/convert.go index 987741832..15d556953 100644 --- a/infrastructure/grpc/convert.go +++ b/infrastructure/grpc/convert.go @@ -6,10 +6,17 @@ import ( "github.com/weaveworks/flintlock/api/types" "github.com/weaveworks/flintlock/core/models" "github.com/weaveworks/flintlock/pkg/defaults" + "github.com/weaveworks/flintlock/pkg/ptr" ) func convertMicroVMToModel(spec *types.MicroVMSpec) (*models.MicroVM, error) { - vmid, err := models.NewVMID(spec.Id, spec.Namespace) + uid := "" + + if spec.Uid != nil { + uid = *spec.Uid + } + + vmid, err := models.NewVMID(spec.Id, spec.Namespace, uid) if err != nil { return nil, fmt.Errorf("creating vmid from spec: %w", err) } @@ -140,6 +147,7 @@ func convertModelToMicroVMSpec(mvm *models.MicroVM) *types.MicroVMSpec { converted := &types.MicroVMSpec{ Id: mvm.ID.Name(), Namespace: mvm.ID.Namespace(), + Uid: ptr.String(mvm.ID.UID()), // Labels: , Vcpu: int32(mvm.Spec.VCPU), MemoryInMb: int32(mvm.Spec.MemoryInMb), diff --git a/infrastructure/grpc/server.go b/infrastructure/grpc/server.go index 43785b655..e503972b0 100644 --- a/infrastructure/grpc/server.go +++ b/infrastructure/grpc/server.go @@ -92,16 +92,16 @@ func (s *server) CreateMicroVM( func (s *server) DeleteMicroVM(ctx context.Context, req *mvmv1.DeleteMicroVMRequest) (*emptypb.Empty, error) { logger := log.GetLogger(ctx) - if req == nil || req.Id == "" || req.Namespace == "" { + if req == nil || req.Uid == "" { logger.Error("invalid delete microvm request") //nolint:wrapcheck // don't wrap grpc errors when using the status package return nil, status.Error(codes.InvalidArgument, "invalid request") } - logger.Infof("deleting microvm %s/%s", req.Id, req.Namespace) + logger.Infof("deleting microvm %s", req.Uid) - if err := s.commandUC.DeleteMicroVM(ctx, req.Id, req.Namespace); err != nil { + if err := s.commandUC.DeleteMicroVM(ctx, req.Uid); err != nil { logger.Errorf("failed to delete microvm: %s", err) return nil, fmt.Errorf("deleting microvm: %w", err) @@ -113,16 +113,16 @@ func (s *server) DeleteMicroVM(ctx context.Context, req *mvmv1.DeleteMicroVMRequ func (s *server) GetMicroVM(ctx context.Context, req *mvmv1.GetMicroVMRequest) (*mvmv1.GetMicroVMResponse, error) { logger := log.GetLogger(ctx) - if req == nil || req.Id == "" || req.Namespace == "" { + if req == nil || req.Uid == "" { logger.Error("invalid get microvm request") //nolint:wrapcheck // don't wrap grpc errors when using the status package return nil, status.Error(codes.InvalidArgument, "invalid request") } - logger.Infof("getting microvm %s/%s", req.Namespace, req.Id) + logger.Infof("getting microvm %s", req.Uid) - foundMicrovm, err := s.queryUC.GetMicroVM(ctx, req.Id, req.Namespace) + foundMicrovm, err := s.queryUC.GetMicroVM(ctx, req.Uid) if err != nil { logger.Errorf("failed to get microvm: %s", err) diff --git a/infrastructure/grpc/server_test.go b/infrastructure/grpc/server_test.go index 51562ac85..64cd2d31e 100644 --- a/infrastructure/grpc/server_test.go +++ b/infrastructure/grpc/server_test.go @@ -53,7 +53,7 @@ func TestServer_CreateMicroVM(t *testing.T) { createReq: createTestCreateRequest("mvm1", "default"), expectError: false, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) { - vmid, _ := models.NewVMID("mvm1", "default") + vmid, _ := models.NewVMID("mvm1", "default", "uid") cm.CreateMicroVM( gomock.AssignableToTypeOf(context.Background()), @@ -112,25 +112,18 @@ func TestServer_DeleteMicroVM(t *testing.T) { }, { name: "missing id should fail with error", - deleteReq: &mvm1.DeleteMicroVMRequest{Id: "", Namespace: "default"}, - expectError: true, - expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) {}, - }, - { - name: "missing namespace should fail with error", - deleteReq: &mvm1.DeleteMicroVMRequest{Id: "mvm1", Namespace: ""}, + deleteReq: &mvm1.DeleteMicroVMRequest{Uid: ""}, expectError: true, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) {}, }, { name: "error from usecase should fail with error", - deleteReq: &mvm1.DeleteMicroVMRequest{Id: "mvm1", Namespace: "default"}, + deleteReq: &mvm1.DeleteMicroVMRequest{Uid: "testuid"}, expectError: true, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) { cm.DeleteMicroVM( gomock.AssignableToTypeOf(context.Background()), gomock.Not(gomock.Eq("")), - gomock.Not(gomock.Eq("")), ).Return( errors.New("a random error occurred"), ) @@ -138,13 +131,12 @@ func TestServer_DeleteMicroVM(t *testing.T) { }, { name: "valid request and no error from delete microvm usecase should success", - deleteReq: &mvm1.DeleteMicroVMRequest{Id: "mvm1", Namespace: "default"}, + deleteReq: &mvm1.DeleteMicroVMRequest{Uid: "testuid"}, expectError: false, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) { cm.DeleteMicroVM( gomock.AssignableToTypeOf(context.Background()), gomock.Not(gomock.Eq("")), - gomock.Not(gomock.Eq("")), ).Return( nil, ) @@ -189,25 +181,18 @@ func TestServer_GetMicroVM(t *testing.T) { }, { name: "missing id should fail with error", - getReq: &mvm1.GetMicroVMRequest{Id: "", Namespace: "default"}, - expectError: true, - expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) {}, - }, - { - name: "missing namespace should fail with error", - getReq: &mvm1.GetMicroVMRequest{Id: "mvm1", Namespace: ""}, + getReq: &mvm1.GetMicroVMRequest{Uid: ""}, expectError: true, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) {}, }, { name: "error from usecase should fail with error", - getReq: &mvm1.GetMicroVMRequest{Id: "mvm1", Namespace: "default"}, + getReq: &mvm1.GetMicroVMRequest{Uid: "testuid"}, expectError: true, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) { qm.GetMicroVM( gomock.AssignableToTypeOf(context.Background()), gomock.Not(gomock.Eq("")), - gomock.Not(gomock.Eq("")), ).Return( nil, errors.New("a random error occurred"), @@ -216,15 +201,14 @@ func TestServer_GetMicroVM(t *testing.T) { }, { name: "valid request with no error should succeed", - getReq: &mvm1.GetMicroVMRequest{Id: "mvm1", Namespace: "default"}, + getReq: &mvm1.GetMicroVMRequest{Uid: "testuid"}, expectError: false, expect: func(cm *mock.MockMicroVMCommandUseCasesMockRecorder, qm *mock.MockMicroVMQueryUseCasesMockRecorder) { - vmid, _ := models.NewVMID("mvm1", "default") + vmid, _ := models.NewVMID("mvm1", "default", "testuid") qm.GetMicroVM( gomock.AssignableToTypeOf(context.Background()), gomock.Not(gomock.Eq("")), - gomock.Not(gomock.Eq("")), ).Return( &models.MicroVM{ ID: *vmid, diff --git a/infrastructure/mock/ports.go b/infrastructure/mock/ports.go index 91c9c37e2..6d22a61c0 100644 --- a/infrastructure/mock/ports.go +++ b/infrastructure/mock/ports.go @@ -145,18 +145,18 @@ func (mr *MockMicroVMRepositoryMockRecorder) Delete(arg0, arg1 interface{}) *gom } // Exists mocks base method. -func (m *MockMicroVMRepository) Exists(arg0 context.Context, arg1, arg2 string) (bool, error) { +func (m *MockMicroVMRepository) Exists(arg0 context.Context, arg1 models.VMID) (bool, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Exists", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "Exists", arg0, arg1) ret0, _ := ret[0].(bool) ret1, _ := ret[1].(error) return ret0, ret1 } // Exists indicates an expected call of Exists. -func (mr *MockMicroVMRepositoryMockRecorder) Exists(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockMicroVMRepositoryMockRecorder) Exists(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exists", reflect.TypeOf((*MockMicroVMRepository)(nil).Exists), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exists", reflect.TypeOf((*MockMicroVMRepository)(nil).Exists), arg0, arg1) } // Get mocks base method. @@ -444,17 +444,17 @@ func (m *MockReconcileMicroVMsUseCase) EXPECT() *MockReconcileMicroVMsUseCaseMoc } // ReconcileMicroVM mocks base method. -func (m *MockReconcileMicroVMsUseCase) ReconcileMicroVM(arg0 context.Context, arg1, arg2 string) error { +func (m *MockReconcileMicroVMsUseCase) ReconcileMicroVM(arg0 context.Context, arg1 models.VMID) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "ReconcileMicroVM", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "ReconcileMicroVM", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } // ReconcileMicroVM indicates an expected call of ReconcileMicroVM. -func (mr *MockReconcileMicroVMsUseCaseMockRecorder) ReconcileMicroVM(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockReconcileMicroVMsUseCaseMockRecorder) ReconcileMicroVM(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileMicroVM", reflect.TypeOf((*MockReconcileMicroVMsUseCase)(nil).ReconcileMicroVM), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReconcileMicroVM", reflect.TypeOf((*MockReconcileMicroVMsUseCase)(nil).ReconcileMicroVM), arg0, arg1) } // ResyncMicroVMs mocks base method. @@ -592,17 +592,17 @@ func (mr *MockMicroVMCommandUseCasesMockRecorder) CreateMicroVM(arg0, arg1 inter } // DeleteMicroVM mocks base method. -func (m *MockMicroVMCommandUseCases) DeleteMicroVM(arg0 context.Context, arg1, arg2 string) error { +func (m *MockMicroVMCommandUseCases) DeleteMicroVM(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteMicroVM", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "DeleteMicroVM", arg0, arg1) ret0, _ := ret[0].(error) return ret0 } // DeleteMicroVM indicates an expected call of DeleteMicroVM. -func (mr *MockMicroVMCommandUseCasesMockRecorder) DeleteMicroVM(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockMicroVMCommandUseCasesMockRecorder) DeleteMicroVM(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteMicroVM", reflect.TypeOf((*MockMicroVMCommandUseCases)(nil).DeleteMicroVM), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteMicroVM", reflect.TypeOf((*MockMicroVMCommandUseCases)(nil).DeleteMicroVM), arg0, arg1) } // MockMicroVMQueryUseCases is a mock of MicroVMQueryUseCases interface. @@ -644,16 +644,16 @@ func (mr *MockMicroVMQueryUseCasesMockRecorder) GetAllMicroVM(arg0, arg1 interfa } // GetMicroVM mocks base method. -func (m *MockMicroVMQueryUseCases) GetMicroVM(arg0 context.Context, arg1, arg2 string) (*models.MicroVM, error) { +func (m *MockMicroVMQueryUseCases) GetMicroVM(arg0 context.Context, arg1 string) (*models.MicroVM, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetMicroVM", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "GetMicroVM", arg0, arg1) ret0, _ := ret[0].(*models.MicroVM) ret1, _ := ret[1].(error) return ret0, ret1 } // GetMicroVM indicates an expected call of GetMicroVM. -func (mr *MockMicroVMQueryUseCasesMockRecorder) GetMicroVM(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockMicroVMQueryUseCasesMockRecorder) GetMicroVM(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMicroVM", reflect.TypeOf((*MockMicroVMQueryUseCases)(nil).GetMicroVM), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetMicroVM", reflect.TypeOf((*MockMicroVMQueryUseCases)(nil).GetMicroVM), arg0, arg1) } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 0d6255b9b..0f96099e7 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -57,15 +57,15 @@ func TestE2E(t *testing.T) { g.Expect(u.PidRunning(mvmPid1)).To(BeTrue()) // get the mVM and check the status - res := u.GetMVM(flintlockClient, mvmID, mvmNS) + res := u.GetMVM(flintlockClient, *created.Microvm.Spec.Uid) g.Expect(res.Microvm.Spec.Id).To(Equal(mvmID)) g.Expect(res.Microvm.Status.State).To(Equal(types.MicroVMStatus_CREATED)) return nil }, "120s").Should(Succeed()) log.Println("TEST STEP: creating a second MicroVM") - created = u.CreateMVM(flintlockClient, secondMvmID, mvmNS) - Expect(created.Microvm.Spec.Id).To(Equal(secondMvmID)) + createdSecond := u.CreateMVM(flintlockClient, secondMvmID, mvmNS) + Expect(createdSecond.Microvm.Spec.Id).To(Equal(secondMvmID)) log.Println("TEST STEP: listing all MicroVMs") Eventually(func(g Gomega) error { @@ -92,8 +92,8 @@ func TestE2E(t *testing.T) { } log.Println("TEST STEP: deleting existing MicroVMs") - Expect(u.DeleteMVM(flintlockClient, mvmID, mvmNS)).To(Succeed()) - Expect(u.DeleteMVM(flintlockClient, secondMvmID, mvmNS)).To(Succeed()) + Expect(u.DeleteMVM(flintlockClient, *created.Microvm.Spec.Uid)).To(Succeed()) + Expect(u.DeleteMVM(flintlockClient, *createdSecond.Microvm.Spec.Uid)).To(Succeed()) Eventually(func(g Gomega) error { // verify that the vm state dirs have been removed diff --git a/test/e2e/utils/utils.go b/test/e2e/utils/utils.go index 5e6d8ca43..c4e77a774 100644 --- a/test/e2e/utils/utils.go +++ b/test/e2e/utils/utils.go @@ -25,20 +25,18 @@ func CreateMVM(client v1alpha1.MicroVMClient, name, ns string) *v1alpha1.CreateM return created } -func DeleteMVM(client v1alpha1.MicroVMClient, name, ns string) error { +func DeleteMVM(client v1alpha1.MicroVMClient, uid string) error { deleteReq := v1alpha1.DeleteMicroVMRequest{ - Id: name, - Namespace: ns, + Uid: uid, } _, err := client.DeleteMicroVM(context.Background(), &deleteReq) return err } -func GetMVM(client v1alpha1.MicroVMClient, name, ns string) *v1alpha1.GetMicroVMResponse { +func GetMVM(client v1alpha1.MicroVMClient, uid string) *v1alpha1.GetMicroVMResponse { getReq := v1alpha1.GetMicroVMRequest{ - Id: name, - Namespace: ns, + Uid: uid, } res, err := client.GetMicroVM(context.Background(), &getReq) g.Expect(err).NotTo(g.HaveOccurred()) diff --git a/userdocs/docs/grpc/services/microvm/v1alpha1/proto.md b/userdocs/docs/grpc/services/microvm/v1alpha1/proto.md index 1283e9d94..fda5b5ae2 100644 --- a/userdocs/docs/grpc/services/microvm/v1alpha1/proto.md +++ b/userdocs/docs/grpc/services/microvm/v1alpha1/proto.md @@ -82,8 +82,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [string](#string) | | | -| namespace | [string](#string) | | | +| uid | [string](#string) | | | @@ -98,8 +97,7 @@ | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| id | [string](#string) | | | -| namespace | [string](#string) | | | +| uid | [string](#string) | | | diff --git a/userdocs/docs/grpc/types/proto.md b/userdocs/docs/grpc/types/proto.md index 96a360701..1451acb80 100644 --- a/userdocs/docs/grpc/types/proto.md +++ b/userdocs/docs/grpc/types/proto.md @@ -142,6 +142,7 @@ MicroVMSpec represents the specification for a microvm. | created_at | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | CreatedAt indicates the time the microvm was created at. | | updated_at | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | UpdatedAt indicates the time the microvm was last updated. | | deleted_at | [google.protobuf.Timestamp](#google.protobuf.Timestamp) | | DeletedAt indicates the time the microvm was marked as deleted. | +| uid | [string](#string) | optional | UID is a globally unique identifier of the microvm. |