Skip to content

Commit 685ff65

Browse files
committed
ref(scheduler): move away from using num internally and use the more descriptive replicas variable name
1 parent 5f2ee41 commit 685ff65

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

rootfs/api/models/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def _scale_pods(self, scale_types):
287287
'tags': release.config.tags,
288288
'envs': release.config.values,
289289
'version': version,
290-
'num': scale_types[scale_type],
290+
'replicas': scale_types[scale_type],
291291
'app_type': scale_type,
292292
'build_type': build_type,
293293
'healthcheck': release.config.healthcheck()
@@ -330,7 +330,7 @@ def deploy(self, user, release):
330330
'cpu': release.config.cpu,
331331
'tags': release.config.tags,
332332
'envs': release.config.values,
333-
'num': 0, # Scaling up happens in a separate operation
333+
'replicas': 0, # Scaling up happens in a separate operation
334334
'version': version,
335335
'app_type': scale_type,
336336
'build_type': build_type,

rootfs/scheduler/__init__.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
}
9898
},
9999
"spec": {
100-
"replicas": $num,
100+
"replicas": $replicas,
101101
"selector": {
102102
"app": "$id",
103103
"version": "$appversion",
@@ -151,7 +151,7 @@
151151
}
152152
},
153153
"spec": {
154-
"replicas": $num,
154+
"replicas": $replicas,
155155
"selector": {
156156
"app": "$id",
157157
"version": "$appversion",
@@ -400,19 +400,19 @@ def deploy(self, namespace, name, image, command, **kwargs):
400400

401401
def scale(self, namespace, name, image, command, **kwargs):
402402
logger.debug('scale {}, img {}, params {}, cmd "{}"'.format(name, image, kwargs, command))
403-
num = kwargs.pop('num')
403+
replicas = kwargs.pop('replicas')
404404
if unhealthy(self._get_rc_status(namespace, name)):
405405
# add RC if it is missing for the namespace
406406
try:
407407
# Create RC with scale as 0 and then scale to get pod monitoring
408-
kwargs['num'] = 0
408+
kwargs['replicas'] = 0
409409
self._create_rc(namespace, name, image, command, **kwargs)
410410
except KubeException as e:
411411
logger.debug("Creating RC failed because of: {}".format(str(e)))
412412
raise RuntimeError('{} (RC): {}'.format(name, e))
413413

414414
try:
415-
self._scale_rc(namespace, name, num)
415+
self._scale_rc(namespace, name, replicas)
416416
except KubeException as e:
417417
logger.debug("Scaling failed because of: {}".format(str(e)))
418418
old = self._get_rc(namespace, name).json()
@@ -839,10 +839,10 @@ def _create_rc(self, namespace, name, image, command, **kwargs): # noqa
839839
l = {
840840
"name": name,
841841
"id": namespace,
842-
"appversion": kwargs.get("version", {}),
842+
"appversion": kwargs.get("version"),
843843
"version": self.apiversion,
844844
"image": imgurl,
845-
"num": kwargs.get("num", {}),
845+
"replicas": kwargs.get("replicas", 0),
846846
"containername": container_name,
847847
"type": app_type,
848848
}

0 commit comments

Comments
 (0)