Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove units for default boot disk size #5233

Merged
merged 1 commit into from
Oct 4, 2022
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
8 changes: 4 additions & 4 deletions cluster-autoscaler/cloudprovider/gce/gce_price_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const (
bootDiskTypeLabel = "cloud.google.com/gke-boot-disk"
)

// DefaultBootDiskSize is 100 GB.
const DefaultBootDiskSize = 100 * units.GB
// DefaultBootDiskSizeGB is 100 GB.
const DefaultBootDiskSizeGB = 100

// NodePrice returns a price of running the given node for a given period of time.
// All prices are in USD.
Expand Down Expand Up @@ -95,8 +95,8 @@ func (model *GcePriceModel) NodePrice(node *apiv1.Node, startTime time.Time, end
// Boot disk price
bootDiskSize, _ := strconv.ParseInt(node.Annotations[BootDiskSizeAnnotation], 10, 64)
if bootDiskSize == 0 {
klog.Errorf("Boot disk size is not found for node %s, using default size %v", node.Name, DefaultBootDiskSize)
bootDiskSize = DefaultBootDiskSize
klog.Errorf("Boot disk size is not found for node %s, using default size %v", node.Name, DefaultBootDiskSizeGB)
bootDiskSize = DefaultBootDiskSizeGB
}
bootDiskType := node.Annotations[BootDiskTypeAnnotation]
if val, ok := node.Labels[bootDiskTypeLabel]; ok {
Expand Down
6 changes: 6 additions & 0 deletions cluster-autoscaler/cloudprovider/gce/gce_price_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ func TestGetNodePrice(t *testing.T) {
priceComparisonCoefficient: 1,
expanderSupport: true,
},
"node with default boot disk is cheaper that node with more expensive boot disk type": {
cheaperNode: testNode(t, "cheapNode", "", 8000, 30*units.GiB, "", 0, false, false),
expensiveNode: testNodeEphemeralStorage(t, "expensiveNode", false, 0, "pd-ssd", 100, false),
priceComparisonCoefficient: 1,
expanderSupport: true,
},
}

for tn, tc := range cases {
Expand Down