-
Notifications
You must be signed in to change notification settings - Fork 64
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
Feature : ACL integration features #287
Merged
Vruttant1403
merged 26 commits into
gojek:master
from
uds5501:feat/acl-integration-gopay
Dec 3, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
75c1ab1
added support for acl auth
Vruttant1403 8b91956
fix tests
Vruttant1403 6287bca
code refactor
Vruttant1403 92a2edb
login module as config
Vruttant1403 199fc2d
lint fix
Vruttant1403 7943cf6
fix lint
Vruttant1403 fdd4c04
fix ssl config map
Vruttant1403 8e517b3
Linter Fixes
rootxakash 7e43f7f
Removes default values
rootxakash a50d6c4
Removes updated tests
rootxakash 6930085
Adds test
rootxakash 5fea14a
[CI_SKIP] Work In Progress
rootxakash cf9594d
Implement SSL SASL ACLs for ziggurat
uds5501 e9d720c
SASL ACL test attempt - failed
uds5501 6961914
Add integration tests for streams test
uds5501 82e5265
ACL integration attempt with SSL TLS
uds5501 9ff0737
WIP: sertting SASL_PLAINTEXT
uds5501 10f50cf
Working integration test with acl
uds5501 e5d4fa6
Cleanup unused files
uds5501 7370270
Update acl creation in cluster
uds5501 6c88271
Fix makefile
uds5501 3aa50e6
Fix container names
uddeshyaGojek 1e3fd4e
fix cloverage pipeline
uds5501 f4189a2
remove the logs
uds5501 f0d0f38
remove additional rm
uds5501 dad1197
Add documentation for login-callback-handler
uds5501 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,100 @@ | ||
KAFKA_TOPICS = topic another-test-topic | ||
KAFKA_BROKERS = kafka1:9095 kafka2:9096 kafka3:9097 | ||
ADMIN_CONFIG = /etc/kafka/secrets/config-admin.properties | ||
KAFKA_CONTAINER = ziggurat_kafka1_1 | ||
|
||
.PHONY: all | ||
all: test | ||
|
||
topic="topic" | ||
another_test_topic="another-test-topic" | ||
# Main target to setup the entire cluster | ||
setup-cluster: down up wait-for-kafka create-scram-credentials create-topics setup-acls | ||
|
||
setup: | ||
docker-compose down | ||
lein deps | ||
docker-compose up -d | ||
sleep 10 | ||
docker exec ziggurat_kafka /opt/bitnami/kafka/bin/kafka-topics.sh --create --topic $(topic) --partitions 3 --replication-factor 1 --zookeeper ziggurat_zookeeper | ||
docker exec ziggurat_kafka /opt/bitnami/kafka/bin/kafka-topics.sh --create --topic $(another_test_topic) --partitions 3 --replication-factor 1 --zookeeper ziggurat_zookeeper | ||
# Bring down all containers and clean volumes | ||
down: | ||
@echo "Bringing down all containers..." | ||
docker-compose -f docker-compose-cluster.yml down -v | ||
|
||
test: setup | ||
TESTING_TYPE=local lein test | ||
docker-compose down | ||
# Start all containers | ||
up: | ||
@echo "Starting all containers..." | ||
docker-compose -f docker-compose-cluster.yml up -d | ||
|
||
setup-cluster: | ||
rm -rf /tmp/ziggurat_kafka_cluster_data | ||
docker-compose -f docker-compose-cluster.yml -p ziggurat down | ||
lein deps | ||
docker-compose -f docker-compose-cluster.yml -p ziggurat up -d | ||
sleep 30 | ||
# Sleeping for 30s to allow the cluster to come up | ||
docker exec ziggurat_kafka1_1 kafka-topics --create --topic $(topic) --partitions 3 --replication-factor 3 --if-not-exists --zookeeper ziggurat_zookeeper_1 | ||
docker exec ziggurat_kafka1_1 kafka-topics --create --topic $(another_test_topic) --partitions 3 --replication-factor 3 --if-not-exists --zookeeper ziggurat_zookeeper_1 | ||
# Wait for Kafka to be ready | ||
wait-for-kafka: | ||
@echo "Waiting for Kafka to be ready..." | ||
@sleep 30 | ||
|
||
# Restart everything | ||
restart: down up wait-for-kafka | ||
|
||
# Create SCRAM credentials for admin user | ||
create-scram-credentials: | ||
@echo "Creating SCRAM credentials for admin user..." | ||
@docker exec $(KAFKA_CONTAINER) kafka-configs \ | ||
--alter \ | ||
--zookeeper zookeeper:2181 \ | ||
--add-config 'SCRAM-SHA-256=[password=admin]' \ | ||
--entity-type users \ | ||
--entity-name admin | ||
|
||
# Create all required topics | ||
create-topics: | ||
@for topic in $(KAFKA_TOPICS); do \ | ||
echo "Creating topic: $$topic"; \ | ||
docker exec $(KAFKA_CONTAINER) kafka-topics \ | ||
--create \ | ||
--zookeeper zookeeper:2181 \ | ||
--if-not-exists \ | ||
--topic $$topic \ | ||
--partitions 3 \ | ||
--replication-factor 3; \ | ||
done | ||
|
||
# Setup ACLs for admin user on all brokers | ||
setup-acls: | ||
@for broker in $(KAFKA_BROKERS); do \ | ||
case $$broker in \ | ||
kafka1:9095) \ | ||
container="ziggurat_kafka1_1" ;; \ | ||
kafka2:9096) \ | ||
container="ziggurat_kafka2_1" ;; \ | ||
kafka3:9097) \ | ||
container="ziggurat_kafka3_1" ;; \ | ||
esac; \ | ||
for topic in $(KAFKA_TOPICS); do \ | ||
echo "Setting up ACLs for topic: $$topic on broker: $$broker using container: $$container"; \ | ||
docker exec $$container kafka-acls \ | ||
--bootstrap-server $$broker \ | ||
--command-config $(ADMIN_CONFIG) \ | ||
--add \ | ||
--allow-principal User:admin \ | ||
--operation All \ | ||
--topic $$topic; \ | ||
done \ | ||
done | ||
|
||
# Clean up topics (can be used during development) | ||
clean-topics: | ||
@for topic in $(KAFKA_TOPICS); do \ | ||
echo "Deleting topic: $$topic"; \ | ||
docker exec $(KAFKA_CONTAINER) kafka-topics --bootstrap-server kafka1:9095 \ | ||
--delete \ | ||
--topic $$topic; \ | ||
done | ||
|
||
# Show logs | ||
logs: | ||
docker-compose -f docker-compose-cluster.yml logs -f | ||
|
||
test-cluster: setup-cluster | ||
TESTING_TYPE=cluster lein test | ||
docker-compose -f docker-compose-cluster.yml down | ||
rm -rf /tmp/ziggurat_kafka_cluster_data | ||
|
||
coverage: setup | ||
coverage: setup-cluster | ||
lein code-coverage | ||
docker-compose down | ||
docker-compose -f docker-compose-cluster.yml down | ||
|
||
|
||
proto: | ||
protoc -I=resources --java_out=test/ resources/proto/example.proto | ||
protoc -I=resources --java_out=test/ resources/proto/person.proto | ||
protoc -I=resources --java_out=test/ resources/proto/person.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
security.protocol=SASL_PLAINTEXT | ||
sasl.mechanism=SCRAM-SHA-256 | ||
sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \ | ||
username="admin" \ | ||
password="admin"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
KafkaServer { | ||
org.apache.kafka.common.security.scram.ScramLoginModule required | ||
username="admin" | ||
password="admin"; | ||
}; | ||
|
||
Client { | ||
org.apache.zookeeper.server.auth.DigestLoginModule required | ||
username="admin" | ||
password="admin"; | ||
}; | ||
|
||
KafkaClient { | ||
org.apache.kafka.common.security.scram.ScramLoginModule required | ||
username="client" | ||
password="client-secret"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have we removed these. ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seemed redundant to mount this volume, will add back