Skip to content

Commit 9acd0c2

Browse files
committed
Ensure B200 support
1 parent ea686fa commit 9acd0c2

File tree

5 files changed

+730
-1
lines changed

5 files changed

+730
-1
lines changed

v1/providers/nebius/instance_test.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,16 @@ func TestExtractGPUTypeAndName(t *testing.T) {
237237
expectedType: "V100",
238238
expectedName: "V100", // Should be "V100", not "NVIDIA V100"
239239
},
240+
{
241+
platformName: "gpu-b200-sxm",
242+
expectedType: "B200",
243+
expectedName: "B200", // Should be "B200", not "NVIDIA B200"
244+
},
245+
{
246+
platformName: "b200-sxm", // Test B200 without "gpu-" prefix
247+
expectedType: "B200",
248+
expectedName: "B200",
249+
},
240250
{
241251
platformName: "unknown-platform",
242252
expectedType: "GPU",
@@ -260,6 +270,50 @@ func TestExtractGPUTypeAndName(t *testing.T) {
260270
}
261271
}
262272

273+
func TestIsPlatformSupported(t *testing.T) {
274+
client := createTestClient()
275+
276+
tests := []struct {
277+
platformName string
278+
shouldSupport bool
279+
description string
280+
}{
281+
// GPU platforms - all should be supported
282+
{"gpu-h100-sxm", true, "H100 with gpu prefix"},
283+
{"gpu-h200-sxm", true, "H200 with gpu prefix"},
284+
{"gpu-b200-sxm", true, "B200 with gpu prefix"},
285+
{"gpu-l40s", true, "L40S with gpu prefix"},
286+
{"gpu-a100-sxm4", true, "A100 with gpu prefix"},
287+
{"gpu-v100-sxm2", true, "V100 with gpu prefix"},
288+
{"gpu-a10", true, "A10 with gpu prefix"},
289+
{"gpu-t4", true, "T4 with gpu prefix"},
290+
{"gpu-l4", true, "L4 with gpu prefix"},
291+
292+
// GPU platforms without "gpu-" prefix (B200 specific test)
293+
{"b200-sxm", true, "B200 without gpu prefix"},
294+
{"b200", true, "B200 bare name"},
295+
{"h100-sxm", true, "H100 without gpu prefix"},
296+
{"l40s", true, "L40S without gpu prefix"},
297+
298+
// CPU platforms - only specific ones supported
299+
{"cpu-d3", true, "CPU D3 platform"},
300+
{"cpu-e2", true, "CPU E2 platform"},
301+
{"cpu-other", false, "Unsupported CPU platform"},
302+
303+
// Unsupported platforms
304+
{"unknown-platform", false, "Generic unknown platform"},
305+
{"random-gpu", false, "Random name with gpu"},
306+
}
307+
308+
for _, tt := range tests {
309+
t.Run(tt.description, func(t *testing.T) {
310+
result := client.isPlatformSupported(tt.platformName)
311+
assert.Equal(t, tt.shouldSupport, result,
312+
"Platform %s support should be %v: %s", tt.platformName, tt.shouldSupport, tt.description)
313+
})
314+
}
315+
}
316+
263317
// TestParseInstanceTypeFormat tests the instance type ID format parsing
264318
func TestParseInstanceTypeFormat(t *testing.T) {
265319
tests := []struct {

v1/providers/nebius/instancetype.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ func (c *NebiusClient) isPlatformSupported(platformName string) bool {
339339

340340
// For GPU platforms: accept any GPU platform (filtered by quota availability)
341341
// Look for common GPU indicators in platform names
342-
gpuIndicators := []string{"gpu", "h100", "h200", "l40s", "a100", "v100", "a10", "t4", "l4"}
342+
gpuIndicators := []string{"gpu", "h100", "h200", "l40s", "a100", "v100", "a10", "t4", "l4", "b200"}
343343
for _, indicator := range gpuIndicators {
344344
if strings.Contains(platformLower, indicator) {
345345
return true
@@ -446,6 +446,9 @@ func extractGPUTypeAndName(platformName string) (string, string) {
446446
if strings.Contains(platformLower, "v100") {
447447
return "V100", "V100"
448448
}
449+
if strings.Contains(platformLower, "b200") {
450+
return "B200", "B200"
451+
}
449452

450453
return "GPU", "GPU" // Generic fallback
451454
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# Nebius Provider Scripts
2+
3+
This directory contains utility scripts for testing and enumerating Nebius cloud resources. All scripts are implemented as Go test files with the `scripts` build tag.
4+
5+
## Prerequisites
6+
7+
Export your Nebius credentials as environment variables:
8+
9+
```bash
10+
export NEBIUS_SERVICE_ACCOUNT_JSON='/path/to/service-account.json'
11+
export NEBIUS_TENANT_ID='tenant-e00xxx'
12+
export NEBIUS_LOCATION='eu-north1' # Optional, defaults to eu-north1
13+
```
14+
15+
## Instance Type Enumeration
16+
17+
### Enumerate All Regions
18+
19+
Lists all instance types across all Nebius regions with GPU type breakdowns:
20+
21+
```bash
22+
cd v1/providers/nebius
23+
go test -tags scripts -v -run Test_EnumerateInstanceTypes ./scripts/
24+
```
25+
26+
**Output:**
27+
- Console summary with region-by-region GPU counts
28+
- JSON file: `instance_types_all_regions.json`
29+
30+
### Enumerate Single Region
31+
32+
Lists instance types for a specific region with detailed specifications:
33+
34+
```bash
35+
export NEBIUS_LOCATION='eu-north1'
36+
go test -tags scripts -v -run Test_EnumerateInstanceTypesSingleRegion ./scripts/
37+
```
38+
39+
**Output:**
40+
- Console summary categorized by CPU/GPU types
41+
- JSON file: `instance_types_eu-north1.json`
42+
43+
### GPU Types Only
44+
45+
Displays only GPU instance types in a formatted table:
46+
47+
```bash
48+
export NEBIUS_LOCATION='eu-north1'
49+
go test -tags scripts -v -run Test_EnumerateGPUTypes ./scripts/
50+
```
51+
52+
**Example Output:**
53+
```
54+
ID GPU Type Count vCPUs RAM (GB) VRAM/GPU (GB)
55+
------------------------------------------------------------------------------------------------------------------------
56+
nebius-eu-north1-l40s-1gpu-16vcpu-96gb L40S 1 16 96 48
57+
nebius-eu-north1-l40s-4gpu-128vcpu-768gb L40S 4 128 768 48
58+
nebius-eu-north1-h100-8gpu-128vcpu-1600gb H100 8 128 1600 80
59+
```
60+
61+
## Image Enumeration
62+
63+
### Enumerate Images (Single Region)
64+
65+
Lists all available images in a specific region:
66+
67+
```bash
68+
export NEBIUS_LOCATION='eu-north1'
69+
go test -tags scripts -v -run Test_EnumerateImages ./scripts/
70+
```
71+
72+
**Output:**
73+
- Console summary organized by OS
74+
- JSON file: `images_eu-north1.json`
75+
76+
### Enumerate Images (All Regions)
77+
78+
Lists images across all Nebius regions:
79+
80+
```bash
81+
go test -tags scripts -v -run Test_EnumerateImagesAllRegions ./scripts/
82+
```
83+
84+
**Output:**
85+
- Console summary with image counts per region
86+
- JSON file: `images_all_regions.json`
87+
88+
### Filter GPU-Optimized Images
89+
90+
Shows only images suitable for GPU instances (CUDA, ML, etc.):
91+
92+
```bash
93+
export NEBIUS_LOCATION='eu-north1'
94+
go test -tags scripts -v -run Test_FilterGPUImages ./scripts/
95+
```
96+
97+
## VPC and Kubernetes Scripts
98+
99+
### Create VPC
100+
101+
Creates a test VPC with public/private subnets:
102+
103+
```bash
104+
go test -tags scripts -v -run TestCreateVPC ./scripts/
105+
```
106+
107+
### Create Kubernetes Cluster
108+
109+
Creates a Kubernetes cluster with VPC:
110+
111+
```bash
112+
go test -tags scripts -v -run Test_CreateVPCAndCluster ./scripts/
113+
```
114+
115+
## Running All Scripts
116+
117+
To run all enumeration scripts at once:
118+
119+
```bash
120+
go test -tags scripts -v ./scripts/
121+
```
122+
123+
## Output Files
124+
125+
Scripts generate JSON files in the current directory:
126+
- `instance_types_all_regions.json` - All instance types across regions
127+
- `instance_types_<region>.json` - Instance types for specific region
128+
- `images_all_regions.json` - All images across regions
129+
- `images_<region>.json` - Images for specific region
130+
131+
## Tips
132+
133+
### Pretty Print JSON Output
134+
135+
```bash
136+
cat instance_types_eu-north1.json | jq '.'
137+
```
138+
139+
### Filter JSON Results
140+
141+
```bash
142+
# Show only L40S instance types
143+
cat instance_types_eu-north1.json | jq '.[] | select(.supported_gpus[0].type == "L40S")'
144+
145+
# Show instance types with pricing
146+
cat instance_types_eu-north1.json | jq '.[] | select(.price != null) | {id, price}'
147+
148+
# Count GPU types
149+
cat instance_types_all_regions.json | jq -r '.[].supported_gpus[0].type' | sort | uniq -c
150+
```
151+
152+
### Redirect Output to File
153+
154+
```bash
155+
go test -tags scripts -v -run Test_EnumerateGPUTypes ./scripts/ > gpu_types_output.txt 2>&1
156+
```
157+
158+
## Integration with Testing Guide
159+
160+
These scripts complement the integration tests documented in [`NEBIUS_TESTING_GUIDE.md`](../NEBIUS_TESTING_GUIDE.md). Use them for:
161+
- Discovery: Finding available instance types and regions
162+
- Validation: Verifying quota and availability
163+
- Development: Testing new features with real Nebius resources

0 commit comments

Comments
 (0)