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

Refactor the dynamicResources struct to DynamicResources #128399

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

JesseStutler
Copy link
Contributor

@JesseStutler JesseStutler commented Oct 29, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

I'm from volcano community. Currently, volcano wants to introduce DRA in k8s v1.31, we need to use the dynamicresources struct. Now dynamicresources is still private in master branch and can not be accessed outside the package. It needs to be refactored to DynamicResources, therefore we can access directly. I communicated with@pohly before, If I verify in volcano when there is no problem I can refactor the dynamicresources struct to public.

Which issue(s) this PR fixes:

We had a PR before and wanted to refactor this, but this person stopped following up: #124269

Special notes for your reviewer:

Our verification in volcano:
We follow up https://github.com/kubernetes-sigs/dra-example-driver to deploy an example resource driver and deploy the demo yaml gpu-test{1,2,3,4,5}.yaml, the pod can be successfully scheduled:
image
image
And allocation result in ResourceClaim is successfully updated:
image

Does this PR introduce a user-facing change?

The `dynamicResources` has been refactored to `DynamicResources`, now users can introduce the `DynamicResources` struct outside the `dynamicresources` package.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. 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 Oct 29, 2024
Copy link

linux-foundation-easycla bot commented Oct 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: JesseStutler / name: Jesse Stutler (f7003c7)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 29, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot
Copy link
Contributor

Welcome @JesseStutler!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 29, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @JesseStutler. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Oct 29, 2024
@k8s-ci-robot k8s-ci-robot requested review from bart0sh and pohly October 29, 2024 03:46
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. 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 Oct 29, 2024
Copy link
Contributor

@pohly pohly left a comment

Choose a reason for hiding this comment

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

/lgtm

Now might be a good time to merge this, with classic DRA removed and methods thus simplified. Hopefully other pending PRs won't conflict.

@JesseStutler asked for backporting to 1.31 on Slack. I don't think we can do that because it would update an alpha feature and such backports are discouraged. OTOH, the risk is so low here, perhaps it would be acceptable?

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

LGTM label has been added.

Git tree hash: 9ee528a18c85117c1e4ebd90756c90a9417c03ac

@JesseStutler
Copy link
Contributor Author

Now we are actually adapting volcano to k8s v1.31, so it will be nicer to merge it into 1.31, but if 1.31 does not have a patch version anymore, I think v1.32 also is fine. We currently make a copy of all the DRA codes of the latest master branch into volcano to make our DRA plugin.

@pohly
Copy link
Contributor

pohly commented Oct 29, 2024

/retest

"cluster supports count/resourceclaims.resource.k8s.io ResourceQuota" flakes occasionally

@pohly
Copy link
Contributor

pohly commented Oct 29, 2024

/assign @kerthcet

For approval.

@kannon92
Copy link
Contributor

How will the volcano community handle this with different versions of kubernetes?

I think if you are consuming this as part of a library you would want versioned APIs.

I worry that volcano is going to include a Kubernetes/Kubernetes plus our library packages. I think that may cause some confusion with dependency updates.

@googs1025
Copy link
Member

googs1025 commented Oct 29, 2024

How will the volcano community handle this with different versions of kubernetes?

I think if you are consuming this as part of a library you would want versioned APIs.

I worry that volcano is going to include a Kubernetes/Kubernetes plus our library packages. I think that may cause some confusion with dependency updates.

I had communicated with @JesseStutler offline, I suggested that we (in volcano community) adapt this after DRA promoted to beta, because beta is a relatively stable version.

