-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Ensure all response object modification happens in one place #71542
Ensure all response object modification happens in one place #71542
Conversation
Make setLink and setListLink the same, and make them happen in transformResponseObject. Make those methods also responsible for ensuring an empty list. Then move outputMediaType negotiation before all other calls in the specific methods, to ensure we fail fast. Refactoring in preparation to support type conversion on watch.
/assign @liggitt |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton 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 |
Prepare to support watch by cleaning up the conversion method and splitting out each transition into a smaller method.
/retest |
/cc @mbohlool |
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
|
||
func asV1Beta1PartialObjectMetadata(result runtime.Object) (runtime.Object, error) { | ||
if meta.IsListType(result) { | ||
// TODO: this should be calculated earlier |
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.
Is this TODO still valid?
case target.Kind == "Table" && target.GroupVersion() == metav1beta1.SchemeGroupVersion: | ||
// TODO: relax the version abstraction | ||
// TODO: skip if this is a status response (delete without body)? | ||
if err := writeMetaInternalVersion(partial, statusCode, w, req, &scope, target.GroupVersion()); err != 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.
updateScopeForTransform
in #71548 is cleaner than writeMetaInternalVersion
. It's ok as long as we don't get stuck in this intermediate state.
/retest Review the full test history for this PR. Silence the bot with an |
Make setLink and setListLink the same, and make them happen in transformResponseObject.
Make those methods also responsible for ensuring an empty list. Then move outputMediaType
negotiation before all other calls in the specific methods, to ensure we fail fast.
Refactoring in preparation to support type conversion on watch.
/kind cleanup