-
Notifications
You must be signed in to change notification settings - Fork 41.9k
Ensure metricIdentifier uses scheme for kind resolution #135714
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
base: master
Are you sure you want to change the base?
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: Thu Dec 11 03:43:56 UTC 2025. |
|
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. |
|
/sig api-machinery |
|
/assign @jpbetz |
The metricIdentifier function in pkg/registry/rest/validate.go has been updated to consistently use for determining the resource kind. This change ensures that the identifier is derived from the scheme, which is the authoritative source for API type information. Corresponding unit tests in pkg/registry/rest/validate_test.go have been updated to align with this new behavior, explicitly passing the scheme in test cases where kind resolution is expected and verifying the correct unknown_resource fallback when the scheme or object is not sufficient to determine the kind.
13d4aec to
391045e
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lalitc375 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it
This PR refactors the
metricIdentifierfunction inpkg/registry/rest/validate.goto reliably determine the resource kind by using the scheme. This is necessary because the previous implementation, which relied onobj.GetObjectKind().GroupVersionKind(), could be unreliable for internal objects where the API version and kind are not always populated on the object itself. The scheme, however, is the authoritative source for this information.This change ensures that we can accurately identify the resource kind, which is crucial for the correctness of our validation metrics.
This PR addresses this by:
*runtime.Schemeto themetricIdentifierfunction.scheme.ObjectKinds(obj)to reliably determine the kind of the object.The unit tests in
pkg/registry/rest/validate_test.gohave been updated to reflect this change.Fixes
This PR fixes the following validation discrepancies by ensuring the resource kind is correctly identified:
Special notes for your reviewer
None
Does this PR introduce a user-facing change?