Avoid namespace deletion error if processing a duplicated event
In case of a kuryr-controller restart, if the namespace deletion event was already executed and it is retriggered, it can make the kuryr-controller fail as the kuryrnet CRD would have been already deleted and we cannot obtain the subnet id from it. In that case the event just need to be skip. Change-Id: I14fcf820d94319541dd7bf13893e82cf0373969c Closes-Bug: 1847453
This commit is contained in:
parent
3953b99599
commit
efae1f5211
|
@ -137,6 +137,14 @@ class NamespaceHandler(k8s_base.ResourceEventHandler):
|
||||||
namespace)
|
namespace)
|
||||||
return
|
return
|
||||||
net_crd = self._get_net_crd(net_crd_id)
|
net_crd = self._get_net_crd(net_crd_id)
|
||||||
|
if not net_crd:
|
||||||
|
LOG.warning("This should not happen. Probably this is event "
|
||||||
|
"is processed twice due to a restart or etcd is "
|
||||||
|
"not in sync")
|
||||||
|
# NOTE(ltomasbo): We should rely on etcd properly behaving, so
|
||||||
|
# we are returning here to prevent duplicated events processing
|
||||||
|
# but not to prevent etcd failures.
|
||||||
|
return
|
||||||
|
|
||||||
net_crd_name = 'ns-' + namespace['metadata']['name']
|
net_crd_name = 'ns-' + namespace['metadata']['name']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue