|
| 1 | +// Machine families to show in the machine type prompt (gaming-oriented) |
| 2 | +export const MACHINE_TYPE_FAMILIES_GAMING = ["n1", "g2"] as const; |
| 3 | + |
| 4 | +// User-facing descriptions for GCP machine type families |
| 5 | +export const MACHINE_TYPE_FAMILY_DESCRIPTIONS: Record<string, string> = { |
| 6 | + n1: 'N1: General purpose, good price/performance for most workloads (supports T4, P4, P100, V100 GPUs)', |
| 7 | + g2: 'G2: Newer generation, optimized for graphics and gaming (supports L4 GPU)', |
| 8 | + a2: 'A2: High performance, AI/ML workloads (supports A100 GPUs)', |
| 9 | + c3: 'C3: Compute-optimized, high CPU performance', |
| 10 | + c3d: 'C3D: Compute-optimized with local NVMe SSD', |
| 11 | + a3: 'A3: AI-optimized, very high performance', |
| 12 | + h3: 'H3: High memory, high performance', |
| 13 | +}; |
| 14 | + |
| 15 | +// GPU descriptions for acceleratorType prompt |
| 16 | +export const GPU_DESCRIPTIONS: Record<string, { label: string, type: string }> = { |
| 17 | + 'nvidia-tesla-t4': { label: 'NVIDIA T4 (great for cloud gaming, 16GB VRAM)', type: 'T4' }, |
| 18 | + 'nvidia-l4': { label: 'NVIDIA L4 (new generation, 24GB VRAM, very performant for streaming)', type: 'L4' }, |
| 19 | + 'nvidia-a10g': { label: 'NVIDIA A10G (high-end, 24GB VRAM, advanced AI and gaming)', type: 'A10G' }, |
| 20 | + 'nvidia-p4': { label: 'NVIDIA P4 (entry-level, 8GB VRAM, sufficient for light games)', type: 'P4' }, |
| 21 | + 'nvidia-p100': { label: 'NVIDIA P100 (16GB VRAM, compute and advanced gaming)', type: 'P100' }, |
| 22 | + 'nvidia-v100': { label: 'NVIDIA V100 (16/32GB VRAM, very performant, overkill for gaming)', type: 'V100' }, |
| 23 | + 'nvidia-a100-40gb': { label: 'NVIDIA A100 40GB (AI/ML, compute, gaming)', type: 'A100-40GB' }, |
| 24 | + 'nvidia-a100-80gb': { label: 'NVIDIA A100 80GB (AI/ML, compute, gaming)', type: 'A100-80GB' }, |
| 25 | +}; |
| 26 | + |
| 27 | +// Families eligible for TIER_1 (egress bandwidth) |
| 28 | +export const TIER1_FAMILIES = ["c3", "c3d", "a3", "h3"] as const; |
| 29 | + |
| 30 | +// GCP machine type family → compatible acceleratorTypes (GPUs) |
| 31 | +export const MACHINE_GPU_COMPAT: Record<string, string[]> = { |
| 32 | + n1: ['nvidia-tesla-t4'], |
| 33 | + g2: ['nvidia-l4'], |
| 34 | + a2: ['nvidia-a100-40gb', 'nvidia-a100-80gb'], |
| 35 | + // Add more families if needed |
| 36 | +}; |
| 37 | + |
| 38 | +// Named constants for better readability |
| 39 | +export const DISK_TYPE_STANDARD = 'pd-standard'; |
| 40 | +export const DISK_TYPE_BALANCED = 'pd-balanced'; |
| 41 | +export const DISK_TYPE_SSD = 'pd-ssd'; |
| 42 | + |
| 43 | +export const NETWORK_TIER_STANDARD = 'STANDARD'; |
| 44 | +export const NETWORK_TIER_PREMIUM = 'PREMIUM'; |
| 45 | + |
| 46 | +export const NIC_TYPE_AUTO = 'auto'; |
| 47 | +export const NIC_TYPE_GVNIC = 'GVNIC'; |
| 48 | +export const NIC_TYPE_VIRTIO_NET = 'VIRTIO_NET'; |
| 49 | + |
| 50 | +// Central GCP constants for allowed values |
| 51 | +export const DISK_TYPES: string[] = [ |
| 52 | + DISK_TYPE_STANDARD, |
| 53 | + DISK_TYPE_BALANCED, |
| 54 | + DISK_TYPE_SSD, |
| 55 | +] as const; |
| 56 | + |
| 57 | +export const NETWORK_TIERS: string[] = [ |
| 58 | + NETWORK_TIER_STANDARD, |
| 59 | + NETWORK_TIER_PREMIUM, |
| 60 | +] as const; |
| 61 | + |
| 62 | +export const NIC_TYPES: string[] = [ |
| 63 | + NIC_TYPE_AUTO, |
| 64 | + NIC_TYPE_GVNIC, |
| 65 | + NIC_TYPE_VIRTIO_NET, |
| 66 | +] as const; |
| 67 | + |
| 68 | +// Families eligible for TIER_1 (egress bandwidth) - using named constant |
| 69 | +export const TIER1_NIC = NIC_TYPE_GVNIC; |
| 70 | + |
| 71 | +export type DiskType = typeof DISK_TYPES[number]; |
| 72 | +export type NetworkTier = typeof NETWORK_TIERS[number]; |
| 73 | +export type NicType = typeof NIC_TYPES[number]; |
| 74 | + |
| 75 | +// Default values for prompts (explicit names) |
| 76 | +export const DEFAULT_DISK_TYPE = DISK_TYPE_BALANCED; |
| 77 | +export const DEFAULT_NETWORK_TIER = NETWORK_TIER_STANDARD; |
| 78 | +export const DEFAULT_NIC_TYPE = NIC_TYPE_AUTO; |
| 79 | + |
| 80 | +// User-facing descriptions for disk, network tier, and NIC types |
| 81 | +export const DISK_TYPE_DESCRIPTIONS: Record<string, string> = { |
| 82 | + [DISK_TYPE_STANDARD]: 'Standard (cheapest, slowest)', |
| 83 | + [DISK_TYPE_BALANCED]: 'Balanced (good compromise)', |
| 84 | + [DISK_TYPE_SSD]: 'SSD (best performance, highest cost)', |
| 85 | +}; |
| 86 | + |
| 87 | +export const NETWORK_TIER_DESCRIPTIONS: Record<string, string> = { |
| 88 | + [NETWORK_TIER_STANDARD]: 'Standard (higher latency, lower cost, includes 200 GiB/month free)', |
| 89 | + [NETWORK_TIER_PREMIUM]: 'Premium (lower latency, more expensive)', |
| 90 | +}; |
| 91 | + |
| 92 | +export const NIC_TYPE_DESCRIPTIONS: Record<string, string> = { |
| 93 | + [NIC_TYPE_AUTO]: 'Auto (let GCP choose, recommended)', |
| 94 | + [NIC_TYPE_GVNIC]: 'GVNIC (high throughput / low latency, supported on some VMs)', |
| 95 | + [NIC_TYPE_VIRTIO_NET]: 'Virtio Net (legacy, broad compatibility)', |
| 96 | +}; |
| 97 | + |
| 98 | +// Region prefix -> user-friendly label used in the continent/group prompt |
| 99 | +// Note: Prefixes are derived from region names (e.g. "europe-west4" -> "europe-"). |
| 100 | +// If a prefix is not known here, the UI will show "<UNKNOWN>". |
| 101 | +export const REGION_PREFIX_LABELS: Record<string, string> = { |
| 102 | + 'europe-': 'Europe', |
| 103 | + 'us-': 'United States / Canada', |
| 104 | + 'asia-': 'Asia / Pacific', |
| 105 | + 'southamerica-': 'South America', |
| 106 | + 'me-': 'Middle East', |
| 107 | + 'africa-': 'Africa', |
| 108 | + 'australia-': 'Australia', |
| 109 | + 'northamerica-': 'North America', |
| 110 | +}; |
| 111 | + |
| 112 | +// Region name -> Country/Location label for display in region selection. |
| 113 | +// Best-effort mapping based on public GCP region locations. Not exhaustive. |
| 114 | +// If a region is not listed here, we won't display a country label for it. |
| 115 | +export const REGION_COUNTRY_BY_REGION: Record<string, string> = { |
| 116 | + // Europe |
| 117 | + 'europe-west1': 'Belgium', |
| 118 | + 'europe-west2': 'London, United Kingdom', |
| 119 | + 'europe-west3': 'Frankfurt, Germany', |
| 120 | + 'europe-west4': 'Netherlands', |
| 121 | + 'europe-west6': 'Zurich, Switzerland', |
| 122 | + 'europe-west8': 'Milan, Italy', |
| 123 | + 'europe-west9': 'Paris, France', |
| 124 | + 'europe-west10': 'Berlin, Germany', |
| 125 | + 'europe-west12': 'Turin, Italy', |
| 126 | + 'europe-north1': 'Finland', |
| 127 | + 'europe-central2': 'Warsaw, Poland', |
| 128 | + |
| 129 | + // North America |
| 130 | + 'us-central1': 'Iowa, USA', |
| 131 | + 'us-east1': 'South Carolina, USA', |
| 132 | + 'us-east4': 'Northern Virginia, USA', |
| 133 | + 'us-west1': 'Oregon, USA', |
| 134 | + 'us-west2': 'Los Angeles, USA', |
| 135 | + 'us-west3': 'Salt Lake City, USA', |
| 136 | + 'us-west4': 'Las Vegas, USA', |
| 137 | + 'northamerica-northeast1': 'Montréal, Canada', |
| 138 | + 'northamerica-northeast2': 'Toronto, Canada', |
| 139 | + |
| 140 | + // Asia / Pacific |
| 141 | + 'asia-east1': 'Taiwan', |
| 142 | + 'asia-northeast1': 'Tokyo, Japan', |
| 143 | + 'asia-northeast2': 'Osaka, Japan', |
| 144 | + 'asia-northeast3': 'Seoul, South Korea', |
| 145 | + 'asia-southeast1': 'Singapore', |
| 146 | + 'asia-southeast2': 'Jakarta, Indonesia', |
| 147 | + 'asia-south1': 'Mumbai, India', |
| 148 | + 'asia-south2': 'Delhi, India', |
| 149 | + 'asia-east2': 'Hong Kong', |
| 150 | + |
| 151 | + // Australia |
| 152 | + 'australia-southeast1': 'Sydney, Australia', |
| 153 | + 'australia-southeast2': 'Melbourne, Australia', |
| 154 | + |
| 155 | + // South America |
| 156 | + 'southamerica-east1': 'São Paulo, Brazil', |
| 157 | + |
| 158 | + // Middle East |
| 159 | + 'me-west1': 'Tel Aviv, Israel', |
| 160 | + 'me-central1': 'Doha, Qatar', |
| 161 | + |
| 162 | + // Africa |
| 163 | + 'africa-south1': 'Johannesburg, South Africa', |
| 164 | +}; |
0 commit comments