Skip to content

Commit

Permalink
Merge pull request #5233 from yaroslava-serdiuk/boot-disk
Browse files Browse the repository at this point in the history
Remove units for default boot disk size
  • Loading branch information
k8s-ci-robot authored Oct 4, 2022
2 parents 7db0d94 + e75a769 commit 078a6e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
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

0 comments on commit 078a6e0

Please sign in to comment.