diff --git a/kuryr_kubernetes/controller/handlers/vif.py b/kuryr_kubernetes/controller/handlers/vif.py index 338deb295..db2a7d106 100644 --- a/kuryr_kubernetes/controller/handlers/vif.py +++ b/kuryr_kubernetes/controller/handlers/vif.py @@ -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)