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

Commit 6406e88

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 a0567ea commit 6406e88

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
@@ -975,7 +975,11 @@ def _wait_until_pods_are_ready(self, namespace, containers, labels, desired, tim
975975
if waited > timeout:
976976
self.log(namespace, 'timed out ({}s) waiting for pods to come up in namespace {}'.format(timeout, namespace)) # noqa
977977

978-
self.log(namespace, "{} out of {} pods are in service".format(count, desired)) # noqa
978+
self.log(namespace, "{} out of {} pods are in service".format(count, desired))
979+
if count != desired:
980+
# raising to allow operations to rollback
981+
raise KubeException('Not enough pods in namespace {} came into service. '
982+
'{} out of {}'.format(namespace, count, desired))
979983

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

0 commit comments

Comments
 (0)