feat(deploy): 切换宁波单节点生产拓扑

移除已停用的香港 API、Web、Worker 和边缘 Service 渲染结果,将 Worker 与容量控制器固定到宁波单实例,并在发布成功后清理旧香港资源。\n\n容量控制器忽略最大副本为零的站点,集群环境允许不再声明香港主机;单节点 production acceptance 不再依赖香港 Service、Deployment 或 SSH 回退。\n\n验证:Go 全量测试与 go vet;迁移安全检查;Kustomize 单节点渲染;ShellCheck;cluster release、production acceptance 和 manual release 测试。
This commit is contained in:
2026-08-03 09:59:34 +08:00
parent 5e9a7888ae
commit 4ff85d96e0
12 changed files with 156 additions and 125 deletions
+17 -13
View File
@@ -705,17 +705,22 @@ admin_request() {
-o 'jsonpath={.spec.clusterIP}')
service_port=$(remote_kubectl get service api-ningbo-edge -n "$namespace" \
-o 'jsonpath={.spec.ports[0].port}')
fallback_service_ip=$(remote_kubectl get service api-hongkong-edge -n "$namespace" \
-o 'jsonpath={.spec.clusterIP}')
fallback_service_port=$(remote_kubectl get service api-hongkong-edge -n "$namespace" \
-o 'jsonpath={.spec.ports[0].port}')
[[ $service_ip =~ ^[0-9.]+$ && $service_port =~ ^[0-9]+$ &&
$fallback_service_ip =~ ^[0-9.]+$ && $fallback_service_port =~ ^[0-9]+$ ]] || {
[[ $service_ip =~ ^[0-9.]+$ && $service_port =~ ^[0-9]+$ ]] || {
echo 'acceptance admin Service has an invalid cluster address' >&2
return 1
}
acceptance_admin_base=http://$service_ip:$service_port
acceptance_admin_fallback_base=http://$fallback_service_ip:$fallback_service_port
if [[ ${single_node_acceptance:-false} != true ]]; then
fallback_service_ip=$(remote_kubectl get service api-hongkong-edge -n "$namespace" \
-o 'jsonpath={.spec.clusterIP}')
fallback_service_port=$(remote_kubectl get service api-hongkong-edge -n "$namespace" \
-o 'jsonpath={.spec.ports[0].port}')
[[ $fallback_service_ip =~ ^[0-9.]+$ && $fallback_service_port =~ ^[0-9]+$ ]] || {
echo 'acceptance fallback admin Service has an invalid cluster address' >&2
return 1
}
acceptance_admin_fallback_base=http://$fallback_service_ip:$fallback_service_port
fi
fi
token_encoded=$(printf '%s' "$AI_GATEWAY_ACCEPTANCE_ADMIN_TOKEN" |
openssl base64 -A)
@@ -748,6 +753,10 @@ fi
echo "acceptance control API transport failed without safe retry: method=$method path=$path" >&2
return 1
fi
if [[ ${single_node_acceptance:-false} == true ]]; then
echo "acceptance control API transport failed on Ningbo: method=$method path=$path" >&2
return 1
fi
printf -v remote_command 'bash -c %q -- %q %q %q %q %q %q' \
"$remote_script" "$acceptance_admin_fallback_base" "$method" "$path" \
"$token_encoded" "$body_encoded" "$has_body"
@@ -794,15 +803,13 @@ verify_release_cas() {
echo "production release CAS mismatch: expected=$release_sha current=$current_sha" >&2
return 1
}
for deployment in easyai-api-ningbo easyai-api-hongkong easyai-worker-ningbo easyai-worker-hongkong; do
for deployment in easyai-api-ningbo easyai-worker-ningbo; do
[[ $(remote_kubectl get deployment "$deployment" -n "$namespace" \
-o 'jsonpath={.spec.template.spec.containers[0].image}') == "$api_image" ]]
done
[[ $verify_capacity == true ]] || return 0
[[ $(remote_kubectl get deployment easyai-worker-ningbo -n "$namespace" \
-o 'jsonpath={.spec.replicas}') == "$AI_GATEWAY_ACCEPTANCE_BASE_REPLICAS_NINGBO" ]]
[[ $(remote_kubectl get deployment easyai-worker-hongkong -n "$namespace" \
-o 'jsonpath={.spec.replicas}') == "$AI_GATEWAY_ACCEPTANCE_BASE_REPLICAS_HONGKONG" ]]
if [[ $CLUSTER_WORKER_NODE_4_ENABLED == true ]]; then
local expected_replicas eligible_nodes eligible_count pod_report
local running_count invalid_count node4_count used_nodes
@@ -943,9 +950,7 @@ snapshot_pre_acceptance_capacity() {
local output=$report_root/pre-acceptance-capacity.json
remote_kubectl get \
deployment/easyai-api-ningbo \
deployment/easyai-api-hongkong \
deployment/easyai-worker-ningbo \
deployment/easyai-worker-hongkong \
deployment/easyai-capacity-controller \
configmap/easyai-ai-gateway-config \
configmap/easyai-gateway-release \
@@ -3466,7 +3471,6 @@ apply_single_node_capacity() {
}}')
remote_kubectl label node easyai-ningbo easyai.io/worker=true --overwrite >/dev/null
remote_kubectl scale deployment/easyai-capacity-controller -n "$namespace" --replicas=0 >/dev/null
remote_kubectl scale deployment/easyai-worker-hongkong -n "$namespace" --replicas=0 >/dev/null
remote_kubectl patch configmap easyai-ai-gateway-config -n "$namespace" \
--type=merge -p "$config_patch" >/dev/null
remote_kubectl set env deployment/easyai-worker-ningbo -n "$namespace" \