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

Do not set limits when recommendation is 0 #3903

Merged
merged 1 commit into from
Mar 16, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func getProportionalResourceLimit(resourceName core.ResourceName, originalLimit,
if originalLimit == nil || originalLimit.Value() == 0 {
return nil, ""
}
// recommendedRequest not set, don't set limit.
if recommendedRequest == nil || recommendedRequest.Value() == 0 {
return nil, ""
}
// originalLimit set but originalRequest not set - K8s will treat the pod as if they were equal,
// recommend limit equal to request
if originalRequest == nil || originalRequest.Value() == 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ func TestGetProportionalResourceLimit(t *testing.T) {
recommendedRequest: mustParseToPointer("10"),
expectLimit: mustParseToPointer("10"),
},
{
name: "no recommendation",
originalRequest: mustParseToPointer("1"),
recommendedRequest: mustParseToPointer("0"),
defaultLimit: mustParseToPointer("2"),
expectLimit: nil,
},
{
name: "limit equal to request",
originalLimit: mustParseToPointer("1"),
Expand Down