Merge "Avoid race between pod creation retry and namespace deletion" into stable/train

This commit is contained in:
Zuul 2019-10-11 08:40:50 +00:00 committed by Gerrit Code Review
commit df5d7cbd0f
1 changed files with 10 additions and 2 deletions

View File

@ -92,8 +92,16 @@ class VIFHandler(k8s_base.ResourceEventHandler):
project_id = self._drv_project.get_project(pod)
security_groups = self._drv_sg.get_security_groups(pod, project_id)
if not state:
subnets = self._drv_subnets.get_subnets(pod, project_id)
try:
subnets = self._drv_subnets.get_subnets(pod, project_id)
except n_exc.NotFound:
LOG.warning("Subnet does not exists. If namespace driver is "
"used, probably the namespace for the pod is "
"already deleted. So this pod does not need to "
"get a port as it will be deleted too. If the "
"default subnet driver is used, then you must "
"select an existing subnet to be used by Kuryr.")
return
# Request the default interface of pod
main_vif = self._drv_vif_pool.request_vif(
pod, project_id, subnets, security_groups)