-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Dedicated package for scheduler interaction with DRA structured types #134404
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
Dedicated package for scheduler interaction with DRA structured types #134404
Conversation
|
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
|
/verify-owners |
78ddad0 to
0e923e4
Compare
| # See the OWNERS file documentation: https://git.k8s.io/community/contributors/guide/owners.md | ||
|
|
||
| approvers: | ||
| - kubernetes/sig-autoscaling-reviewers |
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.
kubernetes/sig-autoscaling-reviewers should be sig-autoscaling-maintainers
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.
@jackfrancis, Thanks for your feedback, I fixed them.
|
|
||
| approvers: | ||
| - kubernetes/sig-autoscaling-reviewers | ||
| - kubernetes/wg-device-management |
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.
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.
Thanks for your feedback, I fixed them.
| reviewers: | ||
| - kubernetes/sig-autoscaling-reviewers | ||
| - kubernetes/wg-device-management | ||
| - kubernetes/sig-scheduling-reviewers |
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.
kubernetes/sig-scheduling-reviewers can be sig-scheduling-maintainers or just sig-scheduling
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.
@jackfrancis, Thanks for your feedback, I fixed them.
0e923e4 to
92fe2c6
Compare
|
|
||
| // TestSchedulerContractTypes validates that all scheduler contract types | ||
| // are properly defined and accessible. | ||
| func TestSchedulerContractTypes(t *testing.T) { |
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 am not sure what exactly these tests are testing. They seem to exercise some of those types, but for what purpose? What kind of guarantee do we get out them that isn't already covered by "the production code compiles"?
|
|
||
| // DeviceID represents a unique identifier for a device in the DRA system. | ||
| // This type is used in the scheduler and autoscaler contract. | ||
| type DeviceID = structured.DeviceID |
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.
What we want to achieve with this package is that any code change which changes content or semantic of AllocatedState is visible as a scheduler contract change and triggers the "needs autoscaler approval" OWNERS rule.
The way how the type aliases are set up right now doesn't achieve this. Code changes can be made in k8s.io/dynamic-resource-allocation/structured without autoscaler review and this code here continues to work unchanged.
It has to be the other way around: this package here needs to have the actual struct definitions such that it is self-contained. Then k8s.io/dynamic-resource-allocation/structured can have the type aliases to avoid code churn and simplify using the types.
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.
This is more or less what I was expecting. Let's see what others think about this approach.
pkg/scheduler/framework/autoscaler_contract/lister_contract_test.go
Outdated
Show resolved
Hide resolved
staging/src/k8s.io/dynamic-resource-allocation/structured/schedulerapi/OWNERS
Outdated
Show resolved
Hide resolved
| "k8s.io/apimachinery/pkg/api/resource" | ||
| "k8s.io/apimachinery/pkg/types" | ||
| "k8s.io/apimachinery/pkg/util/sets" | ||
| draapi "k8s.io/dynamic-resource-allocation/api" |
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.
This is only used for UniqueString, which I think is okay to import instead of defining it here.
| } | ||
|
|
||
| // Clone makes a copy of ConsumedCapacity of each capacity. | ||
| func (c ConsumedCapacityCollection) Clone() ConsumedCapacityCollection { |
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.
Pre-existing, you are just moving it, but I wonder: can we replace the manually written Clone with generated DeepCopy code?
/cc @sunya-ch
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.
Good catch,
Yes, we can replace the manual Clone methods with generated DeepCopy code.
Would you prefer I do that in this PR, or should we keep this PR focused on moving the
types to establish the contract and handle the DeepCopy generation in a follow-up?
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.
A separate PR is probably cleaner.
f2a1c98 to
bb3d60a
Compare
bb3d60a to
dd8d0e6
Compare
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.
|
Looks good to me. The original comment thread recommends to have this in |
|
Looks good to me, thanks for taking care of this! /lgtm |
|
LGTM label has been added. Git tree hash: 2df719839e4fdbe6f039c217cf7343af171fbfe1
|
|
/release-note-none |
|
As mentioned #134404 (comment) |
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.
/lgtm
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis, nmn3m, pohly 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 |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR extends
pkg/scheduler/framework/autoscaler_contract/lister_contract_test.gowith a lister that uses a data structure defined in thek8s.io/dynamic-resource-allocation/structuredpackage.Currently, changes to that struct do not fall under SIG Autoscaling review unless explicitly requested. This makes it harder to catch issues during code review.
Why this is needed:
To ensure that changes affecting the autoscaler are visible to SIG Autoscaling reviewers and do not slip through unnoticed.
Which issue(s) this PR is related to:
Fixes #133162
Special notes for your reviewer:
One potential solution applied here is moving the relevant types into a new package:
k8s.io/dynamic-resource-allocation/structured/schedulerapias @pohly mentioned in the issue.An OWNERS file is set up there similar to the one under
autoscaler_contract, so that the right reviewers are automatically added./wg device-management
/sig autoscaling
Does this PR introduce a user-facing change?