2020from codehub .cli .helm .create import create_deploy
2121from codehub .cli .helm .install import install_helm_chart
2222from codehub .cli .helpers import get_cloud_dir , get_latest_deployment , read_yaml
23- from codehub .cli .manage import wait_for_hub_to_get_ready , get_ip
23+ from codehub .cli .manage import wait_for_hub_to_get_ready
2424import kubernetes .client .rest # Add this import for the exception handling
2525
2626
27- def create_infrastructure (config : CreateConfig ):
27+ def create_infrastructure (config : CreateConfig ) -> DeployConfig :
2828 helm_dir , hub_dir , k8s_dir , cloud_dir = __create_deploy_structure (config .name )
2929
3030 setup_terraform (
@@ -38,31 +38,21 @@ def create_infrastructure(config: CreateConfig):
3838 )
3939 __create_k8s_resources (deploy_config )
4040
41- return get_ip ( config . name , k8s_dir )
41+ return deploy_config
4242
4343
44- def create (config : CreateConfig ):
45- helm_dir , hub_dir , k8s_dir , cloud_dir = __create_deploy_structure (config .name )
46-
47- setup_terraform (
48- config = config ,
49- cloud_dir = cloud_dir ,
50- )
51-
52- cloud_state = terraform_apply (cloud_dir = cloud_dir )
53- deploy_config = DeployConfig (
54- config .name , config .region , helm_dir , hub_dir , k8s_dir , cloud_state
55- )
44+ def create (config : CreateConfig ) -> DeployConfig :
45+ deploy_config = create_infrastructure (config )
5646 hub_config = HubConfig (config .admins )
5747
5848 __create_k8s_resources (deploy_config )
5949
6050 __create_deploy (deploy_config , hub_config )
6151 install_helm_chart (deploy_config , upgrade = False )
6252
63- wait_for_hub_to_get_ready (k8s_dir )
53+ wait_for_hub_to_get_ready (deploy_config . k8s_dir )
6454
65- return get_ip ( config . name , k8s_dir )
55+ return deploy_config
6656
6757
6858def upgrade (config : UpgradeConfig ):
0 commit comments