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

VPA: Configurable container limit scaling #3028

Merged

Conversation

johanneswuerbach
Copy link
Contributor

Make the proportional limit scaling configurable.

Follow up of #2359, #2362 and #2387

I'm happy to update the generated files and add tests if the approach looks acceptable.

//cc @Avanpourm @bskiba

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 6, 2020
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 10, 2020
@johanneswuerbach
Copy link
Contributor Author

/assign @jbartosik

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

Apologies for the very long wait.
As I see demand for this feature, I am sold on the approach 👍I added some comments but nothing major.
Please do add tests and update the generated files (in a separate commit).

Ideally we would also have e2e test verifying turning limit scaling off works as expected. There are already tests for limit scaling.

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 795f4aa to 2d63e89 Compare May 13, 2020 21:41
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 13, 2020
@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 2d63e89 to 8fdc63d Compare May 13, 2020 21:41
@johanneswuerbach
Copy link
Contributor Author

johanneswuerbach commented May 13, 2020

Thank you for your feedback, I addressed the first batch of review comments and will add tests tomorrow.

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch 2 times, most recently from 30940f8 to 71ff275 Compare May 16, 2020 22:57
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 16, 2020
@johanneswuerbach
Copy link
Contributor Author

@bskiba comments addressed and tests added :-)

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 71ff275 to 3e664f1 Compare May 16, 2020 23:22
@johanneswuerbach
Copy link
Contributor Author

/assign @bskiba

@bskiba
Copy link
Member

bskiba commented Jun 2, 2020

I'll take another look later today

@bskiba
Copy link
Member

bskiba commented Jun 2, 2020

Apologies, didn't make it today 😓, will take a look tomorrow.

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

Once again sorry for taking forever.

Would it be possible to split into multiple commits?

  1. Added types
  2. Autogen
  3. Implementation
  4. e2e tests
  5. vendor and go.mod/go.sum changes

Also since there are changes in go.sum, can you run go mod vendor to see if vendor/ directory gets changed?

// Whether autoscaler limit scaling is enabled for the container. The default is "Auto".
// Enabling this requires the autoscaler to be enabled for the container
// +optional
LimitMode *ContainerLimitScalingMode `json:"limitMode,omitempty" protobuf:"bytes,6,rep,name=limitMode"`
Copy link
Member

Choose a reason for hiding this comment

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

I've thought about this a bit more and I think it would be good to make the setting here more explicit and change this to sth like:
ControlledValues: RequestsOnly/RequestsAndLimits

with RequestsAndLimits being the default.

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That reads better, updated :-)

// Specifies the type of recommendations that will be computed
// (and possibly applied) by VPA.
// If not specified, the default of [ResourceCPU, ResourceMemory] will be used.
ControlledResources *[]v1.ResourceName `json:"controlledResources,omitempty" patchStrategy:"merge" protobuf:"bytes,5,rep,name=controlledResources"`
Copy link
Member

Choose a reason for hiding this comment

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

Any idea why ControlledResources shows up as diff here? I think it's already merged into master. Or are my eyes playing tricks on me?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 3e664f1 to 95b7d1e Compare June 6, 2020 13:28
@johanneswuerbach
Copy link
Contributor Author

@bskiba rebased, implemented the requested changes and splitted the commits as requested :-)

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

I think we're close \o/ Thanks for structuring this and for your patience :)

Left two small comments.
Question: Is it possible in the RequestsOnly mode that we will try to create a pod with request > limit?
We need to avoid that, since it causes the pod to be rejected by API server.

@bskiba
Copy link
Member

bskiba commented Jun 8, 2020

The travis fail seems unrelated (spellcheck failed in cluster autoscaler)

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 95b7d1e to 53e4758 Compare June 12, 2020 22:13
@johanneswuerbach
Copy link
Contributor Author

@bskiba I added code & test to always stay below the limits for any recommendation provided. Is this what you had in mind?

@johanneswuerbach
Copy link
Contributor Author

Ping @bskiba :-)

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

Looks, good, I have one more request for the capping to limit code.
Thanks for the additional tests!

@@ -70,6 +70,22 @@ func GetContainersResources(pod *core.Pod, vpaResourcePolicy *vpa_types.PodResou
}
}
}
// Ensure container requests always stay below container limits
Copy link
Member

Choose a reason for hiding this comment

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

Can you take a look at this: 8bc98b7

This is a PR that removed recommendation to limit capping when we started doing proportional limit. The capping is applied to all recommendation parts (Target, Upper and Lower limit). Could you reuse that solution? (sorry for only providing it now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bskiba updated. Does that look okay now?

@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch 2 times, most recently from 44fe28a to 86a3c30 Compare July 5, 2020 13:33
@johanneswuerbach johanneswuerbach requested a review from bskiba July 5, 2020 13:33
@johanneswuerbach johanneswuerbach force-pushed the configurable-limit-scaling branch from 86a3c30 to 727dab6 Compare July 5, 2020 13:36
@johanneswuerbach
Copy link
Contributor Author

Ping @bskiba :-)

Copy link
Member

@bskiba bskiba left a comment

Choose a reason for hiding this comment

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

Thanks for this change and thanks a lot for your patience with the reviewer (aka me)!
Looks good

/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 Jul 15, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bskiba

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 Jul 15, 2020
@k8s-ci-robot k8s-ci-robot merged commit 465d02a into kubernetes:master Jul 15, 2020
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants