Loading edge_cloud_management_api/controllers/app_partner_orchestration.py +31 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,12 @@ def resolve_target_zone(srm_client, edge_cloud_zone_id, edge_cloud_provider, zon try: zones = get_local_zones() if isinstance(zones, list): matching_local_zones = [] for candidate_zone in zones: if not isinstance(candidate_zone, dict): continue if edge_cloud_provider and candidate_zone.get("edgeCloudProvider") == edge_cloud_provider: matching_local_zones.append(candidate_zone) if candidate_zone.get("edgeCloudZoneId") != edge_cloud_zone_id: continue if edge_cloud_provider and candidate_zone.get("edgeCloudProvider") != edge_cloud_provider: Loading @@ -25,6 +28,8 @@ def resolve_target_zone(srm_client, edge_cloud_zone_id, edge_cloud_provider, zon if candidate_zone.get("edgeCloudProvider") == edge_cloud_provider or not edge_cloud_provider: zone = candidate_zone break if not zone and edge_cloud_zone_id == "default" and len(matching_local_zones) == 1: zone = matching_local_zones[0] except Exception as exc: logger.info(f"Failed to refresh zones from SRM: {exc}") Loading Loading @@ -122,6 +127,10 @@ def deploy_to_partner( image_path = app_repo.get("imagePath") repo_type = app_repo.get("type", "PUBLICREPO") component_specs = app_data.get("componentSpec", []) network_interfaces = [] required_resources = app_data.get("requiredResources") or {} if component_specs and isinstance(component_specs, list): network_interfaces = component_specs[0].get("networkInterfaces", []) or [] app_component_specs = app_data.get("appComponentSpecs", []) if isinstance(app_component_specs, list) and app_component_specs: artefact_id = app_component_specs[0].get("artefactId") Loading Loading @@ -168,6 +177,9 @@ def deploy_to_partner( 64, app_id, ) package_type = (app_data.get("packageType") or "CONTAINER").upper() artefact_descriptor_type = "HELM" if package_type == "HELM" else "COMPONENTSPEC" repo_url, image_ref = split_image_reference(image_path) if not repo_url or not image_ref: return jsonify({ Loading Loading @@ -200,7 +212,7 @@ def deploy_to_partner( "artefactName": image_name, "artefactVersionInfo": image_tag, "artefactVirtType": "CONTAINER_TYPE", "artefactDescriptorType": "COMPONENTSPEC", "artefactDescriptorType": artefact_descriptor_type, "repoType": repo_type, "artefactRepoLocation": {"repoURL": repo_url}, "componentSpec": [{ Loading Loading @@ -301,6 +313,23 @@ def deploy_to_partner( "componentName": component_name, "serviceNameNB": service_name_nb, "serviceNameEW": service_name_ew, "exposedInterfaces": [ { "interfaceId": interface.get("interfaceId") or f"{component_name}_{index}", "commProtocol": interface.get("protocol", "TCP"), "commPort": interface.get("port"), "visibilityType": interface.get("visibilityType", "VISIBILITY_EXTERNAL"), } for index, interface in enumerate(network_interfaces) if interface.get("port") is not None ], "computeResourceProfile": { "cpuArchType": "ISA_X86_64", "numCPU": required_resources.get("numCPU") or "100m", "memory": required_resources.get("memory") or 128, "diskStorage": required_resources.get("storage"), "gpu": required_resources.get("gpu") or [], }, }], "appStatusCallbackLink": app_status_callback_link, "appDeploymentZones": app_deployment_zones, Loading Loading @@ -335,7 +364,7 @@ def deploy_to_partner( "appInstCallbackLink": app_data.get("appInstCallbackLink", ""), "zoneInfo": { "zoneId": zone.get("edgeCloudZoneId"), "flavourId": zone.get("flavourId", "default"), "flavourId": zone.get("flavourId") or zone.get("edgeCloudZoneId") or "default", "resPool": res_pool_value, "resourceConsumption": "RESERVED_RES_AVOID", }, Loading Loading
edge_cloud_management_api/controllers/app_partner_orchestration.py +31 −2 Original line number Diff line number Diff line Loading @@ -15,9 +15,12 @@ def resolve_target_zone(srm_client, edge_cloud_zone_id, edge_cloud_provider, zon try: zones = get_local_zones() if isinstance(zones, list): matching_local_zones = [] for candidate_zone in zones: if not isinstance(candidate_zone, dict): continue if edge_cloud_provider and candidate_zone.get("edgeCloudProvider") == edge_cloud_provider: matching_local_zones.append(candidate_zone) if candidate_zone.get("edgeCloudZoneId") != edge_cloud_zone_id: continue if edge_cloud_provider and candidate_zone.get("edgeCloudProvider") != edge_cloud_provider: Loading @@ -25,6 +28,8 @@ def resolve_target_zone(srm_client, edge_cloud_zone_id, edge_cloud_provider, zon if candidate_zone.get("edgeCloudProvider") == edge_cloud_provider or not edge_cloud_provider: zone = candidate_zone break if not zone and edge_cloud_zone_id == "default" and len(matching_local_zones) == 1: zone = matching_local_zones[0] except Exception as exc: logger.info(f"Failed to refresh zones from SRM: {exc}") Loading Loading @@ -122,6 +127,10 @@ def deploy_to_partner( image_path = app_repo.get("imagePath") repo_type = app_repo.get("type", "PUBLICREPO") component_specs = app_data.get("componentSpec", []) network_interfaces = [] required_resources = app_data.get("requiredResources") or {} if component_specs and isinstance(component_specs, list): network_interfaces = component_specs[0].get("networkInterfaces", []) or [] app_component_specs = app_data.get("appComponentSpecs", []) if isinstance(app_component_specs, list) and app_component_specs: artefact_id = app_component_specs[0].get("artefactId") Loading Loading @@ -168,6 +177,9 @@ def deploy_to_partner( 64, app_id, ) package_type = (app_data.get("packageType") or "CONTAINER").upper() artefact_descriptor_type = "HELM" if package_type == "HELM" else "COMPONENTSPEC" repo_url, image_ref = split_image_reference(image_path) if not repo_url or not image_ref: return jsonify({ Loading Loading @@ -200,7 +212,7 @@ def deploy_to_partner( "artefactName": image_name, "artefactVersionInfo": image_tag, "artefactVirtType": "CONTAINER_TYPE", "artefactDescriptorType": "COMPONENTSPEC", "artefactDescriptorType": artefact_descriptor_type, "repoType": repo_type, "artefactRepoLocation": {"repoURL": repo_url}, "componentSpec": [{ Loading Loading @@ -301,6 +313,23 @@ def deploy_to_partner( "componentName": component_name, "serviceNameNB": service_name_nb, "serviceNameEW": service_name_ew, "exposedInterfaces": [ { "interfaceId": interface.get("interfaceId") or f"{component_name}_{index}", "commProtocol": interface.get("protocol", "TCP"), "commPort": interface.get("port"), "visibilityType": interface.get("visibilityType", "VISIBILITY_EXTERNAL"), } for index, interface in enumerate(network_interfaces) if interface.get("port") is not None ], "computeResourceProfile": { "cpuArchType": "ISA_X86_64", "numCPU": required_resources.get("numCPU") or "100m", "memory": required_resources.get("memory") or 128, "diskStorage": required_resources.get("storage"), "gpu": required_resources.get("gpu") or [], }, }], "appStatusCallbackLink": app_status_callback_link, "appDeploymentZones": app_deployment_zones, Loading Loading @@ -335,7 +364,7 @@ def deploy_to_partner( "appInstCallbackLink": app_data.get("appInstCallbackLink", ""), "zoneInfo": { "zoneId": zone.get("edgeCloudZoneId"), "flavourId": zone.get("flavourId", "default"), "flavourId": zone.get("flavourId") or zone.get("edgeCloudZoneId") or "default", "resPool": res_pool_value, "resourceConsumption": "RESERVED_RES_AVOID", }, Loading