refactor: 移除独立 hub/proxy/executor/gateway crate,统一为 gateway tunnel 架构

- 删除 aether-hub、aether-proxy 独立项目及其 Dockerfile/配置
- 删除 crates/aether-executor 和 crates/aether-gateway 全部模块
- 新增 apps/ 目录作为应用入口
- 将 hub 概念重构为 gateway tunnel transport
- 将 executor 重构为 execution runtime
- 新增 tunnel.rs 合约定义和 testkit tunnel/execution_runtime 模块
- 更新 Python 服务层和测试适配新架构命名
This commit is contained in:
fawney19
2026-04-03 14:59:58 +08:00
parent ddf18fed9a
commit 8f26e1a31f
983 changed files with 103097 additions and 105836 deletions
+136
View File
@@ -0,0 +1,136 @@
use axum::extract::State;
use axum::response::IntoResponse;
use axum::routing::get;
use axum::Json;
use axum::Router;
use serde_json::json;
use crate::gateway::constants::{
FRONTDOOR_COMPAT_ROUTE_PATTERNS, FRONTDOOR_MANIFEST_PATH, FRONTDOOR_MANIFEST_VERSION,
FRONTDOOR_REPLACEABLE_MIDDLEWARE_GROUPS, FRONTDOOR_REPLACEABLE_ROUTE_GROUPS,
INTERNAL_FRONTDOOR_MANIFEST_PATH, LEGACY_GATEWAY_BRIDGE_PATH_PREFIXES,
LEGACY_GATEWAY_BRIDGE_ROUTE_GROUPS, LEGACY_INTERNAL_GATEWAY_PHASEOUT_STATUS,
LEGACY_INTERNAL_GATEWAY_SUNSET_DATE, LEGACY_INTERNAL_GATEWAY_SUNSET_HTTP_DATE,
PYTHON_ONLY_MIDDLEWARE_GROUPS, PYTHON_ONLY_ROUTE_GROUPS, PYTHON_ONLY_RUNTIME_COMPONENTS,
READYZ_PATH, RUST_FRONTDOOR_OWNED_ROUTE_PATTERNS,
};
use crate::gateway::AppState;
pub(crate) fn mount_core_routes(router: Router<AppState>) -> Router<AppState> {
router
.route(FRONTDOOR_MANIFEST_PATH, get(frontdoor_manifest))
.route(INTERNAL_FRONTDOOR_MANIFEST_PATH, get(frontdoor_manifest))
.route(READYZ_PATH, get(readyz))
.route("/_gateway/health", get(health))
}
pub(crate) async fn health(State(state): State<AppState>) -> impl IntoResponse {
let request_concurrency = state.request_concurrency_snapshot().map(|snapshot| {
json!({
"limit": snapshot.limit,
"in_flight": snapshot.in_flight,
"available_permits": snapshot.available_permits,
"high_watermark": snapshot.high_watermark,
"rejected": snapshot.rejected,
})
});
let distributed_request_concurrency = state
.distributed_request_concurrency_snapshot()
.await
.ok()
.flatten()
.map(|snapshot| {
json!({
"limit": snapshot.limit,
"in_flight": snapshot.in_flight,
"available_permits": snapshot.available_permits,
"high_watermark": snapshot.high_watermark,
"rejected": snapshot.rejected,
})
});
Json(json!({
"status": "ok",
"component": "aether-gateway",
"control_api_enabled": true,
"request_concurrency": request_concurrency,
"distributed_request_concurrency": distributed_request_concurrency,
}))
}
pub(crate) async fn readyz(State(_state): State<AppState>) -> impl IntoResponse {
Json(json!({
"status": "ready",
"component": "aether-gateway",
"manifest_version": FRONTDOOR_MANIFEST_VERSION,
"manifest_path": FRONTDOOR_MANIFEST_PATH,
"warmup_status": "disabled",
"gate_readiness": false,
}))
}
pub(crate) async fn frontdoor_manifest(State(state): State<AppState>) -> impl IntoResponse {
let frontdoor_cors = state.frontdoor_cors();
let cors_enabled = frontdoor_cors.is_some();
let cors_allow_credentials = frontdoor_cors
.as_ref()
.map(|config| config.allow_credentials())
.unwrap_or(false);
let cors_allowed_origins = frontdoor_cors
.as_ref()
.map(|config| config.allowed_origins().to_vec())
.unwrap_or_default();
Json(json!({
"component": "aether-gateway",
"manifest_version": FRONTDOOR_MANIFEST_VERSION,
"version": env!("CARGO_PKG_VERSION"),
"mode": "compatibility_frontdoor",
"entrypoints": {
"public_manifest": FRONTDOOR_MANIFEST_PATH,
"operational_manifest": INTERNAL_FRONTDOOR_MANIFEST_PATH,
"readiness": READYZ_PATH,
"health": "/_gateway/health",
"metrics": "/_gateway/metrics",
},
"rust_frontdoor": {
"owned_route_patterns": RUST_FRONTDOOR_OWNED_ROUTE_PATTERNS,
"capabilities": {
"public_proxy_catch_all": true,
"admin_proxy_passthrough": true,
"internal_proxy_passthrough": true,
"trace_id_injection": true,
"compatibility_proxy": true,
},
},
"python_host_boundary": {
"replaceable_shell": {
"route_groups": FRONTDOOR_REPLACEABLE_ROUTE_GROUPS,
"middleware_groups": FRONTDOOR_REPLACEABLE_MIDDLEWARE_GROUPS,
"route_patterns": FRONTDOOR_COMPAT_ROUTE_PATTERNS,
"status": "should_move_to_rust_frontdoor",
},
"python_only": {
"route_groups": PYTHON_ONLY_ROUTE_GROUPS,
"middleware_groups": PYTHON_ONLY_MIDDLEWARE_GROUPS,
"runtime_components": PYTHON_ONLY_RUNTIME_COMPONENTS,
"status": "remain_on_python_host",
},
"legacy_bridge": {
"route_groups": LEGACY_GATEWAY_BRIDGE_ROUTE_GROUPS,
"path_prefixes": LEGACY_GATEWAY_BRIDGE_PATH_PREFIXES,
"status": LEGACY_INTERNAL_GATEWAY_PHASEOUT_STATUS,
"sunset_date": LEGACY_INTERNAL_GATEWAY_SUNSET_DATE,
"sunset_http_date": LEGACY_INTERNAL_GATEWAY_SUNSET_HTTP_DATE,
"replacement": "public_proxy_or_local_rust_control_plane",
},
},
"features": {
"control_api_configured": true,
"execution_runtime_configured": state.execution_runtime_configured(),
"request_concurrency_enabled": state.request_concurrency_snapshot().is_some(),
"distributed_request_concurrency_enabled": state.distributed_request_gate.is_some(),
"frontdoor_cors_enabled": cors_enabled,
"frontdoor_cors_allow_credentials": cors_allow_credentials,
"frontdoor_cors_allowed_origins": cors_allowed_origins,
},
}))
}