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

DRA: add default claim parameters to resource class #124251

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ravisantoshgudimetla
Copy link
Contributor

@ravisantoshgudimetla ravisantoshgudimetla commented Apr 10, 2024

What type of PR is this?

/kind feature

What this PR does / why we need it:

Add a default parameter reference to the ResourceClass. This should be created by cluster admin while creating resource class.

Which issue(s) this PR fixes:

Fixes #123858

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add a default parameter reference to the ResourceClass. This should be created by cluster admin while creating resource class.

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


@k8s-ci-robot k8s-ci-robot added 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 Apr 10, 2024
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.30 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.30.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Tue Apr 9 19:44:49 UTC 2024.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/code-generation kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Apr 10, 2024
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 Apr 10, 2024
@k8s-triage-robot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@ravisantoshgudimetla ravisantoshgudimetla force-pushed the default-resource-classes branch 2 times, most recently from 479c6d6 to a74c0dc Compare April 10, 2024 05:43
@ravisantoshgudimetla
Copy link
Contributor Author

cc @pohly

@bart0sh
Copy link
Contributor

bart0sh commented Apr 10, 2024

/cc @pohly

@k8s-ci-robot k8s-ci-robot requested a review from pohly April 10, 2024 15:58
@cici37
Copy link
Contributor

cici37 commented Apr 11, 2024

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Apr 11, 2024
// used by the driver as default when allocating a resource associated with this class.
// It is the responsibility of the cluster administrator to create this default resource
// claim parameter reference when defining the resource class. This field is utilized
// when the ParametersRef of the resource class is nil. If both ParametersRef
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// when the ParametersRef of the resource class is nil. If both ParametersRef
// only when the ParametersRef of the resource claim is nil. If both ParametersRef

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.

Can you include the code which uses the new field?

@ravisantoshgudimetla
Copy link
Contributor Author

ravisantoshgudimetla commented Apr 12, 2024

Can you include the code which uses the new field?

You mean the scheduler changes? I'd typically put them in a separate PR to make sure that api folks can review it easily. If you want, I can add them here.

@pohly
Copy link
Contributor

pohly commented Apr 13, 2024

Yes. Please add here in a separate commit. We don't want to end up in a situation where an API change is merged, but then the implementation doesn't work as intended or gets delayed.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 15, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ravisantoshgudimetla
Once this PR has been reviewed and has the lgtm label, please assign smarterclayton for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 sig/node Categorizes an issue or PR as relevant to SIG Node. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. labels Apr 15, 2024
},
},
}
if claim.Spec.ParametersRef == nil && class.DefaultClaimParametersRef == nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pohly - Are these 2 the only cases that we should be concerned about? Let me know if I'm missing something.

},
}
if claim.Spec.ParametersRef == nil && class.DefaultClaimParametersRef == nil {
return nil, statusError(logger, fmt.Errorf("error allocating claim, either claim's parameter reference or default parameters for resourceclass need to be set"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and also should we return statusError or statusUnScheduleable?

Copy link
Contributor

Choose a reason for hiding this comment

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

statusUnscheduleable - the pod is permanently unschedulable until claim or class are changed or the parameters are created. The plugin reacts to cluster events for that, so there is no need for periodic retries, which is what statusError implies.

return nil, statusError(logger, fmt.Errorf("error allocating claim, either claim's parameter reference or default parameters for resourceclass need to be set"))
}
if claim.Spec.ParametersRef == nil && class.DefaultClaimParametersRef != nil {
// Get the resource class's default parameter and use it
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: missing dot at end of sentence.

}
return nil, statusError(logger, fmt.Errorf("get claim parameters %s: %v", klog.KRef(class.Namespace, class.DefaultClaimParametersRef.Name), err))
}
return parameters, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the exact same code as below. Can you move it into a helper method?

},
}
if claim.Spec.ParametersRef == nil && class.DefaultClaimParametersRef == nil {
return nil, statusError(logger, fmt.Errorf("error allocating claim, either claim's parameter reference or default parameters for resourceclass need to be set"))
Copy link
Contributor

Choose a reason for hiding this comment

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

statusUnscheduleable - the pod is permanently unschedulable until claim or class are changed or the parameters are created. The plugin reacts to cluster events for that, so there is no need for periodic retries, which is what statusError implies.

@pohly
Copy link
Contributor

pohly commented Apr 16, 2024

/retitle DRA: add default claim parameters to resource class

@k8s-ci-robot k8s-ci-robot changed the title Default resource classes DRA: add default claim parameters to resource class Apr 16, 2024
@bart0sh
Copy link
Contributor

bart0sh commented Apr 17, 2024

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 17, 2024
@bart0sh bart0sh moved this from Triage to Needs Reviewer in SIG Node PR Triage Apr 17, 2024
@ravisantoshgudimetla
Copy link
Contributor Author

/test pull-kubernetes-unit

@pohly
Copy link
Contributor

pohly commented Apr 22, 2024

There's a known data race in the dynamicresources unit test, fix is in #124409

@pohly
Copy link
Contributor

pohly commented Apr 22, 2024

/retest

1 similar comment
@pohly
Copy link
Contributor

pohly commented Apr 22, 2024

/retest

@k8s-ci-robot
Copy link
Contributor

@ravisantoshgudimetla: 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-kubernetes-unit 5af32c8 link true /test pull-kubernetes-unit

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@pohly
Copy link
Contributor

pohly commented Apr 22, 2024

@ravisantoshgudimetla: Ignore the retests... the unit test failure is genuine and seems related to changes in this PR.

@pohly
Copy link
Contributor

pohly commented Apr 29, 2024

/hold

We need to decide what the desired semantic is for this new field. See kubernetes/enhancements#4585 (comment).

Once that KEP update is merged, we can update this PR accordingly (API wording, functionality).

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 29, 2024
@ravisantoshgudimetla
Copy link
Contributor Author

@pohly - Just catching up on this after coming from break, so the consensus seems to be kubernetes/enhancements#4585 (comment), which means, there will be no allocation when neither claim not class exists, so this PR can continue?

@pohly
Copy link
Contributor

pohly commented May 27, 2024

There are more API changes coming: kubernetes-sigs/wg-device-management#14

We might not have a ResourceClass that gets referenced by a ResourceClaim - let's wait for that decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/code-generation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/auth Categorizes an issue or PR as relevant to SIG Auth. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: In Review
Status: Needs Reviewer
Status: 👀 In review
SIG Node PR Triage
Needs Reviewer
Development

Successfully merging this pull request may close these issues.

DRA: structured parameters: handling of claim without claim parameters
7 participants