Ignore the headless services

Headless services should not be load-balanced by the platform. This
commit makes sure such services are ignored by Kuryr.

Closes-Bug: #1732597
Change-Id: I39736791f0b3b3fba24f6bdc93a2950751e50147
This commit is contained in:
changhongli 2017-11-16 14:31:56 +08:00
parent ad29c14a4e
commit 00c5f00485
1 changed files with 6 additions and 1 deletions

View File

@ -66,11 +66,16 @@ class LBaaSSpecHandler(k8s_base.ResourceEventHandler):
return None
def _should_ignore(self, service):
return not(self._has_selector(service))
return (not(self._has_selector(service)) or
not(self._has_clusterip(service)))
def _has_selector(self, service):
return service['spec'].get('selector')
def _has_clusterip(sef, service):
# ignore headless service, clusterIP is None
return service['spec'].get('clusterIP') != 'None'
def _get_subnet_id(self, service, project_id, ip):
subnets_mapping = self._drv_subnets.get_subnets(service, project_id)
subnet_ids = {