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
This commit is contained in:
Andrey Pavlov 2016-11-22 17:57:05 +00:00
parent 473d178443
commit a06205dcb0
2 changed files with 4 additions and 2 deletions

View File

@ -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'])

View File

@ -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)