From 328592686f6b2668312b3d57e76d1fb552a9d0a7 Mon Sep 17 00:00:00 2001 From: gardlt Date: Tue, 5 Dec 2017 16:33:44 +0000 Subject: [PATCH] fix(tiller): grpc call terminates prematurely - enhance tiller install grpc timeout - enhance tiller update grpc timeout Closes #182 Change-Id: I98d6246f8a09ce3b805cbad18122e269472a1b34 --- armada/handlers/tiller.py | 13 ++++++++++--- armada/tests/unit/handlers/test_tiller.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/armada/handlers/tiller.py b/armada/handlers/tiller.py index 0232eb8d..1bd22136 100644 --- a/armada/handlers/tiller.py +++ b/armada/handlers/tiller.py @@ -37,6 +37,7 @@ from armada.utils.release import label_selectors TILLER_PORT = 44134 TILLER_VERSION = b'2.5.0' TILLER_TIMEOUT = 300 +GRPC_EPSILON = 60 RELEASE_LIMIT = 64 RUNTEST_SUCCESS = 9 @@ -272,6 +273,9 @@ class Tiller(object): ''' Update a Helm Release ''' + + rel_timeout = self.timeout if not timeout else timeout + LOG.debug("wait: %s", wait) LOG.debug("timeout: %s", timeout) @@ -296,7 +300,8 @@ class Tiller(object): timeout=timeout) stub.UpdateRelease( - release_request, self.timeout, metadata=self.metadata) + release_request, rel_timeout + GRPC_EPSILON, + metadata=self.metadata) except Exception: status = self.get_release_status(release) raise ex.ReleaseException(release, status, 'Upgrade') @@ -312,6 +317,8 @@ class Tiller(object): Create a Helm Release ''' + rel_timeout = self.timeout if not timeout else timeout + LOG.info("Wait: %s, Timeout: %s", wait, timeout) if values is None: @@ -332,8 +339,8 @@ class Tiller(object): timeout=timeout) return stub.InstallRelease( - release_request, self.timeout, metadata=self.metadata) - + release_request, rel_timeout + GRPC_EPSILON, + metadata=self.metadata) except Exception: status = self.get_release_status(release) raise ex.ReleaseException(release, status, 'Install') diff --git a/armada/tests/unit/handlers/test_tiller.py b/armada/tests/unit/handlers/test_tiller.py index ce6401c3..93540fa0 100644 --- a/armada/tests/unit/handlers/test_tiller.py +++ b/armada/tests/unit/handlers/test_tiller.py @@ -46,5 +46,5 @@ class TillerTestCase(unittest.TestCase): ) (mock_stub(tiller.channel).InstallRelease .assert_called_with(release_request, - tiller.timeout, + timeout + 60, metadata=tiller.metadata))