Skip to content

Commit ee043ba

Browse files
authored
fix: add support for Kafka GSSAPI (#398)
The aiokafka package already supports GSSAPI as long as it has the correct packages installed along with kerberos. This fix just passes in the parameters from EDA to aiokafka The DE should in CentOS should have * krb5-libs * krb5-devel Along with the python gssapi package.
1 parent 0eee310 commit ee043ba

File tree

6 files changed

+19
-3
lines changed

6 files changed

+19
-3
lines changed

.config/dictionary.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ kaiokmo
5151
keygen
5252
keypass
5353
keytool
54+
krb5-user
55+
libkrb5-dev
5456
libpq
5557
libsystemd
5658
mydb

.github/workflows/tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
run: |
8585
sudo apt-get -qq -o Dpkg::Use-Pty=0 remove -y docker-compose
8686
sudo apt-get -qq -o Dpkg::Use-Pty=0 update -y --fix-missing
87-
sudo apt-get -qq -o Dpkg::Use-Pty=0 --assume-yes --no-install-recommends install -y apt-transport-https curl libsystemd0 libsystemd-dev pkg-config
87+
sudo apt-get -qq -o Dpkg::Use-Pty=0 --assume-yes --no-install-recommends install -y apt-transport-https curl libsystemd0 libsystemd-dev pkg-config libkrb5-dev krb5-user
8888
sudo add-apt-repository ppa:deadsnakes/ppa
8989
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
9090
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

extensions/eda/plugins/event_source/kafka.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@
9494
description:
9595
- Password for SASL PLAIN authentication.
9696
type: str
97+
sasl_kerberos_service_name:
98+
description:
99+
- The service name, default is kafka
100+
type: str
101+
sasl_kerberos_domain_name:
102+
description:
103+
- The kerberos REALM
104+
type: str
97105
"""
98106

99107
EXAMPLES = r"""
@@ -173,6 +181,8 @@ async def main( # pylint: disable=R0914
173181
sasl_mechanism=args.get("sasl_mechanism", "PLAIN"),
174182
sasl_plain_username=args.get("sasl_plain_username"),
175183
sasl_plain_password=args.get("sasl_plain_password"),
184+
sasl_kerberos_service_name=args.get("sasl_kerberos_service_name"),
185+
sasl_kerberos_domain_name=args.get("sasl_kerberos_domain_name"),
176186
)
177187

178188
await kafka_consumer.start()

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ ansible-core>=2.15
22
pyyaml>=6.0.1
33
aiobotocore
44
aiohttp
5-
aiokafka
5+
aiokafka[gssapi]
66
azure-servicebus
77
dpath
88
# https://github.com/dpkp/kafka-python/issues/2412#issuecomment-2030459360

tests/unit/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
aiobotocore
22
aiohttp
3-
aiokafka
3+
aiokafka[gssapi]
44
asyncio
55
asyncmock
66
azure-servicebus

tox.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ requires =
2323
ignore_basepython_conflict = false
2424

2525
[testenv]
26+
# Currently ansible has issues loading Cython compiled modules
27+
# from under the ansible_collection/ansible/eda directory.
28+
# https://github.com/ansible/ansible/pull/84758
29+
env_dir=/tmp/event_driven_ansible/.tox/{env_name}
2630
description =
2731
Run unit tests
2832
py{39,310,311,312,313}: with {basepython}

0 commit comments

Comments
 (0)