Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build issues in SODA dock and SODA controller due to interdependecies in gRPC and Protobuf #6

Closed
nguptaopensds opened this issue Apr 23, 2020 · 3 comments
Assignees
Labels
bug Something isn't working High Priority High Priority Label
Milestone

Comments

@nguptaopensds
Copy link

Is this a BUG REPORT or FEATURE REQUEST?:
BUG

Uncomment only one, leave it on its own line:

/kind bug

What happened:
The modules SODA dock and SODA controller has been separated out from the hotpot project. After that segregation also, there are some inter-dependencies in gRPC client server communication and protobuf files, which leads to the build and CI issues. Plus the projects are not totally independent.

What you expected to happen:
Both the projects/modules should run successfully after separation without any dependency on the other. The proto file should not be dependent on what version of gRPC we use in the project. Basically the communication between dock and controller should be successful and independent.

How to reproduce it (as minimally and precisely as possible):
Just try to make a build with different gRPC versions , there will be a failure in protobuf file.

Anything else we need to know?:
Need to come up with a generic solution to remove this dependency

Environment:

  • Hotpot(release/branch) version:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@nguptaopensds
Copy link
Author

@kumarashit @himanshuvar @pravinran @wisererik @sushanthakumar If you people have any information and comments regarding this issue please submit here

@kumarashit kumarashit added bug Something isn't working High Priority High Priority Label labels May 11, 2020
@kumarashit kumarashit added this to the May2020 milestone May 11, 2020
@nguptaopensds
Copy link
Author

nguptaopensds commented May 15, 2020

Detailed description of issue :
Problem statement: In GRPC client server architecture, the protobuf file is shared which enables them to communicate with each other.In this case, SODA Dock and Controller are separate microservices which has their own proto files and for communication they send/recieve the common structs to gRPC for creating a handshake. The problem is even though the projects are separate, they still have to maintain a continuity in proto in assigning the field number for an attribute. For example:

Here are struct from controller and dock proto for CreateVolumeOpts:
Controller- model.proto
message CreateVolumeOpts {
// The uuid of the volume, optional when creating.
string id = 1;
// The name of the volume, required.
string name = 2;
// The requested capacity of the volume, required.
int64 size = 3;
// The description of the volume, optional.
string description = 4;
// When create volume from snapshot, this field is required.
string snapshotId = 5;
// The locality that volume belongs to, required.
string availabilityZone = 6;
// The service level that volume belongs to, required.
// TODO: This item will be replace by profile, don't use it.
string profileId = 7;
// The uuid of the pool on which volume will be created, required.
string poolId = 8;
// The name of the pool on which volume will be created, required.
string poolName = 9;
}
Dock - model.proto
message CreateVolumeOpts {
// The uuid of the volume, optional when creating.
string id = 1;
// The name of the volume, required.
string name = 2;
// The requested capacity of the volume, required.
int64 size = 3;
// The description of the volume, optional.
string description = 4;
// When create volume from snapshot, this field is required.
string snapshotId = 5;
// The locality that volume belongs to, required.
string availabilityZone = 6;
// The uuid of the pool on which volume will be created, required.
string poolId = 8;
// The name of the pool on which volume will be created, required.
string poolName = 9;
}
Here if attribute "poolID" is tagged field number 8 in controller proto, similarly we had to assign 8 in dock as well missing field number 7 in the struct. This is not a right practice to assign field number in proto as it should be sequential.

Solutions analysis:

To solve the above problems we can have a few ways:

  1. Either we add attribute "profileID" in dock proto as well assigning number "7", to make it sequential. But this is not sanity, because we don't actually need "profileID" in Dock project.
  2. We can make a shared folder in the upper level of both projects where we can have one proto file for all Dock, Controller and API which will be superset for all the projects proto file. In this solution we can use some leverages from protobuf like OneOf or omitempty, where we can make all attributes optional(by default in proto3 version or above)
  3. We can make an agreement between Controller and Dock proto, where only those attributes which are needed for communication between them will be part of the common struct and if any of the projects need some other attributes(private), they can make other struct which can import common struct as base model.But this is also not optimized as, there will be a lot many code changes in both the projects to adapt to this new struct, plus if in future we need to add new attribute , we again have to make other struct which inherits the base struct.
  4. client and server must be agreed on same unique tag number of parameters. so for ex: if client, is sending some parameters on tag number 10(lets say), then server must catch the same parameters on exactly same tag number. because of serialization and deserialization concept.

Conclusion:
We can optimize SODA Dock and SODA Controller where we can check for the client server agreement for these services. If Controller is using/wrapping the dock grpc client, this grpcs client should be capable enough to send the right information/messages to the dock grpc server.

@kumarashit
Copy link
Collaborator

Won't fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working High Priority High Priority Label
Projects
None yet
Development

No branches or pull requests

2 participants