-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add ephemeral storage pricing to GCE expander #4911
Add ephemeral storage pricing to GCE expander #4911
Conversation
9b0f889
to
42ad8d9
Compare
42ad8d9
to
f2408eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced passing all this information through annotations is the way to go. I think this may be problematic if there are annotations provided on actual nodes, perhaps partially missing, leading to incorrect scaling decisions. An alternative would be to just allow GcePriceModel to extract information from instance templates directly. WDYT?
cluster-autoscaler/processors/nodeinfosprovider/gce_node_info_provider.go
Outdated
Show resolved
Hide resolved
|
||
localSsdCount, err := getLocalSsdCount(template.Properties) | ||
ephemeralStorageLocalSsdCount := ephemeralStorageLocalSSDCount(kubeEnvValue) | ||
if err == nil && ephemeralStorageLocalSsdCount > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be inside else
branch, which guaranteed ephemeralStorage is only calculated once. Now it may be calculated twice. Why refactor it that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I actually need to add annotations for boot disk and local ssd (which I added in following commits) and I add annotation after parsing info getBootDiskEphemeralStorageFromInstanceTemplateProperties() function . In the original order information about boot disk is not parsed from kube-env if ephemeral storage is backed up with local ssd.
ephemeralStorage, err = getLocalSSDEphemeralStorageFromInstanceTemplateProperties(template.Properties, ssdCount) | ||
} else if !isBootDiskEphemeralStorageWithInstanceTemplateDisabled(kubeEnvValue) { | ||
|
||
if !isBootDiskEphemeralStorageWithInstanceTemplateDisabled(kubeEnvValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of the double negation here? if isBootDiskEphemeralStorageWithInstanceTemplateEnabled(kubeEnvValue)
would be a bit easier to read. Alternatively, just rename the function to isLocalSSDEphemeralStorageWithInstanceTemplateEnabled
, which is what this function is actually checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but there is a reason why it is named this way. By default ephemeral storage is backed up by boot disk and in other cases we disable this option, so here we're checking "BLOCK_EPH_STORAGE_BOOT_DISK" variable in kube-env. I think from this perspective the name is fine.
To extract information from instance templates directly we need to extend GcePriceModel struct to include GceManager or a part of GceManager. |
f2408eb
to
ccf3822
Compare
c55da9d
to
f5d6734
Compare
cluster-autoscaler/processors/nodeinfosprovider/gce_node_info_provider.go
Outdated
Show resolved
Hide resolved
@@ -159,6 +197,12 @@ func (model *GcePriceModel) getBasePrice(resources apiv1.ResourceList, instanceT | |||
} | |||
price += float64(mem.Value()) / float64(units.GiB) * memPrice * hours | |||
|
|||
if model.EphemeralStorageSupport { | |||
ephemeralStorage := resources[apiv1.ResourceEphemeralStorage] | |||
ephemeralStoragePrice := model.PriceInfo.LocalSsdPricePerHour() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment here that this is a simplification to use local ssd price even if ephemeral storage is not backed by local ssd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually changed the price to the price for pd-standard since it's cheaper.
13cfdb0
to
8d6cd12
Compare
8d6cd12
to
470760c
Compare
LGTM, just one minor comment. |
9819ebb
to
cd611ca
Compare
/lgtm |
explicitlyConfigured map[GceRef]bool | ||
migAutoDiscoverySpecs []migAutoDiscoveryConfig | ||
reserved *GceReserved | ||
expanderEphemeralStorageSupport bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is actually used anywhere, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, thanks for finding this!
cluster-autoscaler/cloudprovider/gce/gce_cloud_provider_test.go
Outdated
Show resolved
Hide resolved
cd611ca
to
1cbcfbc
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: towca, yaroslava-serdiuk The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…toragae Add ephemeral storage pricing to GCE expander
Which component this PR applies to?
cluster-autoscaler
What type of PR is this?
/kind feature
What this PR does / why we need it:
Improve scale-up decisions