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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃尡 Simplify cache.objectTypeForListObject #2131

Merged

Conversation

vincepri
Copy link
Member

This changeset streamlines and simplifies the logic inside objectTypeForListObject. This method is used to retrieve from a List object, its respective actual resource GVK and a new instance of the object.

In the previous iteration, the use of reflection was complicated to follow and looking at the fields in the struct passed in, instead of using the information we already have in the Scheme to create a new instance of the expected object and return.

In addition to all of the above, we're also now handling PartialObjectMetadataList(s).

Signed-off-by: Vince Prignano vincepri@redhat.com

This changeset streamlines and simplifies the logic inside
objectTypeForListObject. This method is used to retrieve from a List
object, its respective actual resource GVK and a new instance of the
object.

In the previous iteration, the use of reflection was complicated to
follow and looking at the fields in the struct passed in, instead of
using the information we already have in the Scheme to create a new
instance of the expected object and return.

In addition to all of the above, we're also now handling
PartialObjectMetadataList(s).

Signed-off-by: Vince Prignano <vincepri@redhat.com>
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 17, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 17, 2023
Copy link
Member Author

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/assign @sbueringer

@sbueringer
Copy link
Member

sbueringer commented Jan 17, 2023

Looks good

/lgtm

Sometimes wonder if a bit more error wrapping could be beneficial (but the new code fits into the current style that we have in this regard)

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 17, 2023
@k8s-ci-robot k8s-ci-robot merged commit 319c422 into kubernetes-sigs:master Jan 17, 2023
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants