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

Move gce reserved to interface #4511

Merged
merged 1 commit into from
Dec 10, 2021

Conversation

yaroslava-serdiuk
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 9, 2021
@yaroslava-serdiuk yaroslava-serdiuk force-pushed the templates branch 3 times, most recently from cb1d88d to 3195d87 Compare December 9, 2021 13:36
cluster-autoscaler/cloudprovider/gce/reserved.go Outdated Show resolved Hide resolved
"strconv"
"strings"
// Reserved calculates the OS reserved values.
type Reserved interface {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer a more descriptive name. Maybe 'NodeReservedCalculator'? Or 'ReservedResoucesCalculator'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to OsReservedCalculator

// Reserved calculates the OS reserved values.
type Reserved interface {
// CalculateKernelReserved computes how much memory Linux kernel will reserve.
CalculateKernelReserved(physicalMemory int64, os OperatingSystem, osDistribution OperatingSystemDistribution, nodeVersion string) int64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current implementation doesn't use the nodeVersion parameter and the code calling it passes empty string. Should the interface (via docstring) specify some expectations here? Ex. by explicitly saying nodeVersion is optional and clarifying the expected behavior if not specified?

Copy link
Contributor Author

@yaroslava-serdiuk yaroslava-serdiuk Dec 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment that it is optional.

Ex. by explicitly saying nodeVersion is optional and clarifying the expected behavior if not specified?
behavior depends on implementation, so not sure what to say.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 10, 2021
// OsReservedCalculator calculates the OS reserved values.
type OsReservedCalculator interface {
// CalculateKernelReserved computes how much memory OS kernel will reserve.
// NodeVersion parameter may be optional if it is not used in calculation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a user of the interface I don't know if the field is used in calculation or not. What I had in mind was along the lines of 'NodeVersion parameter is optional. If left empty a result calculated using default node version will be returned', ie. setting requirements for how any implementation is expected to handle empty value.

@MaciekPytel
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 10, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MaciekPytel, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 10, 2021
@k8s-ci-robot k8s-ci-robot merged commit a18b3fe into kubernetes:master Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants