@@ -65,7 +65,8 @@ def __init__(
6565 use_proxies = False ,
6666 expected_cluster_id = None ,
6767 per_host_pool_size = 10 ,
68- lock_prefix = "/_locks"
68+ lock_prefix = "/_locks" ,
69+ srv_use_ssl = False
6970 ):
7071 """
7172 Initialize the client.
@@ -115,12 +116,14 @@ def __init__(
115116 connections.
116117 lock_prefix (str): Set the key prefix at etcd when client to lock object.
117118 By default this will be use /_locks.
119+
120+ srv_use_ssl (bool): Should we use SSL alias for cluster autodiscovery.
118121 """
119122
120123 # If a DNS record is provided, use it to get the hosts list
121124 if srv_domain is not None :
122125 try :
123- host = self ._discover (srv_domain )
126+ host = self ._discover (srv_domain , use_ssl = srv_use_ssl )
124127 except Exception as e :
125128 _log .error ("Could not discover the etcd hosts from %s: %s" ,
126129 srv_domain , e )
@@ -219,8 +222,11 @@ def _set_version_info(self):
219222 self ._version = version_info ['etcdserver' ]
220223 self ._cluster_version = version_info ['etcdcluster' ]
221224
222- def _discover (self , domain ):
223- srv_name = "_etcd._tcp.{}" .format (domain )
225+ def _discover (self , domain , use_ssl = False ):
226+ if use_ssl :
227+ srv_name = "_etcd-client-ssl._tcp.{}" .format (domain )
228+ else :
229+ srv_name = "_etcd-client._tcp.{}" .format (domain )
224230 answers = dns .resolver .query (srv_name , 'SRV' )
225231 hosts = []
226232 for answer in answers :
0 commit comments