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

Omit init containers from limitrange default request calculations #4769

Merged
merged 1 commit into from
May 3, 2022

Conversation

lbernick
Copy link
Member

Changes

This commit modifies how resource requirements are adjusted based on LimitRanges present
in a namespace. Prior to this commit, the container requests for a resource
were determined by dividing the default requests specified in a LimitRange by the number of
app containers plus 1 (to represent the init container), taking the maximum of this value
and the minimum request specified in the LimitRange, and applying this value to all containers.

However, Kubernetes does not sum init container resource requests to app container resource requests
when determining the pod's effective resource requests, as described here. Instead, it takes the larger of
the maximum init container resource requests and the sum of app container resource requests.
As a result, the appropriate behavior is to split the default requests only among app containers, and
to apply the default requests directly to init containers. This commit implements that behavior.

/kind bug

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • n/a Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in
    (if there are no user facing changes, use release note "NONE")

Release Notes

Omit init containers from limitrange default request calculations

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 18, 2022
@lbernick
Copy link
Member Author

/assign vdemeester

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/internal/limitrange/transformer.go 96.7% 97.1% 0.4

This commit modifies how resource requirements are adjusted based on LimitRanges present
in a namespace. Prior to this commit, the container requests for a resource
were determined by dividing the default requests specified in a LimitRange by the number of
app containers plus 1 (to represent the init container), taking the maximum of this value
and the minimum request specified in the LimitRange, and applying this value to all containers.

However, Kubernetes does not sum init container resource requests to app container resource requests
when determining the pod's effective resource requests, as described
here: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#resources. Instead, it takes
the larger of the maximum init container resource requests and the sum of app container resource requests.
As a result, the appropriate behavior is to split the default requests only among app containers, and
to apply the default requests directly to init containers. This commit implements that behavior.
@lbernick
Copy link
Member Author

/test pull-tekton-pipeline-go-coverage
/test pull-tekton-pipeline-alpha-integration-tests

@tekton-robot
Copy link
Collaborator

The following is the coverage report on the affected files.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/internal/limitrange/transformer.go 96.7% 97.1% 0.4

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 20, 2022
@vdemeester
Copy link
Member

cc @abayer

@abayer
Copy link
Contributor

abayer commented May 3, 2022

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label May 3, 2022
@abayer
Copy link
Contributor

abayer commented May 3, 2022

/retest

@lbernick
Copy link
Member Author

lbernick commented May 3, 2022

/test pull-tekton-pipeline-alpha-integration-tests

@tekton-robot tekton-robot merged commit 8f5fcfc into tektoncd:main May 3, 2022
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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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