Avoid race between pod creation retry and namespace deletion
This patch ensure that if a namespace gets deleted and there is
a pending pod creation retry, the later will not fail due to the
subnet being already deleted.
Change-Id: I914109337066441a2750d055aec5cf0e799d7516
Closes-Bug: 1847446
(cherry picked from commit f85866d84d
)
This commit is contained in:
parent
8824a0f2e9
commit
037fa2120b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue