Skip to content

Commit b01bf41

Browse files
committed
fix(scheduler) scheduler stops a scale operation early if desired is the same as current number of pods
Fixes #505
1 parent e17cdfa commit b01bf41

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
@@ -801,10 +801,14 @@ def _scale_rc(self, namespace, name, desired):
801801
}
802802
current = len(self._get_pods(namespace, labels=labels).json()['items'])
803803

804+
if desired == current:
805+
logger.debug("Not scaling RC {} in Namespace {} to {} replicas. Already at desired replicas".format(name, namespace, desired)) # noqa
806+
return
807+
804808
# Set the new desired replica count
805809
rc['spec']['replicas'] = desired
806810

807-
logger.debug("scaling RC {} in namespace {} from {} to {} replicas".format(name, namespace, current, desired)) # noqa
811+
logger.debug("scaling RC {} in Namespace {} from {} to {} replicas".format(name, namespace, current, desired)) # noqa
808812

809813
url = self._api("/namespaces/{}/replicationcontrollers/{}", namespace, name)
810814
resp = self.session.put(url, json=rc)

0 commit comments

Comments
 (0)