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

Kafka-mesh filter #11936

Merged
merged 114 commits into from
Sep 10, 2021
Merged

Conversation

adamkotwasinski
Copy link
Contributor

@adamkotwasinski adamkotwasinski commented Jul 7, 2020

Commit message: Kafka-mesh filter
Additional Description:
Kafka mesh filter.
Can be put between native Kafka client and intercept produce requests to forward them to upstream Kafka clusters as per its fowarding rules. Right now there's only one type of rule - prefix by topic name (so e.g. we can send messages to topics a* and have them in cluster 1, while others go to cluster 2). Only produce requests for now. Support for consumers would be more complex or require more limitations (as Kafka consumers keep state, so it's not like Redis - or actually it's like Redis pub/sub).
Doesn't work on Windows because of librdkafka compilation issues (and I don't have a Windows machine).
Risk Level: Low
Testing: Unit tests + integration test (2 kafka clusters are started + proxy in between + producer) + manual testing.
Docs Changes: New .rst & .proto files, as we have a new filter.
Release Notes: N/A

overview-incoming-request

Without getting into too much details:

  1. Kafka producers (Java, Python, etc.) send records to Envoy (the filter contains enough code to establish communication, first it needs to advertise itself it's a Kafka server through api-versions + metadata requests).
  2. Kafka-mesh filter instance receives the records, parses them, forwards them to rules which decide where the records should go.
  3. The records are forwarded to producers dedicated for each of clusters.
  4. librdkafka producers send the records where they should have gone (librdkafka has its own threads and we use dispatcher.post to have the delivery confirmation back to normal worker thread).

Other PRs for kafka-mesh work (merged independently):
#17202
#17374
#17475
#17597
#17783
#17818
#17839
#17887

@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy[\w/]*/(v1alpha\d?|v1|v2alpha\d?|v2))|(api/envoy/type/(matcher/)?\w+.proto).
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to api/envoy/.
CC @envoyproxy/api-watchers: FYI only for changes made to api/envoy/.

🐱

Caused by: #11936 was opened by adamkotwasinski.

see: more, trace.

@adamkotwasinski adamkotwasinski force-pushed the kafka-mesh-public branch 12 times, most recently from 7e7ea5f to 2ecbd19 Compare July 10, 2020 20:54
@stale
Copy link

stale bot commented Aug 1, 2020

This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale stalebot believes this issue/PR has not been touched recently label Aug 1, 2020
@stale stale bot removed the stale stalebot believes this issue/PR has not been touched recently label Aug 7, 2020
@repokitteh-read-only
Copy link

Retrying Azure Pipelines, to retry CircleCI checks, use /retest-circle.

🐱

Caused by: a #11936 (comment) was created by @adamkotwasinski.

see: more, trace.

@adamkotwasinski adamkotwasinski force-pushed the kafka-mesh-public branch 10 times, most recently from d6e2bd6 to e49dbde Compare August 17, 2020 20:46
Signed-off-by: Adam Kotwasinski <adam.kotwasinski@gmail.com>
Signed-off-by: Adam Kotwasinski <adam.kotwasinski@gmail.com>
@adamkotwasinski
Copy link
Contributor Author

Ready for review - also ran some Java tests.

@adamkotwasinski adamkotwasinski marked this pull request as ready for review September 9, 2021 00:45
@adamkotwasinski adamkotwasinski changed the title [DRAFT] Kafka-mesh filter Kafka-mesh filter Sep 9, 2021
Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Cool, thanks. A few small comments.

/wait

clusters, depending on configured forwarding rules. Corresponding message versions from
Kafka 2.4.0 are supported.

.. attention::
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add an attention/warning here that this is only available on contrib builds with a link? See what we do for squash and some of the other contrib filters and please unify as needed, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done - comments and missing link added; same for kafka-broker

Comment on lines 50 to 51
// Kafka Mesh filter
const std::string KafkaMesh = "envoy.filters.network.kafka_mesh";
Copy link
Member

Choose a reason for hiding this comment

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

we are trying to get rid of this file. Can you just inline this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Adam Kotwasinski <adam.kotwasinski@gmail.com>
@repokitteh-read-only
Copy link

Retrying Azure Pipelines:
Retried failed jobs in: envoy-presubmit

🐱

Caused by: a #11936 (comment) was created by @adamkotwasinski.

see: more, trace.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Thanks!

@mattklein123 mattklein123 merged commit 0c8942d into envoyproxy:main Sep 10, 2021
@adamkotwasinski adamkotwasinski deleted the kafka-mesh-public branch September 10, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api deps Approval required for changes to Envoy's external dependencies v2-freeze
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants