2023-06-25 08:13:48 +00:00
|
|
|
.PHONY: build-producer build-consumer run dependencies infrastructure-local infrastructure-prod topic-scram topic-ssl consume-topic
|
2023-06-16 05:33:14 +00:00
|
|
|
|
2023-06-14 05:51:58 +00:00
|
|
|
ACTION=apply
|
|
|
|
|
2023-06-25 08:13:48 +00:00
|
|
|
build-producer: dependencies
|
|
|
|
go build -o out/kafka-producer ./cmd/producer.go
|
|
|
|
|
|
|
|
build-consumer: dependencies
|
|
|
|
go built -o out/kafka-consumer ./cmd/consumer.go
|
2023-06-16 05:33:14 +00:00
|
|
|
|
|
|
|
dependencies:
|
|
|
|
go mod tidy
|
|
|
|
|
|
|
|
run:
|
2023-06-25 08:13:48 +00:00
|
|
|
./out/kafka-producer -c ./configuration.yaml
|
2023-06-16 05:33:14 +00:00
|
|
|
|
2023-06-14 05:51:58 +00:00
|
|
|
infrastructure-local:
|
|
|
|
cd manifest && \
|
|
|
|
terraform workspace select kind-cluster-dev && \
|
|
|
|
terraform $(ACTION)
|
|
|
|
|
|
|
|
infrastructure-prod:
|
|
|
|
cd manifest && \
|
|
|
|
terraform workspace select default && \
|
|
|
|
terraform $(ACTION)
|
|
|
|
|
|
|
|
topic-ssl:
|
|
|
|
kubectl view-secret -n streaming kafka-user user.p12 > user.p12 && \
|
|
|
|
kubectl view-secret -n streaming cluster-development-cluster-ca-cert ca.crt | kcat -b kafka.127.0.0.1.nip.io:443 -L -J -X 'security.protocol=ssl' -X "ssl.ca.location=/dev/stdin" -X "ssl.keystore.location=user.p12" -X "ssl.keystore.password=$$(kubectl view-secret -n streaming kafka-user user.password)" |jq && \
|
|
|
|
rm -rf user.p12
|
|
|
|
|
|
|
|
topic-scram:
|
2023-06-16 05:33:14 +00:00
|
|
|
kubectl view-secret -n streaming kafka-dev-listener-certificate ca.crt | kcat -b kafka.localdomain:9092 -L -J -X 'security.protocol=sasl_ssl' -X 'sasl.mechanism=SCRAM-SHA-512' -X 'sasl.username=kafka-user' -X "sasl.password=$(kubectl view-secret -n streaming kafka-user password)" -X "ssl.ca.location=/dev/stdin" | jq
|
|
|
|
|
|
|
|
consume-topic:
|
|
|
|
kubectl view-secret -n streaming admin user.p12 > user.p12 && \
|
|
|
|
kubectl view-secret -n streaming cluster-development-cluster-ca-cert ca.crt | kcat -b kafka.127.0.0.1.nip.io:443 -X 'security.protocol=ssl' -X "ssl.ca.location=/dev/stdin" -X "ssl.keystore.location=user.p12" -X "ssl.keystore.password=$$(kubectl view-secret -n streaming admin user.password)" -v -G test-group -o beginning dev.emitter.json && \
|
|
|
|
rm -rf user.p12
|