Consul DNS discovery. Related to #12
This commit is contained in:
parent
fc4e2b1b47
commit
3511f13180
@ -4,6 +4,10 @@
|
|||||||
"host": "http://marathon.mesos:8080",
|
"host": "http://marathon.mesos:8080",
|
||||||
"enabled": false
|
"enabled": false
|
||||||
},
|
},
|
||||||
|
"consul": {
|
||||||
|
"enabled": false,
|
||||||
|
"domain": "service.dc1.consul"
|
||||||
|
},
|
||||||
"confd": "/etc/surok/conf.d",
|
"confd": "/etc/surok/conf.d",
|
||||||
"domain": "marathon.mesos",
|
"domain": "marathon.mesos",
|
||||||
"wait_time": 20,
|
"wait_time": 20,
|
||||||
|
@ -31,6 +31,13 @@ def resolve(app, conf):
|
|||||||
# This is fast fix for port naming
|
# This is fast fix for port naming
|
||||||
# Will be rewrite later
|
# Will be rewrite later
|
||||||
fqdn = ''
|
fqdn = ''
|
||||||
|
|
||||||
|
# Discovery over Consul DNS
|
||||||
|
if 'consul' in conf and conf['consul']['enabled']:
|
||||||
|
fqdn = '_' + service['name'] + '._tcp.' + conf['consul']['domain']
|
||||||
|
hosts[service['name']] = do_query(fqdn, conf['loglevel'])
|
||||||
|
continue
|
||||||
|
|
||||||
if ports is not None:
|
if ports is not None:
|
||||||
for port_name in ports:
|
for port_name in ports:
|
||||||
fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain
|
fqdn = '_' + port_name + '.' + '_' + service['name'] + '.' + group + '._tcp.' + domain
|
||||||
|
Loading…
Reference in New Issue
Block a user