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

feat: Support PodRequests calculations for initContainers with restar… #569

Merged
merged 26 commits into from
Feb 2, 2024

Conversation

sadath-12
Copy link
Contributor

@sadath-12 sadath-12 commented Oct 3, 2023

Fixes #479

Description

PodRequests calculations now also consider sidecar feature as introduced in v1.28 , hence also updating our k8s.io/client-go and k8s.io/api/core/v1 to latest version .
This pr is inspired from upstream k8s https://github.com/kubernetes/kubernetes/blob/e2afa175e4077d767745246662170acd86affeaf/pkg/api/v1/resource/helpers.go#L96

How was this change tested?

make presubmit

Ran this as a separate demo file comparing with the existing calculations done

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sadath-12 sadath-12 requested a review from a team as a code owner October 3, 2023 12:51
@sadath-12 sadath-12 requested a review from njtran October 3, 2023 12:51
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@sadath-12
Copy link
Contributor Author

Also for test I would need to change podOptions interface a bit since with the current one it can't take multiple initContainers

@sadath-12
Copy link
Contributor Author

Will rework on this after latest k8s packages pr gets merged since it conflicts with this

go.sum Outdated Show resolved Hide resolved
pkg/test/pods.go Outdated Show resolved Hide resolved
pkg/test/pods.go Outdated Show resolved Hide resolved
pkg/test/pods.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/provisioner_test.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/nodepool_test.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/nodepool_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/nodepool_test.go Outdated Show resolved Hide resolved
@sadath-12
Copy link
Contributor Author

thank you @jonathan-innis , working on them

@sadath-12
Copy link
Contributor Author

Hi @jonathan-innis , Tried meeting those test requirements + additionally corrected logic and it passed the tests + tried to adapt to our existing Ceiling function structure + tried to make it as clean as possible. Please have a look

Copy link
Contributor

@njtran njtran left a comment

Choose a reason for hiding this comment

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

Just stopping by with a review. No need to block on me

pkg/test/pods.go Outdated Show resolved Hide resolved
pkg/test/pods.go Outdated Show resolved Hide resolved
@sadath-12
Copy link
Contributor Author

Done

pkg/controllers/provisioning/nodepool_test.go Outdated Show resolved Hide resolved
pkg/controllers/provisioning/provisioner_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Oct 18, 2023

Pull Request Test Coverage Report for Build 6688219087

  • 59 of 59 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 82.561%

Totals Coverage Status
Change from base Build 6672224362: 0.07%
Covered Lines: 9317
Relevant Lines: 11285

💛 - Coveralls

pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources_suite_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
@ellistarn
Copy link
Contributor

Can we make sure we benchmark the scheduling performance before this is merged?

@sadath-12
Copy link
Contributor Author

Can we make sure we benchmark the scheduling performance before this is merged?

Sure!

benchmarks

pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
.info Outdated Show resolved Hide resolved
pkg/utils/resources/resources.go Show resolved Hide resolved
pkg/utils/resources/resources.go Show resolved Hide resolved
pkg/utils/resources/resources.go Show resolved Hide resolved
pkg/utils/resources/resources.go Show resolved Hide resolved
pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
@sadath-12
Copy link
Contributor Author

sadath-12 commented Oct 30, 2023

Applied @jonathan-innis

Copy link

This PR has been inactive for 14 days. StaleBot will close this stale PR after 14 more days of inactivity.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 13, 2023
@jonathan-innis
Copy link
Member

@sadath-12 Looking for a rebase so that we can run the CI checks. PR is looking like it's in a good state and we can consider merging after we get a pass across the checks.

@jonathan-innis jonathan-innis removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 20, 2023
@sadath-12
Copy link
Contributor Author

Merged it @jonathan-innis , is it fine since it looked much easier

pkg/utils/resources/resources.go Outdated Show resolved Hide resolved
pkg/utils/resources/suite_test.go Show resolved Hide resolved
pkg/controllers/provisioning/nodepool_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 25, 2023
@sadath-12
Copy link
Contributor Author

Done

sadath-12 and others added 8 commits February 1, 2024 16:14
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
Signed-off-by: sadath-12 <sadathsadu2002@gmail.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2024
Copy link
Member

@jonathan-innis jonathan-innis left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jonathan-innis, sadath-12

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

@sadath-12
Copy link
Contributor Author

Finally time has come

pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
pkg/utils/resources/suite_test.go Outdated Show resolved Hide resolved
@jmdeal
Copy link
Member

jmdeal commented Feb 2, 2024

A couple of small things, once those are taken care of this gets an lgtm from me.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed 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. labels Feb 2, 2024
@jonathan-innis jonathan-innis force-pushed the sadath-dev-1 branch 4 times, most recently from a531596 to d622740 Compare February 2, 2024 06:55
@jmdeal
Copy link
Member

jmdeal commented Feb 2, 2024

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 2, 2024
@jmdeal
Copy link
Member

jmdeal commented Feb 2, 2024

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 2, 2024
@k8s-ci-robot k8s-ci-robot merged commit 0e77b78 into kubernetes-sigs:main Feb 2, 2024
12 checks passed
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support PodRequests calculations for initContainers with restartPolicy: Always
8 participants