// dynamicResources is a plugin that ensures that ResourceClaims are allocated.
type dynamicResources struct {
// DynamicResources is a plugin that ensures that ResourceClaims are allocated.
type DynamicResources struct {
Copy link
Member

Choose a reason for hiding this comment

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

Kubernetes/Kubernetes is not meant to be consumed externally

Copy link
Contributor

Choose a reason for hiding this comment

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

Not meant to, but some things are done that way anyway:

Copy link
Member

@aojea aojea Oct 29, 2024

Choose a reason for hiding this comment

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

just saying, reading the PR description it felt to me people may have some expectations that I think is important to clarify ... but looking at those links I wonder if sig-scheduler should work on moving that path to staging 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @aojea, thanks for your review. Not mean to directly open this PR, but I have discussed it with @pohly on slack, DRA plugin wasn't mature enough so it can't be consumed externally, but after the volcano verification was completed, he felt that it would be ok to open DRA. I saw that lots of other scheduler plugins can also be consumed externally, volcano introduces them the same way. In fact, as long as volcano can access the DRA plugin externally, it doesn’t matter which dependent package the DRA plugin is in.

Copy link
Contributor

Choose a reason for hiding this comment

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

sig-scheduler should work on moving that path to staging

I agree that this would be cleaner.

I wasn't involved in discussions around it, but I suppose it's not getting done because it would be a major change: it's not sufficient to just move plugins or the framework, for the "custom scheduler" use case everything related to the scheduler would have to be under staging, similar to the apiserver. That's a lot of work for something that mostly just works the way it is...

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I was just curious about it, if people is happy with existing workflow and it works for everybody then it is ok

Copy link
Contributor

Choose a reason for hiding this comment

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

cc @alculquicondor wdyt is the preferred pattern here? It seems that the changes proposed by @JesseStutler in this PR are the more common pattern for plugins, but strictly speaking abstracting behind a framework.Plugin seems cleaner (the way the DRA plugin currently looks, which this PR is advocating we change).

Copy link
Member

Choose a reason for hiding this comment

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

According to my experience, most custom schedulers are vendoring default-scheduler for particular plugin's implementation wthin their own framework. So things would get complicated and vague if we move things to staging - where we only place generic APIs for now - it'd be like our goal is to build sth. generic for all scheduler-like components, and users would treat them as backwards-compatible API which would be a wrong assumption.

Current workflow works better IMO - for plugin itself, it'd ok to public them as a contract of SDK level of implementation instead of API. And consumers are responsible to upgrade the SDK along with k8s version upgrade.

@JesseStutler
Copy link
Contributor Author

How will the volcano community handle this with different versions of kubernetes?

I think if you are consuming this as part of a library you would want versioned APIs.

I worry that volcano is going to include a Kubernetes/Kubernetes plus our library packages. I think that may cause some confusion with dependency updates.

How will the volcano community handle this with different versions of kubernetes?
I think if you are consuming this as part of a library you would want versioned APIs.
I worry that volcano is going to include a Kubernetes/Kubernetes plus our library packages. I think that may cause some confusion with dependency updates.

I had communicated with @JesseStutler offline, I suggested that we (in volcano community) adapt this after DRA promoted to beta, because beta is a relatively stable version.

If we want to upgrade dependency versions, we will upgrade kubernetes dependencies and API version dependencies together. I have discussed with @pohly before that there will be no major changes to the API, so it's fine to introduce DRA in 1.31 now. When 1.32 comes, the API upgrade will only change the version from the v1alpha3 version to the beta version, the conversion function of v1alpha3 won't be deleted in 1.32 kube-apiserver right?

We are introducing DRA now as an experimental feature to ask users for more feedback(
There will be a volcano version at the end of the year, using k8s v1.31), so that after we upgrade k8s version to 1.32 early next year, volcano's DRA plugin will also be relatively stable after fixing some bugs.

@JesseStutler
Copy link
Contributor Author

If there are no review opinions, can anyone merge it? Hope it can be carried in v1.32.

@pohly
Copy link
Contributor

pohly commented Oct 31, 2024

/assign @Huang-Wei

@Huang-Wei
Copy link
Member

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Huang-Wei, JesseStutler, 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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 31, 2024
@Huang-Wei
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 31, 2024
@k8s-ci-robot k8s-ci-robot merged commit 223ac36 into kubernetes:master Nov 1, 2024
21 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.32 milestone Nov 1, 2024
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Development

Successfully merging this pull request may close these issues.

9 participants