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

Cherry pick limit support #2106

Merged
merged 25 commits into from
Jun 7, 2019

Conversation

jbartosik
Copy link
Collaborator

@jbartosik jbartosik commented Jun 7, 2019

Follow up to #2105 which had commits that cherry picked automatically. Some commits in this PR are not exact cherry pick and needed changes to

  • vertical-pod-autoscaler/deploy/vpa-rbac.yaml
  • vertical-pod-autoscaler/pkg/admission-controller/logic/server.go
  • vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
  • vertical-pod-autoscaler/pkg/admission-controller/main.go

Because master has VPA preprocessor but vpa-release-0.5 doesn't (and some changes to RBAC). Each commit notes in its message any files I modified manually.

Cherry pick:

safanaj and others added 8 commits June 7, 2019 14:42
To allow admission controller to set limits on containers if needed
because LimitRange in namespace with default and max ratio.
This feature have to be explicitly enabled by passing the flag `--allow-to-adjust-limits`

Conflicts, resolved manually in(vpaPreprocessor is on master but not on
this branch):
	vertical-pod-autoscaler/pkg/admission-controller/logic/server.go
	vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
	vertical-pod-autoscaler/pkg/admission-controller/main.go
I'm keeping original CL from kubernetes#1813
and applying changes requested in the review in a separate CL to keep
autoship information clean.

Conflicts because master has VPA preprocessor, resolved manually:
	vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
	vertical-pod-autoscaler/pkg/admission-controller/main.go
Keep limit/request user set (even if the limit comes from limit range).
Cap limits to Max configured in the limit range.

Conflicts (VPA preprocessor):
	vertical-pod-autoscaler/pkg/admission-controller/logic/server.go
	vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
	vertical-pod-autoscaler/pkg/admission-controller/main.go
I want to squash this commit before merging but have it separate to make
review clearer.
To be squashed

Conflicts:
	vertical-pod-autoscaler/pkg/admission-controller/logic/server.go
	vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
	vertical-pod-autoscaler/pkg/admission-controller/main.go
to be squashed before merging
To be squashed before submit

Conflicts:
	vertical-pod-autoscaler/pkg/admission-controller/logic/server.go
	vertical-pod-autoscaler/pkg/admission-controller/logic/server_test.go
	vertical-pod-autoscaler/pkg/admission-controller/main.go
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Jun 7, 2019
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 7, 2019
bskiba and others added 12 commits June 7, 2019 14:52
Conflicts:
	vertical-pod-autoscaler/deploy/vpa-rbac.yaml
Refactoring to make the code consistent.
Removed applying to upper and lower bound - I was mistaken that
it was needed >.<.

Note that since the recommendation is already capped
to max/min limit, there is no additional need for capping
in the GetContainerResources method.
Min from limit range applies to both limit and request, adjust e2e tests
to work with that.
Looks like target not in [lower bound, upper bound] is what was breaking
e2e tests.
jbartosik added 2 commits June 7, 2019 15:01
Admisson controller was crashing because it was tryig to divide by 0 so
it dind't make any changes to pod.

Adter I fixed that only 1 pod would fit in the cluster so I lowered
recommendation.
@jbartosik jbartosik changed the title [WIP] Cherry pick limit support Cherry pick limit support Jun 7, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 7, 2019
@jbartosik
Copy link
Collaborator Author

/assign @bskiba
This had some merge conflicts but they were easy to resolve.

@@ -183,6 +128,11 @@ func (p *recommendationProvider) GetContainersResourcesForPod(pod *v1.Pod) ([]Co
return nil, annotations, vpaConfig.Name, err
}
}
containerResources := GetContainersResources(pod, *recommendedPodResources, annotations)
podLimitRange, err := p.limitsRangeCalculator.GetContainerLimitRangeItem(pod.Namespace)
// TODO: Support limit range on pod level.
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed this TODO is still here, is this expected?

Copy link
Collaborator Author

@jbartosik jbartosik Jun 7, 2019

Choose a reason for hiding this comment

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

No, I forgot to remove it (also variable name is misleading). I'll clean up in separate PRs.

@bskiba
Copy link
Member

bskiba commented Jun 7, 2019

/lgtm
/approve
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2019
@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 Jun 7, 2019
@k8s-ci-robot k8s-ci-robot merged commit 1bc541d into kubernetes:vpa-release-0.5 Jun 7, 2019
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants