Skip to content

feat(pubsub): support kafka tls and sasl/plain auth#7046

Merged
spacewander merged 23 commits into
apache:masterfrom
bzp2010:feat-pubsub-kafka-adv
May 17, 2022
Merged

feat(pubsub): support kafka tls and sasl/plain auth#7046
spacewander merged 23 commits into
apache:masterfrom
bzp2010:feat-pubsub-kafka-adv

Conversation

@bzp2010

@bzp2010 bzp2010 commented May 13, 2022

Copy link
Copy Markdown
Contributor

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

bzp2010 commented May 13, 2022

Copy link
Copy Markdown
Contributor Author

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
@bzp2010 bzp2010 self-assigned this May 14, 2022
membphis
membphis previously approved these changes May 15, 2022

@membphis membphis left a comment

Copy link
Copy Markdown
Member

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
- 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
Copy Markdown
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 ?

@bzp2010 bzp2010 May 16, 2022

Copy link
Copy Markdown
Contributor Author

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.


# 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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ditto

Comment thread apisix/plugins/kafka-proxy.lua Outdated
@tzssangglass

Copy link
Copy Markdown
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
Comment thread apisix/upstream.lua Outdated
end

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

Copy link
Copy Markdown
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?

@bzp2010 bzp2010 May 17, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

@spacewander spacewander left a comment

Copy link
Copy Markdown
Member

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.

Comment thread apisix/plugins/kafka-proxy.lua Outdated
},
password = {
type = "string",
default = "",

Copy link
Copy Markdown
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
Copy Markdown
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
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.

5 participants