-
Notifications
You must be signed in to change notification settings - Fork 7
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
Requested service resources adaptation #164
Requested service resources adaptation #164
Conversation
b76c7ea
to
4a25102
Compare
launcher/launcher.go
Outdated
func clampResource(value uint64, quota *uint64) uint64 { | ||
if quota != nil && value > *quota { | ||
return *quota | ||
} else { |
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.
Let's simple return value, without else branch
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.
fixed
launcher/launcher.go
Outdated
} | ||
|
||
if nodeRatios != nil && nodeRatios.Storage != nil { | ||
return float64(*nodeRatios.Storage) / 100 | ||
return |
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.
Is this return required?
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.
yes, "missing return " error have otherwise
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.
Don't use naked return.
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.
fixed
4a25102
to
605c025
Compare
605c025
to
3eae841
Compare
launcher/launcher.go
Outdated
} | ||
|
||
if nodeRatios != nil && nodeRatios.Storage != nil { | ||
return float64(*nodeRatios.Storage) / 100 | ||
return |
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.
Don't use naked return.
return float64(*serviceRatios.Storage) / 100 | ||
func getReqDiskSize(serviceConfig aostypes.ServiceConfig, nodeRatios *aostypes.ResourceRatiosInfo, | ||
) (stateSize, storageSize uint64) { | ||
stateQuota := serviceConfig.Quotas.StateLimit |
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.
Why are intermediate vars required?
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.
to make a line shorter in a place where it is used so it didnt move to a next line
launcher/launcher.go
Outdated
storageQuota := serviceConfig.Quotas.StorageLimit | ||
|
||
if serviceConfig.RequestedResources != nil && serviceConfig.RequestedResources.Storage != nil { | ||
stateSize = clampResource(*serviceConfig.RequestedResources.Storage, stateQuota) |
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.
Clamping should be done for all the cases.
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.
It's not required to clamp values from NodeConfig as they are a ratios of quota,
@@ -311,10 +311,12 @@ func (node *nodeHandler) getRequestedCPU( | |||
instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, | |||
) uint64 { | |||
requestedCPU := uint64(0) | |||
cpuQuota := serviceConfig.Quotas.CPUDMIPSLimit |
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.
ditto for the intermediate variable and clamping
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.
not clear what should be done
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.
Somehow my comments about clamping for all cases disappeared: clamping should be done for all cases.
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.
fixed
@@ -336,10 +338,12 @@ func (node *nodeHandler) getRequestedRAM( | |||
instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, | |||
) uint64 { | |||
requestedRAM := uint64(0) | |||
ramQuota := serviceConfig.Quotas.RAMLimit |
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.
ditto
stateQuota := serviceConfig.Quotas.StateLimit | ||
storageQuota := serviceConfig.Quotas.StorageLimit | ||
|
||
if serviceConfig.RequestedResources != nil && serviceConfig.RequestedResources.Storage != nil { |
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.
We should have different values for state and storage. Let's discuss with cloud.
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.
fixed
Signed-off-by: Mykola Kobets <[email protected]>
Signed-off-by: Mykola Kobets <[email protected]>
3eae841
to
668c991
Compare
668c991
to
d32fcb6
Compare
storageQuota := serviceConfig.Quotas.StorageLimit | ||
|
||
if serviceConfig.RequestedResources != nil && serviceConfig.RequestedResources.State != nil { | ||
stateSize = clampResource(*serviceConfig.RequestedResources.State, stateQuota) |
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.
clamp should be done in all cases. Resource ration could exceed quota as well.
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.
in node config resource ratios specified in the percents of the quota. which means it should be less than resource quota be design.
@@ -311,10 +311,12 @@ func (node *nodeHandler) getRequestedCPU( | |||
instanceIdent aostypes.InstanceIdent, serviceConfig aostypes.ServiceConfig, | |||
) uint64 { | |||
requestedCPU := uint64(0) | |||
cpuQuota := serviceConfig.Quotas.CPUDMIPSLimit |
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.
Somehow my comments about clamping for all cases disappeared: clamping should be done for all cases.
Signed-off-by: Mykola Kobets <[email protected]>
d32fcb6
to
0c9eb45
Compare
Quality Gate passedIssues Measures |
No description provided.