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

wip #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

wip #237

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions automation/devops_automation_infra/k8s_plugins/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def _is_exposed(self):

def _expose(self):
# Checks if kafka is already exposed
import ipdb;ipdb.set_trace()
if self._is_exposed:
return

Expand Down Expand Up @@ -80,9 +81,12 @@ def _add_default_options(self, kwargs):

def _bootstrap_endpoint(self):
v1 = kubernetes.client.CoreV1Api(self._cluster.Kubectl.client())
port = v1.read_namespaced_service(namespace=self._namespace, name='kafka-cluster-kafka-external-bootstrap').spec.ports[0].node_port
port = v1.read_namespaced_service(namespace=self._namespace, name='kafka-cluster-kafka-external-bootstrap').spec.ports[0].port
return f"{self._master.ip}:{port}"

def change_namespace(self,namespace):
self._namespace = namespace

def admin(self, **kwargs):
self._expose()
options = self._add_default_options(kwargs)
Expand All @@ -91,7 +95,7 @@ def admin(self, **kwargs):
def consumer(self, *topics, **kwargs):
self._expose()
options = self._add_default_options(kwargs)
return kafka.KafkaConsumer(*topics, **options)
return kafka.KafkaConsumer(security_protocol="SSL",*topics, **options)

def producer(self, **kwargs):
self._expose()
Expand Down
2 changes: 1 addition & 1 deletion automation/proxy_container/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ boto3
grpcio==1.21.1
PyMySQL==0.9.3
python-consul
kafka-python==2.0.1
kafka-python==2.0.2
munch==2.5.0
pyzmq==19.0.1
paho-mqtt==1.5.1
Expand Down