feat(deploy): 合并宁波单节点生产拓扑
This commit is contained in:
@@ -24,16 +24,14 @@ load_cluster_env() {
|
||||
cluster_ssh_key=${AI_GATEWAY_CLUSTER_SSH_KEY:-$cluster_ssh_key}
|
||||
|
||||
: "${AI_GATEWAY_DEPLOY_HOST:?}"
|
||||
: "${AI_GATEWAY_DEPLOY_HOST_2:?}"
|
||||
: "${AI_GATEWAY_DEPLOY_HOST_3:?}"
|
||||
: "${ALI_KEY:?}"
|
||||
: "${ALI_SECRET:?}"
|
||||
: "${ALI_REGION:?}"
|
||||
: "${ALI_BUCKET:?}"
|
||||
|
||||
CLUSTER_NINGBO_HOST=${AI_GATEWAY_NINGBO_HOST:-$AI_GATEWAY_DEPLOY_HOST}
|
||||
CLUSTER_LOS_ANGELES_HOST=${AI_GATEWAY_LOS_ANGELES_HOST:-$AI_GATEWAY_DEPLOY_HOST_2}
|
||||
CLUSTER_HONGKONG_HOST=${AI_GATEWAY_HONGKONG_HOST:-$AI_GATEWAY_DEPLOY_HOST_3}
|
||||
CLUSTER_LOS_ANGELES_HOST=${AI_GATEWAY_LOS_ANGELES_HOST:-${AI_GATEWAY_DEPLOY_HOST_2:-}}
|
||||
CLUSTER_HONGKONG_HOST=${AI_GATEWAY_HONGKONG_HOST:-${AI_GATEWAY_DEPLOY_HOST_3:-}}
|
||||
CLUSTER_WORKER_NODE_4_HOST=${AI_GATEWAY_WORKER_NODE_4_HOST:-}
|
||||
CLUSTER_WORKER_NODE_4_NAME=${AI_GATEWAY_WORKER_NODE_4_NAME:-}
|
||||
CLUSTER_WORKER_NODE_4_SITE=${AI_GATEWAY_WORKER_NODE_4_SITE:-}
|
||||
@@ -46,6 +44,7 @@ load_cluster_env() {
|
||||
export CLUSTER_WORKER_NODE_4_ENABLED
|
||||
|
||||
for host in "$CLUSTER_NINGBO_HOST" "$CLUSTER_HONGKONG_HOST" "$CLUSTER_LOS_ANGELES_HOST"; do
|
||||
[[ -n $host ]] || continue
|
||||
[[ $host =~ ^root@[A-Za-z0-9.-]+$ ]] || {
|
||||
echo "cluster hosts must use root@host syntax" >&2
|
||||
return 1
|
||||
|
||||
@@ -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" \
|
||||
|
||||
Reference in New Issue
Block a user