def test_kube_master_config_medium(): km = KubeMasterResourceConfig(usr_node_type="m3.large", usr_node_max=3, ax_node_type="m3.large", ax_node_max=2, cluster_type=AXClusterType.STANDARD) assert km.max_cu == 5 assert km.master_instance_type == "m3.medium" assert km.master_root_device_size == 16 assert km.master_pd_size == 20
def test_kube_master_config_2xlarge(): km = KubeMasterResourceConfig(usr_node_type="m3.2xlarge", usr_node_max=28, ax_node_type="m3.2xlarge", ax_node_max=2, cluster_type=AXClusterType.STANDARD) assert km.max_cu == 120 assert km.master_instance_type == "r3.2xlarge" assert km.master_root_device_size == 32 assert km.master_pd_size == 60
def _generate_raw_cluster_config_dict_aws(self, config): """ Generate AWS specific cluster config. :param config: :return: """ # TODO: once we support installing with config file, we only overwrite when item is specifically set through CLI config["cloud"]["configure"]["region"] = self._cfg.cloud_region config["cloud"]["configure"]["placement"] = self._cfg.cloud_placement config["cloud"]["trusted_cidr"] = self._cfg.trusted_cidrs config["cloud"]["vpc_id"] = self._cfg.vpc_id # If we install into existing VPC, i.e. vpc_id is not None, or we are going to fetch it # from cluster metadata after cluster is created. config["cloud"][ "vpc_cidr_base"] = self._cfg.vpc_cidr_base if not self._cfg.vpc_id else None config["cloud"]["subnet_size"] = self._cfg.subnet_mask_size config["cloud"]["configure"][ "sandbox_enabled"] = self._cfg.enable_sandbox # TODO (#119): might want to remove this filed as this was used for hacks before. Setting it to "dev" for now config["cloud"]["configure"]["cluster_user"] = "******" # TODO (#117): Switch all spot related options by literals rather than true/false and some other hacks # also need to revise the need of specifying a spot price during installation if self._cfg.spot_instances_option in [ SpotInstanceOption.PARTIAL_SPOT, SpotInstanceOption.ALL_SPOT ]: spot_instances_enabled = "true" else: spot_instances_enabled = "false" config["cloud"]["configure"][ "spot_instances_enabled"] = spot_instances_enabled config["cloud"]["configure"][ "spot_instances_option"] = self._cfg.spot_instances_option config["cloud"]["node_spot_price"] = DEFAULT_NODE_SPOT_PRICE # Configure master axsys_node_type = config["cloud"]["configure"]["axsys_node_type"] axsys_node_max = config["cloud"]["configure"]["axsys_node_count"] axuser_node_type = config["cloud"]["configure"]["axuser_node_type"] axuser_node_max = config["cloud"]["configure"][ "max_node_count"] - axsys_node_max cluster_type = config["cloud"]["configure"]["cluster_type"] if self._cfg.cluster_size != AXClusterSize.CLUSTER_USER_PROVIDED: master_config = KubeMasterResourceConfig( usr_node_type=axuser_node_type, usr_node_max=axuser_node_max, ax_node_type=axsys_node_type, ax_node_max=axsys_node_max, cluster_type=cluster_type) if self._cfg.cluster_size == AXClusterSize.CLUSTER_MVC: # MVC cluster does not follow the heuristics we used to configure master config["cloud"]["configure"]["master_type"] = "m3.xlarge" else: config["cloud"]["configure"][ "master_type"] = master_config.master_instance_type config["cloud"]["configure"][ "master_config_env"] = master_config.kube_up_env # TODO (#121) Need to revise the relationship between user_on_demand_nodes and node minimum, system node count config["cloud"]["configure"][ "axuser_on_demand_nodes"] = self._cfg.user_on_demand_nodes # Get AMI information ami_name = self._cfg.software_info.ami_name ami_id = AMI(aws_profile=self._cfg.cloud_profile, aws_region=self._cfg.cloud_region).get_ami_id_from_name( ami_name=ami_name) config["cloud"]["configure"]["ami_id"] = ami_id # Other configurations config["cloud"]["configure"]["autoscaler_scan_interval"] = str( self._cfg.autoscaling_interval) + "s" config["cloud"]["configure"]["support_object_store_name"] = str( self._cfg.support_object_store_name) return config