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

recommendation post processor for integer CPU #5313

Merged
merged 5 commits into from
Jan 9, 2023

Conversation

dbenque
Copy link
Contributor

@dbenque dbenque commented Nov 14, 2022

Which component this PR applies to?

vertical-pod-autoscaler/recommender

What type of PR is this?

/kind feature

What this PR does / why we need it:

It introduces a recommendation post processor that allows users to have a CPU integer as recommendation.
Thanks to that it is now possible to use VPA with applications using CPU management with static policy

Which issue(s) this PR fixes:

Fixes #5236

Special notes for your reviewer:

As discussed during the SIG meeting the user interface is based on an annotations. This could be structured in the spec of the VPA once the feature will have gained maturity.

Does this PR introduce a user-facing change?

The "cpu integer post-processor" can be enabled using flag --cpu-integer-post-processor-enabled=true when starting the VPA recommender.
The post-processor would round-up CPU recommendation for containers referenced by a VPA annotation with this format:
vpa-post-processor.kubernetes.io/{containerName}_integerCPU=true

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

This post processor is optional. To run it in the recommender the command-line flag should be set:
--cpu-integer-post-processor-enabled=true, then only the pods/containers that have the relevant annotation are affected.

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 14, 2022
Copy link
Collaborator

@jbartosik jbartosik left a comment

Choose a reason for hiding this comment

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

I took a first pass. I couldn't look at tests yet.

process(r.Target)
process(r.LowerBound)
process(r.UpperBound)
process(r.UncappedTarget)
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the contract about UncappedTarget? Probably post-processors should leave it as-is, like limit capping does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it make sense that the UncappedTarget is not touched by the capping post-processor, but I would say that the same does not apply to other post-processors than capping.
I don't think we need to keep a UnXYZTarget for each XYZ post-processor

{
name: "2 containers, 2 matching",
vpa: &model.Vpa{Annotations: map[string]string{
vpaPostProcessorPrefix + "container1" + vpaPostProcessorIntegerCPUSuffix: "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

The annotation can also be turned off by setting it to false, so can you please also add some tests for the case where
vpaPostProcessorPrefix + "container1" + vpaPostProcessorIntegerCPUSuffix: "false"

While writing this, I'm not sure if we need this additional case? How is this different from the annotation not being present for a container? As an alternative, the annotation could list the containers for which this post-processor is turned on?

Copy link
Contributor Author

@dbenque dbenque Nov 24, 2022

Choose a reason for hiding this comment

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

"false" and annotation not being present are equivalent indeed.

We already have the support for multiple container with the current code (list of annotation, one per container), adding another way of expressing the same thing may introduce confusion and complexity.

@dbenque dbenque requested review from jbartosik and voelzmo and removed request for kgolab, jbartosik and voelzmo November 24, 2022 15:03
Copy link
Collaborator

@jbartosik jbartosik 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 also need some documentation:

  • Release note
  • Some description of how to use this.

@dbenque
Copy link
Contributor Author

dbenque commented Dec 2, 2022

I think we also need some documentation:

  • Release note
  • Some description of how to use this.

I have added documentation in the last commit 17ef628

Where should I put information for the release note? I have updated the PR section Does this PR introduce a user-facing change , is that the right place?

@jbartosik
Copy link
Collaborator

Mostly looks good, there are some things I want to make sure are consistent (mostly flags, labels, and docs). I'm not sure when I'll be able to finish the review (I might have to take some time off). I want to merge this before I cut release (#5355).

@jbartosik
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 23, 2022
@jbartosik
Copy link
Collaborator

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dbenque, jbartosik

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 Jan 9, 2023
@k8s-ci-robot k8s-ci-robot merged commit 90419dc into kubernetes:master Jan 9, 2023
@jbartosik jbartosik mentioned this pull request Jan 9, 2023
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. area/vertical-pod-autoscaler cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. 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.

VPA - Support of Static Policy for CPU Management
4 participants