Merge "Prevent Kuryr restart due to connection issue"

This commit is contained in:
Zuul 2019-11-22 09:21:15 +00:00 committed by Gerrit Code Review
commit d81c083430
1 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from requests import exceptions as requests_exc
from keystoneauth1 import exceptions as key_exc
from kuryr_kubernetes import exceptions from kuryr_kubernetes import exceptions
from kuryr_kubernetes.handlers import asynchronous as h_async from kuryr_kubernetes.handlers import asynchronous as h_async
from kuryr_kubernetes.handlers import dispatch as h_dis from kuryr_kubernetes.handlers import dispatch as h_dis
@ -55,7 +59,10 @@ class ControllerPipeline(h_dis.EventPipeline):
def _wrap_consumer(self, consumer): def _wrap_consumer(self, consumer):
# TODO(ivc): tune retry interval/timeout # TODO(ivc): tune retry interval/timeout
return h_log.LogExceptions(h_retry.Retry( return h_log.LogExceptions(h_retry.Retry(
consumer, exceptions=exceptions.ResourceNotReady)) consumer, exceptions=(
exceptions.ResourceNotReady,
key_exc.connection.ConnectFailure,
requests_exc.ConnectionError)))
def _wrap_dispatcher(self, dispatcher): def _wrap_dispatcher(self, dispatcher):
return h_log.LogExceptions(h_async.Async(dispatcher, self._tg, return h_log.LogExceptions(h_async.Async(dispatcher, self._tg,