From a4d0e22530db83125aa462dae3eb1d1930e7efab Mon Sep 17 00:00:00 2001 From: Johann Fuechsl Date: Mon, 15 Jun 2020 14:35:27 +0200 Subject: [PATCH] fix(controller): Set replicas to the current value of the deployment. --- rootfs/scheduler/resources/deployment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rootfs/scheduler/resources/deployment.py b/rootfs/scheduler/resources/deployment.py index 0618dc274..7f5d5da64 100644 --- a/rootfs/scheduler/resources/deployment.py +++ b/rootfs/scheduler/resources/deployment.py @@ -137,6 +137,11 @@ def create(self, namespace, name, image, entrypoint, command, spec_annotations, return response def update(self, namespace, name, image, entrypoint, command, spec_annotations, **kwargs): + # Set the replicas value to the current replicas of the deployment. + # This avoids resetting the replicas which causes disruptions during the deployment. + deployment = self.deployment.get(namespace, name).json() + current_replicas = int(deployment['spec']['replicas']) + kwargs['replicas'] = current_replicas manifest = self.manifest(namespace, name, image, entrypoint, command, spec_annotations, **kwargs)