-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
base: master
Are you sure you want to change the base?
DRA: add default claim parameters to resource class #124251
Conversation
Please note that we're already in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Tue Apr 9 19:44:49 UTC 2024. |
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. |
479c6d6
to
a74c0dc
Compare
cc @pohly |
/cc @pohly |
/remove-sig api-machinery |
pkg/apis/resource/types.go
Outdated
// 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 |
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.
// 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 |
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.
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. |
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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ravisantoshgudimetla 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 |
}, | ||
}, | ||
} | ||
if claim.Spec.ParametersRef == nil && class.DefaultClaimParametersRef == nil { |
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.
@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")) |
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.
and also should we return statusError or statusUnScheduleable?
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.
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 |
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.
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 |
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 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")) |
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.
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.
/retitle DRA: add default claim parameters to resource class |
/triage accepted |
/test pull-kubernetes-unit |
There's a known data race in the dynamicresources unit test, fix is in #124409 |
/retest |
1 similar comment
/retest |
@ravisantoshgudimetla: The following test failed, say
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. |
@ravisantoshgudimetla: Ignore the retests... the unit test failure is genuine and seems related to changes in this PR. |
/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). |
@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? |
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. |
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: