Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions pkg/provider/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -749,16 +749,12 @@ func (p *Provider) ClassifyProvisionError(err error, accelerator, region string)
const awsAMIRootGiB = 30

// awsMaxDiskGiB is the most user space a Pod may ask for: gp3's 16 TiB volume cap less the OS
// base. Refused at launch and unpriced above it, so it never reaches rootVolume's int32.
// base. Refused at launch, so it never reaches rootVolume's int32.
const awsMaxDiskGiB = 16*1024 - awsAMIRootGiB

// PricePerHour overrides catalog.Base to add the root volume, which EBS bills by provisioned
// size apart from the instance. It prices the size sdkClient.rootVolume launches.
func (p *Provider) PricePerHour(req provider.PriceRequest) (float64, error) {
if req.DiskGiB > awsMaxDiskGiB {
return 0, fmt.Errorf("aws: %d GiB disk exceeds the %d GiB a root volume can add: %w",
req.DiskGiB, awsMaxDiskGiB, provider.ErrNoPrice)
}
rate, err := p.Base.PricePerHour(req)
if err != nil {
return 0, err
Expand Down
4 changes: 0 additions & 4 deletions pkg/provider/aws/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,6 @@ func TestPricePerHour_AddsRootVolume(t *testing.T) {
if !errors.Is(err, provider.ErrNoPrice) {
t.Fatalf("PricePerHour(unknown accelerator) err = %v, want ErrNoPrice", err)
}
req.DiskGiB = awsMaxDiskGiB + 1
if _, err = p.PricePerHour(req); !errors.Is(err, provider.ErrNoPrice) {
t.Fatalf("PricePerHour(above awsMaxDiskGiB) err = %v, want ErrNoPrice", err)
}
}

func TestProvision_SizesDiskFromEphemeralStorage(t *testing.T) {
Expand Down
7 changes: 1 addition & 6 deletions pkg/provider/modal/modal.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,8 @@ const modalFreeDiskGiB = 512
// would be read as free. A GPU sandbox in that state still prices, understating by those
// same defaults, which is immaterial beside the accelerator.
//
// Disk adds nothing up to modalFreeDiskGiB; above it is ErrNoPrice, since such a Pod is
// never launched (see sandboxSpecFromPod).
// Disk adds nothing: Pods asking for more than modalFreeDiskGiB are never launched.
func (p *Provider) PricePerHour(req provider.PriceRequest) (float64, error) {
if req.DiskGiB > modalFreeDiskGiB {
return 0, fmt.Errorf("modal: %d GiB disk exceeds the unbilled %d GiB: %w",
req.DiskGiB, modalFreeDiskGiB, provider.ErrNoPrice)
}
metered := data.ModalCPUCostPerHour(req.CPUCores) + data.ModalMemoryCostPerHour(req.MemoryMiB)

if req.AcceleratorType == "" {
Expand Down
4 changes: 0 additions & 4 deletions pkg/provider/modal/modal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2028,10 +2028,6 @@ func TestPricePerHour_NoPrice(t *testing.T) {
AcceleratorType: "TPU-v4", Count: 1,
CapacityType: nebulav1alpha1.CapacityOnDemand, CPUCores: 4, MemoryMiB: 8192,
},
"disk above the unbilled quota": {
AcceleratorType: "H100", Count: 1, CapacityType: nebulav1alpha1.CapacityOnDemand,
CPUCores: 4, MemoryMiB: 8192, DiskGiB: modalFreeDiskGiB + 1,
},
} {
t.Run(name, func(t *testing.T) {
got, err := p.PricePerHour(req)
Expand Down
Loading