Skip to content

Commit

Permalink
Refactor config for iso cluster deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Salvatore Daniele <[email protected]>
  • Loading branch information
SalDaniele committed May 17, 2024
1 parent 8b3531b commit ba2566f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
1 change: 0 additions & 1 deletion cda.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from clusterSnapshotter import ClusterSnapshotter
from virtualBridge import VirBridge


def main_deploy(args: argparse.Namespace) -> None:
cc = ClustersConfig(args.config, args.worker_range)

Expand Down
43 changes: 24 additions & 19 deletions clustersConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ def __init__(self, yaml_path: str, worker_range: common.RangeList):
self.configured_workers = [NodeConfig(self.name, **w) for w in cc["workers"]]
self.workers = [NodeConfig(self.name, **w) for w in worker_range.filter_list(cc["workers"])]

if self.kind == "openshift":
self.configure_ip_range()

# creates hosts entries for each referenced node name
node_names = {x["name"] for x in cc["hosts"]}
for node in self.all_nodes():
if node.node not in node_names:
cc["hosts"].append({"name": node.node})
node_names.add(node.node)

if not self.is_sno():
self.api_vip = {'ip': cc["api_vip"]}
self.ingress_vip = {'ip': cc["ingress_vip"]}

for e in cc["hosts"]:
self.hosts.append(HostConfig(self.network_api_port, **e))

for c in cc["preconfig"]:
self.preconfig.append(ExtraConfigArgs(**c))
for c in cc["postconfig"]:
self.postconfig.append(ExtraConfigArgs(**c))

def configure_ip_range(self):
cc = self.fullConfig
# Reserve IPs for AI, masters and workers.
ip_mask = cc["ip_mask"]
ip_range = cc["ip_range"].split("-")
Expand Down Expand Up @@ -230,25 +254,6 @@ def __init__(self, yaml_path: str, worker_range: common.RangeList):
self.local_bridge_config = BridgeConfig(ip=self.ip_range[0], mask=ip_mask, dynamic_ip_range=dynamic_ip_range)
self.remote_bridge_config = BridgeConfig(ip=ip_range[1], mask=ip_mask)

# creates hosts entries for each referenced node name
node_names = {x["name"] for x in cc["hosts"]}
for node in self.all_nodes():
if node.node not in node_names:
cc["hosts"].append({"name": node.node})
node_names.add(node.node)

if not self.is_sno():
self.api_vip = {'ip': cc["api_vip"]}
self.ingress_vip = {'ip': cc["ingress_vip"]}

for e in cc["hosts"]:
self.hosts.append(HostConfig(self.network_api_port, **e))

for c in cc["preconfig"]:
self.preconfig.append(ExtraConfigArgs(**c))
for c in cc["postconfig"]:
self.postconfig.append(ExtraConfigArgs(**c))

def get_last_ip(self) -> str:
hostconn = host.LocalHost()
last_ip = "0.0.0.0"
Expand Down

0 comments on commit ba2566f

Please sign in to comment.