Skip to content

Commit

Permalink
Dont't change aliveness for certain exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
gryf committed Jul 5, 2021
1 parent 112710a commit 2fe8239
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions kuryr_kubernetes/handlers/retry.py
Expand Up @@ -23,6 +23,7 @@
from oslo_utils import excutils

from kuryr_kubernetes import clients
from kuryr_kubernetes.controller.managers import prometheus_exporter
from kuryr_kubernetes import exceptions
from kuryr_kubernetes.handlers import base
from kuryr_kubernetes import utils
Expand Down Expand Up @@ -83,6 +84,20 @@ def __call__(self, event, *args, **kwargs):
}
self._handler(event, *args, retry_info=info, **kwargs)
break
except (exceptions.LoadBalancerNotReady,
exceptions.PortNotReady) as exc:
cls_map = {'LoadBalancerNotReady': 'lb_change_state',
'PortNotReady': 'port_change_state'}
with excutils.save_and_reraise_exception() as ex:
if self._sleep(deadline, attempt, ex.value):
ex.reraise = False
else:
exporter = (prometheus_exporter
.ControllerPrometheusExporter
.get_instance())
method = getattr(exporter, cls_map[type(exc).__name__])
method('notready')

except os_exc.ConflictException as ex:
if ex.details.startswith('Quota exceeded for resources'):
with excutils.save_and_reraise_exception() as ex:
Expand Down

0 comments on commit 2fe8239

Please sign in to comment.