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(pubsub): support kafka tls and sasl/plain auth #7046

Merged
merged 23 commits into from
May 17, 2022

Conversation

bzp2010
Copy link
Contributor

@bzp2010 bzp2010 commented May 13, 2022

Description

Part of #6995 to implement TLS and SASL/PLAIN authentication support for kafka.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@bzp2010
Copy link
Contributor Author

bzp2010 commented May 13, 2022

Update

This is the part after #7032 that is currently in ready state, and when #7032 is merged, it is ready to start the review.

All the changes in #7032 were merged in this PR, so there are more lines, which will be greatly reduced when #7032 is merged.

@bzp2010 bzp2010 marked this pull request as ready for review May 13, 2022 18:08
membphis
membphis previously approved these changes May 15, 2022
Copy link
Member

@membphis membphis left a comment

Choose a reason for hiding this comment

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

LGTM

@bzp2010 bzp2010 requested a review from membphis May 16, 2022 09:37
@@ -79,6 +79,8 @@ jobs:

- name: Run other docker containers for test
run: |
# generating SSL certificates for Kafka
keytool -genkeypair -keyalg RSA -dname "CN=127.0.0.1" -alias 127.0.0.1 -keystore ./ci/pod/kafka/kafka-server/selfsigned.jks -validity 365 -keysize 2048 -storepass changeit
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it more appropriate to put it in the linux-ci-init-service.sh script ?

Copy link
Contributor Author

@bzp2010 bzp2010 May 16, 2022

Choose a reason for hiding this comment

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

image
First make sure that the certificate exists for docker-compose to start kafka. If the certificate does not exist then the kafka container will crash.

@@ -21,6 +21,9 @@
before_install() {
sudo cpanm --notest Test::Nginx >build.log 2>&1 || (cat build.log && exit 1)

# generating SSL certificates for Kafka
keytool -genkeypair -keyalg RSA -dname "CN=127.0.0.1" -alias 127.0.0.1 -keystore ./ci/pod/kafka/kafka-server/selfsigned.jks -validity 365 -keysize 2048 -storepass changeit

Copy link
Contributor

Choose a reason for hiding this comment

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

so, add this to linux-ci-init-service.sh script ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

@tzssangglass
Copy link
Member

LGTM

@bzp2010 bzp2010 requested a review from tzssangglass May 17, 2022 03:56
soulbird
soulbird previously approved these changes May 17, 2022
tzssangglass
tzssangglass previously approved these changes May 17, 2022
@@ -435,7 +435,7 @@ local function check_upstream_conf(in_dp, conf)
end
end

if conf.tls then
if conf.tls and conf.tls.client_cert and conf.tls.client_key then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if conf.tls and conf.tls.client_cert and conf.tls.client_key then
if conf.tls and conf.tls.client_cert then

is enough?

Copy link
Contributor Author

@bzp2010 bzp2010 May 17, 2022

Choose a reason for hiding this comment

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

Yes, it's enough, we ensure client_cert and client_key both exist by jsonschema's dependencies. Any one of them separate exist is forbidden.

dependencies = {
client_cert = {"client_key"},
client_key = {"client_cert"},
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Copy link
Member

@spacewander spacewander left a comment

Choose a reason for hiding this comment

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

Let's provide a doc about the kafka-proxy plugin.

},
password = {
type = "string",
default = "",
Copy link
Member

Choose a reason for hiding this comment

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

We can remove the default if these fields are required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@bzp2010 bzp2010 dismissed stale reviews from tzssangglass and soulbird via 99bced1 May 17, 2022 06:17
@spacewander spacewander merged commit 18f6e5c into apache:master May 17, 2022
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants