From 12bd7b295f214bc3955d0801fd150eac3cdc6526 Mon Sep 17 00:00:00 2001 From: Drew Malin Date: Fri, 5 Sep 2025 16:00:26 -0700 Subject: [PATCH 1/3] fall back to shadeform when cloud is excesssupply --- v1/providers/shadeform/instancetype.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/v1/providers/shadeform/instancetype.go b/v1/providers/shadeform/instancetype.go index 0f17856d..fa5317d7 100644 --- a/v1/providers/shadeform/instancetype.go +++ b/v1/providers/shadeform/instancetype.go @@ -18,6 +18,7 @@ import ( const ( UsdCurrentCode = "USD" AllRegions = "all" + excessSupply = "excesssupply" ) // TODO: We need to apply a filter to specifically limit the integration and api to selected clouds and shade instance types @@ -176,6 +177,7 @@ func (c *ShadeformClient) convertShadeformInstanceTypeToV1InstanceType(shadeform gpuName := shadeformGPUTypeToBrevGPUName(shadeformInstanceType.Configuration.GpuType) gpuManufacturer := v1.GetManufacturer(shadeformInstanceType.Configuration.GpuManufacturer) + cloud := shadeformCloud(shadeformInstanceType.Cloud) for _, region := range shadeformInstanceType.Availability { instanceTypes = append(instanceTypes, v1.InstanceType{ @@ -205,7 +207,7 @@ func (c *ShadeformClient) convertShadeformInstanceTypeToV1InstanceType(shadeform IsAvailable: region.Available, Location: region.Region, Provider: CloudProviderID, - Cloud: string(shadeformInstanceType.Cloud), + Cloud: cloud, }) } @@ -230,3 +232,16 @@ func shadeformGPUTypeToBrevGPUName(gpuType string) string { gpuType = strings.Split(gpuType, "_")[0] return gpuType } + +func shadeformCloud(cloud openapi.Cloud) string { + shadeformCloud := string(cloud) + + // Shadeform will return the cloud as "excesssupply" if the instance type is retrieved + // from cloud partners and not a direct cloud provider. In this case, we should just return + // the Shadeform Cloud Provider ID. + if strings.EqualFold(shadeformCloud, excessSupply) { + return CloudProviderID + } + + return shadeformCloud +} From 34e1b61ec588b8ed6cf1f5edae73be9e649bb175 Mon Sep 17 00:00:00 2001 From: Drew Malin Date: Fri, 5 Sep 2025 16:38:36 -0700 Subject: [PATCH 2/3] use const --- v1/providers/shadeform/instancetype.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/v1/providers/shadeform/instancetype.go b/v1/providers/shadeform/instancetype.go index fa5317d7..69b9e934 100644 --- a/v1/providers/shadeform/instancetype.go +++ b/v1/providers/shadeform/instancetype.go @@ -18,7 +18,6 @@ import ( const ( UsdCurrentCode = "USD" AllRegions = "all" - excessSupply = "excesssupply" ) // TODO: We need to apply a filter to specifically limit the integration and api to selected clouds and shade instance types @@ -239,7 +238,7 @@ func shadeformCloud(cloud openapi.Cloud) string { // Shadeform will return the cloud as "excesssupply" if the instance type is retrieved // from cloud partners and not a direct cloud provider. In this case, we should just return // the Shadeform Cloud Provider ID. - if strings.EqualFold(shadeformCloud, excessSupply) { + if strings.EqualFold(shadeformCloud, string(openapi.EXCESSSUPPLY)) { return CloudProviderID } From 89a385284b284c10395ded99c917edde15fa2a43 Mon Sep 17 00:00:00 2001 From: Drew Malin Date: Fri, 5 Sep 2025 16:44:16 -0700 Subject: [PATCH 3/3] use types --- v1/providers/shadeform/instancetype.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/v1/providers/shadeform/instancetype.go b/v1/providers/shadeform/instancetype.go index 69b9e934..562d0f72 100644 --- a/v1/providers/shadeform/instancetype.go +++ b/v1/providers/shadeform/instancetype.go @@ -233,14 +233,12 @@ func shadeformGPUTypeToBrevGPUName(gpuType string) string { } func shadeformCloud(cloud openapi.Cloud) string { - shadeformCloud := string(cloud) - // Shadeform will return the cloud as "excesssupply" if the instance type is retrieved // from cloud partners and not a direct cloud provider. In this case, we should just return // the Shadeform Cloud Provider ID. - if strings.EqualFold(shadeformCloud, string(openapi.EXCESSSUPPLY)) { + if cloud == openapi.EXCESSSUPPLY { return CloudProviderID } - return shadeformCloud + return string(cloud) }