From a06205dcb048c797122d794ae0e0d2a8353188d2 Mon Sep 17 00:00:00 2001 From: Andrey Pavlov Date: Tue, 22 Nov 2016 17:57:05 +0000 Subject: [PATCH] Adding cluster_domain config option This option will be used in `address` function and will be added to internal urls, so that default address will be changed: service.ccp -> service.ccp.cluster.local Change-Id: Ic5f1968f81a66c84b8c83148ebf219b679aff61b Depends-On: Iaa7e1172120506e284a0ae7b3c4539af411c8535 --- fuel_ccp_entrypoint/start_script.py | 3 ++- fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fuel_ccp_entrypoint/start_script.py b/fuel_ccp_entrypoint/start_script.py index 7b0ef52..fa3da12 100644 --- a/fuel_ccp_entrypoint/start_script.py +++ b/fuel_ccp_entrypoint/start_script.py @@ -224,7 +224,8 @@ def address(service, port=None, external=False, with_scheme=False): addr = '%s:%s' % (VARIABLES['k8s_external_ip'], port['node']) if addr is None: - addr = '%s.%s' % (service, VARIABLES['namespace']) + addr = '.'.join((service, VARIABLES['namespace'], 'svc', + VARIABLES['cluster_domain'])) if port: addr = '%s:%s' % (addr, port['cont']) diff --git a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py index 03b72c3..90e1f82 100644 --- a/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py +++ b/fuel_ccp_entrypoint/tests/test_fuel_ccp_entrypoint.py @@ -155,6 +155,7 @@ class TestGetETCDClient(base.TestCase): start_script.VARIABLES = { "role_name": "banana", "namespace": "ccp", + "cluster_domain": 'cluster.local', "etcd": { "client_port": { "cont": 1234 @@ -169,7 +170,7 @@ class TestGetETCDClient(base.TestCase): etcd_client = start_script.get_etcd_client() self.assertIs(expected_value, etcd_client) m_etcd.assert_called_once_with( - host=(('etcd.ccp', 1234),), + host=(('etcd.ccp.svc.cluster.local', 1234),), allow_reconnect=True, read_timeout=2)