Exemplo n.º 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 = self.nat_interfaces(tf_config)
            nat = NatController(
                interfaces, NatController.get_namespace_index(interfaces[0]))
            nat.add_nat_rules()

            nodes_data["nat"] = nat

            return nodes
Exemplo n.º 2
0
    def infraenv_controller(self, infra_env_configuration: InfraEnvConfig,
                            controller_configuration: BaseNodeConfig,
                            trigger_configurations) -> NodeController:
        if infra_env_configuration.platform == consts.Platforms.VSPHERE:
            # TODO implement for Vsphere
            raise NotImplementedError

        return TerraformController(controller_configuration,
                                   entity_config=infra_env_configuration)
Exemplo n.º 3
0
    def controller(self, cluster_configuration: ClusterConfig,
                   controller_configuration: BaseNodeConfig) -> NodeController:

        if cluster_configuration.platform == consts.Platforms.VSPHERE:
            return VSphereController(controller_configuration,
                                     cluster_configuration)

        return TerraformController(controller_configuration,
                                   entity_config=cluster_configuration)