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: add SASL and TLS config for Kafka client #4536

Merged
merged 19 commits into from
Aug 12, 2024

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Aug 9, 2024

I hereby agree to the terms of the GreptimeDB CLA.

Refer to a related PR or issue link (optional)

close #4534

What's changed and what's your intention?

Allow users to configure the SASL/PLAIN, SASL/SCRAM-SHA-256, SASL/SCRAM-SHA-512 and TLS for the Kafka client

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR requires documentation updates.

Copy link
Contributor

coderabbitai bot commented Aug 9, 2024

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Aug 9, 2024
src/common/wal/Cargo.toml Outdated Show resolved Hide resolved
@WenyXu WenyXu marked this pull request as ready for review August 9, 2024 08:10
@WenyXu WenyXu requested review from v0y4g3r and a team as code owners August 9, 2024 08:10
Copy link

codecov bot commented Aug 9, 2024

Codecov Report

Attention: Patch coverage is 69.18919% with 57 lines in your changes missing coverage. Please review.

Project coverage is 84.70%. Comparing base (9bcaeaa) to head (f7acfbb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4536      +/-   ##
==========================================
- Coverage   84.99%   84.70%   -0.29%     
==========================================
  Files        1085     1085              
  Lines      194016   194167     +151     
==========================================
- Hits       164899   164467     -432     
- Misses      29117    29700     +583     

@WenyXu WenyXu marked this pull request as draft August 9, 2024 09:49
@WenyXu
Copy link
Member Author

WenyXu commented Aug 11, 2024

SCRAM-SHA-512 requires dequbed/rsasl#48, influxdata/rskafka#247

@WenyXu WenyXu changed the title feat: add SASL/PLAIN and TLS config for Kafka client feat: add SASL and TLS config for Kafka client Aug 11, 2024
@WenyXu WenyXu marked this pull request as ready for review August 11, 2024 12:00
Copy link
Collaborator

@zyy17 zyy17 left a comment

Choose a reason for hiding this comment

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

Most of the changes look good to me. Should we need some unit tests to make the auth work ok?

src/common/wal/src/config.rs Show resolved Hide resolved
src/common/wal/src/config/kafka/datanode.rs Outdated Show resolved Hide resolved
@github-actions github-actions bot added docs-required This change requires docs update. and removed docs-not-required This change does not impact docs. labels Aug 12, 2024
@WenyXu WenyXu force-pushed the feat/kafka-sasl-tls branch from 8dcf7f3 to 054902c Compare August 12, 2024 06:07
@WenyXu WenyXu requested review from zyy17 and v0y4g3r August 12, 2024 06:08
@WenyXu
Copy link
Member Author

WenyXu commented Aug 12, 2024

Should we need some unit tests to make the auth work ok?

Added in 735e6b1

@WenyXu WenyXu enabled auto-merge August 12, 2024 07:42
@WenyXu WenyXu marked this pull request as draft August 12, 2024 08:38
auto-merge was automatically disabled August 12, 2024 08:38

Pull request was converted to draft

@WenyXu WenyXu marked this pull request as ready for review August 12, 2024 09:22
@WenyXu WenyXu marked this pull request as draft August 12, 2024 09:55
@WenyXu WenyXu marked this pull request as ready for review August 12, 2024 10:58
Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

Mostly LGTM

src/common/wal/src/error.rs Outdated Show resolved Hide resolved
@WenyXu WenyXu enabled auto-merge August 12, 2024 12:11
@WenyXu WenyXu added this pull request to the merge queue Aug 12, 2024
Merged via the queue into GreptimeTeam:main with commit 2e2eacf Aug 12, 2024
39 of 40 checks passed
@WenyXu WenyXu deleted the feat/kafka-sasl-tls branch August 12, 2024 12:48
CookiePieWw pushed a commit to CookiePieWw/greptimedb that referenced this pull request Sep 17, 2024
* feat: add SASL and TLS config

* feat: add SASL/PLAIN and TLS config for Kafka client

* chore: use `ring`

* feat: support SASL SCRAM-SHA-256 and SCRAM-SHA-512

* fix: correct unit test

* test: add integration test

* chore: apply suggestions from CR

* refactor: introduce `KafkaConnectionConfig`

* chore: refine toml examples

* docs: add missing fields

* chore: refine examples

* feat: allow no server ca cert

* chore: refine examples

* chore: fix clippy

* feat: load system ca certs

* chore: fmt toml

* chore: unpin version

* Update src/common/wal/src/error.rs

Co-authored-by: Lei, HUANG <[email protected]>

---------

Co-authored-by: Lei, HUANG <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-required This change requires docs update.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to configure the SASL and TLS for the Kafka client
4 participants