fix: 添加 Spot 抢占式实例注解和环境变量注入

- 添加 eci-spot-instance 注解启用抢占式实例
- 从 .env 读取 ANTHROPIC_BASE_URL 并注入容器环境变量

Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
D8D Developer
2026-03-20 12:08:01 +00:00
parent 77965b2c9f
commit ce0b822b63
2 changed files with 10 additions and 0 deletions

View File

@@ -146,12 +146,18 @@ async function main() {
console.log(` 端口: ${options.port}`);
console.log(` EIP 带宽: ${options.eipBandwidth} Mbps`);
// 构建环境变量 - 从当前 .env 读取关键配置注入容器
const containerEnv: Record<string, string> = {
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || 'https://api.anthropic.com',
};
const result = await deployProxy({
name,
image,
replicas: options.replicas,
port: options.port,
eipBandwidth: options.eipBandwidth,
env: containerEnv,
});
if (result.success) {

View File

@@ -91,6 +91,8 @@ export async function deployProxy(params: DeployProxyParams): Promise<DeployProx
annotations: {
// ECI 实例规格
'k8s.aliyun.com/eci-use-specs': instanceType,
// 抢占式实例
'k8s.aliyun.com/eci-spot-instance': 'true',
// 自动创建 EIP
...(autoEip && {
'k8s.aliyun.com/eci-open-enable-eip': 'true',
@@ -116,6 +118,8 @@ export async function deployProxy(params: DeployProxyParams): Promise<DeployProx
annotations: {
// ECI 实例规格
'k8s.aliyun.com/eci-use-specs': instanceType,
// 抢占式实例
'k8s.aliyun.com/eci-spot-instance': 'true',
// 自动创建 EIP
...(autoEip && {
'k8s.aliyun.com/eci-open-enable-eip': 'true',