From 65bb3b922cbb34fac6cdf49a033e081d354a93b7 Mon Sep 17 00:00:00 2001 From: Alex Corvin Date: Mon, 4 Dec 2023 13:55:02 -0500 Subject: [PATCH] Allow setting worker replica count to 0 Some OpenShift cluster topologies (single node openshift, schedulable master nodes) require creating a cluster with zero worker nodes. We want to be able to deploy clusters with this configuration to more optimally use our cloud resource quotas. This change is necessary to allow OSIA to provision a cluster with zero workers. Prior to this change, if you set the count to zero with the CLI `--worker-replicas` flag, Jinja would interpret zero as False and therefore use the default value of 3. This moves the logic for setting the default value to the base cloud class. I moved the master node replica count logic to the same place for consistency. --- osia/installer/clouds/base.py | 4 ++-- osia/installer/templates/install-config-base.yaml.jinja2 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osia/installer/clouds/base.py b/osia/installer/clouds/base.py index 7ff4fe9..c913d3e 100644 --- a/osia/installer/clouds/base.py +++ b/osia/installer/clouds/base.py @@ -33,11 +33,11 @@ def __init__(self, cluster_name=None, base_domain=None, master_flavor=None, - master_replicas=None, + master_replicas='3', pull_secret_file=None, ssh_key_file=None, worker_flavor=None, - worker_replicas=None, + worker_replicas='3', certificate_bundle_file=None, cluster_directory=None, skip_clean=False, diff --git a/osia/installer/templates/install-config-base.yaml.jinja2 b/osia/installer/templates/install-config-base.yaml.jinja2 index 8b5355a..37e807b 100644 --- a/osia/installer/templates/install-config-base.yaml.jinja2 +++ b/osia/installer/templates/install-config-base.yaml.jinja2 @@ -25,14 +25,14 @@ compute: {% block deploymentType %}{% endblock %}: type: {{ worker_flavor }} {% else %} platform: {}{% endif %} - replicas: {{ worker_replicas|default("3", true) }} + replicas: {{ worker_replicas }} controlPlane: hyperthreading: Enabled name: master {% if master_flavor %} platform: {{ self.deploymentType() }}: type: {{ master_flavor }}{% else %} platform: {}{% endif %} - replicas: {{ master_replicas|default("3", true) }} + replicas: {{ master_replicas }} metadata: name: {{ cluster_name }} networking: