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

Fix Existing Requests and Limits with LimitRange #5269

Conversation

austinzhao-go
Copy link
Contributor

@austinzhao-go austinzhao-go commented Aug 3, 2022

Changes

This PR is to update limitrange logic to ensure container's requests and limits under the min and max range which is configured by limitrange.

/kind bug

Submitter Checklist

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

  • Has Docs included if any changes are user facing
  • Has Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Fixed Existing Requests and Limits with LimitRange

@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Aug 3, 2022
@tekton-robot tekton-robot requested review from jerop and lbernick August 3, 2022 19:02
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 3, 2022
@austinzhao-go
Copy link
Contributor Author

/hold

till #5082 is merged

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 3, 2022
@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/computeresources/tasklevel/tasklevel.go Do not exist 100.0%
pkg/internal/computeresources/transformer.go 91.9% 92.5% 0.6
pkg/pod/pod.go 88.8% 88.2% -0.6

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

Thanks Austin! Would you mind splitting the limitrange commit into a separate PR?

pkg/internal/computeresources/transformer_test.go Outdated Show resolved Hide resolved
@@ -310,7 +310,7 @@ func TestTransformerOneContainer(t *testing.T) {
Containers: []corev1.Container{{
Resources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("4Gi"),
corev1.ResourceMemory: resource.MustParse("2Gi"),
Copy link
Member

Choose a reason for hiding this comment

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

Thanks Austin! Nice job catching this bug, it looks like the behavior here wasn't consistent with our documentation. @vdemeester could you double check me here?

pkg/internal/computeresources/transformer_test.go Outdated Show resolved Hide resolved
pkg/internal/computeresources/transformer_test.go Outdated Show resolved Hide resolved
pkg/internal/computeresources/transformer.go Outdated Show resolved Hide resolved
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch 3 times, most recently from 89ae4d1 to be0d72c Compare August 5, 2022 14:33
@austinzhao-go
Copy link
Contributor Author

/release-note-none

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 5, 2022
@austinzhao-go
Copy link
Contributor Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 5, 2022
@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/computeresources/tasklevel/tasklevel.go Do not exist 100.0%
pkg/internal/computeresources/transformer.go 91.9% 92.3% 0.4
pkg/pod/pod.go 88.8% 88.2% -0.6

@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from be0d72c to c9be8d9 Compare August 5, 2022 16:31
@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/computeresources/tasklevel/tasklevel.go Do not exist 100.0%
pkg/internal/computeresources/transformer.go 91.9% 92.3% 0.4
pkg/pod/pod.go 88.8% 88.2% -0.6

@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from c9be8d9 to 59cef74 Compare August 5, 2022 16:35
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 5, 2022
@austinzhao-go
Copy link
Contributor Author

/unhold

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 5, 2022
@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/computeresources/transformer.go 91.9% 92.3% 0.4

@lbernick lbernick removed the kind/feature Categorizes issue or PR as related to a new feature. label Aug 5, 2022
@austinzhao-go austinzhao-go changed the title [TEP-0104] Update Container's Requests and Limits with LimitRange Fix Container's Requests and Limits with LimitRange Aug 8, 2022
@lbernick
Copy link
Member

lbernick commented Aug 8, 2022

Fixes #5278
Please also add a release note!

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 8, 2022
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from 59cef74 to 337590a Compare August 9, 2022 14:18
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 9, 2022
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from 337590a to 4c77588 Compare August 9, 2022 14:19
@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/computeresources/transformer.go 91.9% 92.3% 0.4

@austinzhao-go austinzhao-go changed the title Fix Container's Requests and Limits with LimitRange Fix Existing Requests and Limits with LimitRange Aug 9, 2022
@austinzhao-go
Copy link
Contributor Author

/retest

Copy link
Member

@lbernick lbernick left a comment

Choose a reason for hiding this comment

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

We also need to address the test cases "limitRange with min and limits on containers < min" and "limitRange with max and requests on containers > max". These test cases are outputting invalid pods (requests > limits).

pkg/internal/computeresources/transformer_test.go Outdated Show resolved Hide resolved
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from 4c77588 to 141aa00 Compare August 9, 2022 19:45
@lbernick
Copy link
Member

lbernick commented Aug 9, 2022

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 9, 2022
@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/computeresources/transformer.go 91.9% 93.0% 1.1

@abayer
Copy link
Contributor

abayer commented Aug 10, 2022

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abayer

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 Aug 10, 2022
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from 141aa00 to 10ebfd5 Compare August 10, 2022 18:47
@austinzhao-go
Copy link
Contributor Author

thanks @abayer for the review!

pushed an update to ensure requests got "capped" by limits finally

@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/computeresources/transformer.go 91.9% 93.5% 1.6

@austinzhao-go
Copy link
Contributor Author

/retest

@austinzhao-go
Copy link
Contributor Author

/hold

till collecting further feedback from community

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 12, 2022
LimitRange logic were updated to ensure the requests and limits of containers
will be under the min and max range of LimitRange.
@austinzhao-go austinzhao-go force-pushed the tep-0104/update-requests-limits-with-limitrange branch from 10ebfd5 to 580012b Compare August 16, 2022 14:03
@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/computeresources/transformer.go 91.9% 94.1% 2.2

@tekton-robot
Copy link
Collaborator

@austinzhao-go: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-tekton-pipeline-integration-tests 580012b link true /test pull-tekton-pipeline-integration-tests

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@austinzhao-go
Copy link
Contributor Author

closed the PR for this moment after a check with @lbernick

the expected fix will be updated in another PR.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/bug Categorizes issue or PR as related to a bug. release-note-none Denotes a PR that doesnt merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants