feat: KRW 가격 지원 및 GPU/G8/VPU 인스턴스 추가

## KRW 가격 기능
- pricing 테이블에 hourly_price_krw, monthly_price_krw 컬럼 추가
- 부가세 10% + 영업이익 10% + 환율 적용 (기본 1450원)
- 시간당: 1원 단위 반올림 (최소 1원)
- 월간: 100원 단위 반올림 (최소 100원)
- 환율/부가세/영업이익률 환경변수로 분리 (배포 없이 변경 가능)

## GPU/G8/VPU 인스턴스 지원
- gpu_instances, gpu_pricing 테이블 추가
- g8_instances, g8_pricing 테이블 추가
- vpu_instances, vpu_pricing 테이블 추가
- Linode/Vultr 커넥터에 GPU 동기화 로직 추가

## 환경변수 추가
- KRW_EXCHANGE_RATE: 환율 (기본 1450)
- KRW_VAT_RATE: 부가세율 (기본 1.1)
- KRW_MARKUP_RATE: 영업이익률 (기본 1.1)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
kappa
2026-01-22 18:57:51 +09:00
parent b1cb844c05
commit a2133ae5c9
20 changed files with 3517 additions and 690 deletions

View File

@@ -1,4 +1,4 @@
import type { Env, RegionInput, InstanceTypeInput, InstanceFamily } from '../types';
import type { Env, RegionInput, InstanceTypeInput, InstanceFamily, GpuInstanceInput } from '../types';
import { VaultClient, VaultError } from './vault';
import { RateLimiter } from './base';
import { createLogger } from '../utils/logger';
@@ -210,6 +210,42 @@ export class VultrConnector {
};
}
/**
* Normalize Vultr GPU plan data for database storage
*
* @param raw - Raw Vultr plan data for GPU instance (vcg type)
* @param providerId - Database provider ID
* @returns Normalized GPU instance data ready for insertion
*/
normalizeGpuInstance(raw: VultrPlan, providerId: number): GpuInstanceInput {
const hourlyPrice = raw.monthly_cost / 730;
// Extract GPU type from vcg prefix
// vcg-* instances are NVIDIA-based GPU instances
const gpuType = 'NVIDIA';
return {
provider_id: providerId,
instance_id: raw.id,
instance_name: raw.id,
vcpu: raw.vcpu_count,
memory_mb: raw.ram,
storage_gb: raw.disk,
transfer_tb: raw.bandwidth / 1000,
network_speed_gbps: null,
gpu_count: 1, // Vultr vcg instances have 1 GPU
gpu_type: gpuType,
gpu_memory_gb: null, // Vultr doesn't expose GPU memory in plans API
metadata: JSON.stringify({
type: raw.type,
disk_count: raw.disk_count,
locations: raw.locations,
hourly_price: hourlyPrice,
monthly_price: raw.monthly_cost,
}),
};
}
/**
* Map Vultr instance type to standard instance family
*