-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Cherry pick limit support #2106
Conversation
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
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.
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.
/assign @bskiba |
@@ -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. |
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.
I just noticed this TODO is still here, is this expected?
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.
No, I forgot to remove it (also variable name is misleading). I'll clean up in separate PRs.
/lgtm |
[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 |
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
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: