Пример #1
0
        def get_nodes_func(tf_config: BaseTerraformConfig,
                           infraenv_config: InfraEnvConfig):
            if "nodes" in nodes_data:
                return nodes_data["nodes"]

            nodes_data["configs"] = infraenv_config, tf_config

            net_asset = LibvirtNetworkAssets()
            tf_config.net_asset = net_asset.get()
            nodes_data["net_asset"] = net_asset

            controller = TerraformController(tf_config,
                                             entity_config=infraenv_config)
            nodes = Nodes(controller)
            nodes_data["nodes"] = nodes

            nodes.prepare_nodes()

            interfaces = BaseTest.nat_interfaces(tf_config)
            nat = NatController(
                interfaces, NatController.get_namespace_index(interfaces[0]))
            nat.add_nat_rules()

            nodes_data["nat"] = nat

            return nodes
Пример #2
0
    def prepared_controller_configuration(
            self,
            new_controller_configuration: BaseNodeConfig) -> BaseNodeConfig:
        if not isinstance(new_controller_configuration, TerraformConfig):
            yield new_controller_configuration
            return

        # Configuring net asset which currently supported by libvirt terraform only
        net_asset = LibvirtNetworkAssets()
        new_controller_configuration.net_asset = net_asset.get()
        yield new_controller_configuration
        net_asset.release_all()
Пример #3
0
        def get_nodes_func(tf_config: TerraformConfig, cluster_config: ClusterConfig):
            if "nodes" in nodes_data:
                return nodes_data["nodes"]

            nodes_data["configs"] = cluster_config, tf_config
            net_asset = LibvirtNetworkAssets()
            tf_config.net_asset = net_asset.get()
            nodes_data["net_asset"] = net_asset

            controller = TerraformController(tf_config, cluster_config=cluster_config)
            nodes = Nodes(controller, tf_config.private_ssh_key_path)
            nodes_data["nodes"] = nodes

            nodes.prepare_nodes()
            interfaces = BaseTest.nat_interfaces(tf_config)
            nat = NatController(interfaces, NatController.get_namespace_index(interfaces[0]))
            nat.add_nat_rules()
            nodes_data["nat"] = nat

            return nodes
Пример #4
0
        def get_nodes_func(config: Optional[TerraformConfig] = None):
            if not config:
                config = TerraformConfig()

            if "nodes" in nodes_data:
                return nodes_data["nodes"]

            net_asset = LibvirtNetworkAssets()
            config.net_asset = net_asset.get()
            controller = TerraformController(config)
            nodes = Nodes(controller, config.private_ssh_key_path)

            nodes.prepare_nodes()
            interfaces = BaseTest.nat_interfaces(config)
            nat = NatController(
                interfaces, NatController.get_namespace_index(interfaces[0]))
            nat.add_nat_rules()

            nodes_data["nodes"] = nodes
            nodes_data["config"] = config
            nodes_data["net_asset"] = net_asset
            nodes_data["nat"] = nat
            return nodes
def execute_ibip_flow(args):
    openshift_release_image = os.getenv('OPENSHIFT_INSTALL_RELEASE_IMAGE')
    if not openshift_release_image:
        raise ValueError("os env OPENSHIFT_INSTALL_RELEASE_IMAGE must be provided")

    net_asset = LibvirtNetworkAssets().get()
    controller = create_controller(net_asset)
    setup_files_and_folders(args, net_asset, controller.cluster_name)

    extract_installer(openshift_release_image, BUILD_DIR)
    installer_generate(openshift_release_image)

    download_live_image(f"{BUILD_DIR}/installer-image.iso")
    image_path = embed("installer-image.iso", "bootstrap-in-place-for-live-iso.ign", EMBED_IMAGE_NAME)

    logging.info("Starting node...")
    controller.image_path = image_path
    controller.start_all_nodes()
    logging.info("Node started!")

    waiting_for_installation_completion(controller)