def update(self):
        desired = self.new_rc.replicas
        original = self.old_rc.replicas
        max_unavailable = extract_max_value(self.max_unavailable, "max_unavailable", desired)
        max_surge = extract_max_value(self.max_surge, "max_surge", desired)
        min_available = max_unavailable - original
        if self.new_rc.exists():
            logger.info("ReplicationController {} already exists.".format(self.new_rc.name))
            return False
        new_selector = self.new_rc.obj["spec"]["selector"]
        old_selector = self.old_rc.obj["spec"]["selector"]
        if new_selector == old_selector:
            raise KubernetesError(
                "error: {} must specify a matching key with non-equal value in Selector for {}".format(
                    self.new_rc.name,
                    self.old_rc.name
                ))
        new_labels = self.new_rc.obj["spec"]["template"]["metadata"]["labels"]
        if new_selector != new_labels:
            raise KubernetesError(
                "The ReplicationController {} is invalid. spec.template.metadata.labels: Invalid value: {}: `selector` does not match template `labels` {}".format(
                    self.new_rc.name,
                    new_selector,
                    new_labels))

        self.create_rc(self.new_rc)
        logger.info("Created {}".format(self.new_rc.name))
        new_rc, old_rc = self.new_rc, self.old_rc

        logger.info(
            "scaling up {} from {} to {}, scaling down {} from {} to 0 (keep {} pods available, don't exceed {} pods)".format(
                new_rc.name,
                new_rc.replicas,
                desired,
                old_rc.name,
                old_rc.replicas,
                min_available,
                original + max_surge
            ),
        )

        while new_rc.replicas != desired or old_rc.replicas != 0:
            scaled_rc = self.scale_up(
                new_rc, old_rc,
                original, desired,
                max_surge, max_unavailable,
            )
            new_rc = scaled_rc
            time.sleep(self.update_period)
            scaled_rc = self.scale_down(
                new_rc, old_rc,
                desired,
                min_available, max_surge,
            )
            old_rc = scaled_rc

        logger.info("Update succeeded. Deleting {}".format(old_rc.name))
        self.cleanup(old_rc, new_rc)
dataset/ETHPy150Open eldarion-gondor/pykube/pykube/rolling_updater.py/RollingUpdater.update/swapped operands of `-`