def nodes_flow(client, cluster_name, cluster): nodes_details = _create_node_details(cluster_name) if cluster: nodes_details["cluster_inventory_id"] = cluster.id create_nodes_and_wait_till_registered(inventory_client=client, cluster=cluster, image_path=args.image or consts.IMAGE_PATH, storage_path=args.storage_path, master_count=args.master_count, nodes_details=nodes_details) if client: cluster_info = client.cluster_get(cluster.id) macs = utils.get_libvirt_nodes_macs(nodes_details["libvirt_network_name"]) if not (cluster_info.api_vip and cluster_info.ingress_vip): utils.wait_till_hosts_with_macs_are_in_status(client=client, cluster_id=cluster.id, macs=macs, statuses=[consts.NodesStatus.INSUFFICIENT]) set_cluster_vips(client, cluster.id) else: log.info("VIPs already configured") set_hosts_roles(client, cluster.id, nodes_details["libvirt_network_name"]) utils.wait_till_hosts_with_macs_are_in_status(client=client, cluster_id=cluster.id, macs=macs, statuses=[consts.NodesStatus.KNOWN]) log.info("Printing after setting roles") pprint.pprint(client.get_cluster_hosts(cluster.id)) if args.install_cluster: time.sleep(10) install_cluster.run_install_flow(client=client, cluster_id=cluster.id, kubeconfig_path=consts.DEFAULT_CLUSTER_KUBECONFIG_PATH, pull_secret=args.pull_secret)
def nodes_flow(client, cluster_name, cluster, image_path): nodes_details = _create_node_details(cluster_name) if cluster: nodes_details["cluster_inventory_id"] = cluster.id tf_folder = utils.get_tf_folder(cluster_name, args.namespace) utils.recreate_folder(tf_folder) copy_tree(consts.TF_TEMPLATE, tf_folder) tf = terraform_utils.TerraformUtils(working_dir=tf_folder) create_nodes_and_wait_till_registered(cluster_name=cluster_name, inventory_client=client, cluster=cluster, image_path=image_path, storage_path=args.storage_path, master_count=args.master_count, nodes_details=nodes_details, tf=tf) if client: cluster_info = client.cluster_get(cluster.id) macs = utils.get_libvirt_nodes_macs( nodes_details["libvirt_network_name"]) if not (cluster_info.api_vip and cluster_info.ingress_vip): utils.wait_till_hosts_with_macs_are_in_status( client=client, cluster_id=cluster.id, macs=macs, statuses=[ consts.NodesStatus.INSUFFICIENT, consts.NodesStatus.PENDING_FOR_INPUT, ], ) if args.vip_dhcp_allocation: set_cluster_machine_cidr(client, cluster.id, args.vm_network_cidr) else: set_cluster_vips(client, cluster.id) else: log.info("VIPs already configured") set_hosts_roles(client, cluster.id, nodes_details["libvirt_network_name"]) utils.wait_till_hosts_with_macs_are_in_status( client=client, cluster_id=cluster.id, macs=macs, statuses=[consts.NodesStatus.KNOWN], ) if args.install_cluster: time.sleep(10) install_cluster.run_install_flow( client=client, cluster_id=cluster.id, kubeconfig_path=consts.DEFAULT_CLUSTER_KUBECONFIG_PATH, pull_secret=args.pull_secret, tf=tf) # Validate DNS domains resolvability validate_dns(client, cluster.id) if args.wait_for_cvo: cluster_info = client.cluster_get(cluster.id) log.info("Start waiting till CVO status is available") utils.config_etc_hosts(cluster_info) utils.wait_for_cvo_available()