Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit d19cb3c

Browse files
committed
fix(scheduler): rollback scale / deploy when the desired number of pods can not be brought up in a timely manner
Prior to this if a deploy failed at bringing up pods then it would still scale down the old release instead of rolling back. This would cause users to basically have a broken app if the new pods for whatever reason stick around in Pending mode Fixes #706
1 parent 4f3117d commit d19cb3c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

rootfs/scheduler/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,11 @@ def _wait_until_pods_are_ready(self, namespace, containers, labels, desired, tim
961961
if waited > timeout:
962962
self.log(namespace, 'timed out ({}s) waiting for pods to come up in namespace {}'.format(timeout, namespace)) # noqa
963963

964-
self.log(namespace, "{} out of {} pods are in service".format(count, desired)) # noqa
964+
self.log(namespace, "{} out of {} pods are in service".format(count, desired))
965+
if count != desired:
966+
# raising to allow operations to rollback
967+
raise KubeException('Not enough pods in namespace {} came into service. '
968+
'{} out of {}'.format(namespace, count, desired))
965969

966970
def _scale_rc(self, namespace, name, desired, timeout):
967971
rc = self.get_rc(namespace, name).json()

0 commit comments

Comments
 (0)