[8055]
This update adds kubernetes deployment files for the OFagent and fluentd services.
The OFagent calls get_my_containers_name with the assumption that the HOSTNAME
environment variable contains the docker container's ID, which does not appear
to be the case for kuberbetes. In kubernetes a container's HOSTNAME is its pod
name. Feeding a kubernetes pod name into the docker API used by
get_my_containers_name triggers an exception. This is the reason behind the
code changes to OFagent.
The kubernetes config files in this submission still use the old image naming
convention. The names in these and all the other kubernetes deployment files
will be changed to conform to the new convention in a separate update.
Change-Id: I3eecfdcc8bba070ffe3e7372f195cf15f0cdcd56
diff --git a/ofagent/connection_mgr.py b/ofagent/connection_mgr.py
index a61f2ab..13ce2a0 100644
--- a/ofagent/connection_mgr.py
+++ b/ofagent/connection_mgr.py
@@ -41,6 +41,7 @@
class ConnectionManager(object):
def __init__(self, consul_endpoint, vcore_endpoint, controller_endpoints,
+ instance_id,
enable_tls=False, key_file=None, cert_file=None,
vcore_retry_interval=0.5, devices_refresh_interval=5,
subscription_refresh_interval=5):
@@ -50,6 +51,7 @@
self.controller_endpoints = controller_endpoints
self.consul_endpoint = consul_endpoint
self.vcore_endpoint = vcore_endpoint
+ self.instance_id = instance_id
self.enable_tls = enable_tls
self.key_file = key_file
self.cert_file = cert_file
@@ -157,7 +159,7 @@
self._assign_grpc_attributes()
# Send subscription request to register the current ofagent instance
- container_name = get_my_containers_name()
+ container_name = self.instance_id
stub = voltha_pb2.VolthaLocalServiceStub(self.channel)
subscription = stub.Subscribe(OfAgentSubscriber(ofagent_id=container_name))