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

feat: supports db plugin grpc framework #7324

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Conversation

xuriwuyun
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the size/XXL Denotes a PR that changes 1000+ lines. label May 13, 2024
@xuriwuyun xuriwuyun marked this pull request as draft May 13, 2024 12:01
@xuriwuyun xuriwuyun changed the title feat: lorry support grpc db plugin feat: lorry supports grpc db plugin May 13, 2024
@xuriwuyun xuriwuyun changed the title feat: lorry supports grpc db plugin feat: supports db plugin grpc framework May 17, 2024
Copy link

codecov bot commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 64.81%. Comparing base (cd278c2) to head (ebbfd36).

Current head ebbfd36 differs from pull request most recent head a99d80e

Please upload reports for the commit a99d80e to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7324      +/-   ##
==========================================
- Coverage   65.55%   64.81%   -0.75%     
==========================================
  Files         343      345       +2     
  Lines       41771    42175     +404     
==========================================
- Hits        27385    27334      -51     
- Misses      12010    12454     +444     
- Partials     2376     2387      +11     
Flag Coverage Δ
unittests 64.81% <ø> (-0.75%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xuriwuyun xuriwuyun marked this pull request as ready for review May 20, 2024 02:17
pkg/lorry/plugin/server.go Outdated Show resolved Hide resolved
}

// DBPlugin service provides APIs to kubeblocks operator to exec component operation.
service DBPlugin {
Copy link
Contributor

@weicao weicao May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"DBPlugin" may not be the most appropriate name, as we have addons like Minio that are not necessarily database-related.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update to ServicePlugin

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although it's much longer, ComponentLifecyclePlugin is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actions may exist at different levels, such as component level, replica level, or even cluster level. Considering this, would it be more appropriate to use "lifecycleplugin" as the name?

// alphanumerics between. This field is REQUIRED.
string name = 1;

string db_type = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this field used for? is there any difference with name? is there any relationship with servicetype?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is used to indicate which service the plugin is handling, primarily for logging and debugging purposes.

string port = 2;

// The admin username used to access the DB service.
string admin_user = 3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is an admin account necessary? Can it be an account with lower privileges, such as a regular user account?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly, any account with appropriate privileges is allowed. In this context, "admin" refers to an administrator who possesses the necessary privileges to execute the action.

DBInfo db_info = 1;

// The pod FQDN of the primary replica.
string primary_fqdn = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current old primary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this field is removed as it is duplicated with serviceinfo.fqdn.

}

// DBPlugin service provides APIs to kubeblocks operator to exec component operation.
service DBPlugin {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the relationship with the original http protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gRPC plugin is one of the implementations of the action handler, similar to the exec handler. The HTTP protocol is used for API communication between the controller and Lorry. An HTTP API call can invoke one or more gRPC plugin APIs.

Copy link
Contributor

@leon-inf leon-inf May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the protocol is used for the communication with gRPC handers which are implemented by the provider, so:

  1. why there is a gRPC server in lorry? And where is the protocol conversion from HTTP to gRPC, or the calling to the gRPC client?
  2. the some problem in another PR(@#7343), how does the provider know to implement this protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gRPC server in Lorry was initially provided in early versions solely for RSM role probing purposes. It is currently maintained for compatibility reasons and it is planned to be removed in future versions.
As the same problem with other action handlers, it is necessary to document how to implement different types of action handlers and provide examples at action level.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So where is the calling to the customized gRPC services?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The gRPC server in Lorry was initially provided in early versions solely for RSM role probing purposes. It is currently maintained for compatibility reasons and it is planned to be removed in future versions. As the same problem with other action handlers, it is necessary to document how to implement different types of action handlers and provide examples at action level.

And seems that the gRPC server and probe protocol are irrelevant to gRPC handlers, it's better not to involve their changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XXL Denotes a PR that changes 1000+ lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants