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

🐛 Populate GVK for listed objects #296

Closed
wants to merge 2 commits into from

Conversation

liyinan926
Copy link
Contributor

Fixes #284. Populates GroupVersionKind for objects returned by the List method.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 16, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: liyinan926
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: directxman12

If they are not already assigned, you can assign the PR to them by writing /assign @directxman12 in a comment when ready.

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 the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 16, 2019
Copy link

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

test change, otherwise looks good

Expect(listObj.Items).NotTo(BeEmpty())
Expect(listObj.Items).Should(HaveLen(3))
for _, p := range listObj.Items {
Expect(p.GroupVersionKind().Empty()).To(BeFalse())
Copy link
Contributor

Choose a reason for hiding this comment

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

this should test that we list the right gvk (the corev1 package should have the package group-version as a package-level variable)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@liyinan926
Copy link
Contributor Author

Is this good to merge now?

Copy link
Contributor

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

minor nit

for _, p := range listObj.Items {
Expect(p.GroupVersionKind().Group).To(Equal(kcorev1.SchemeGroupVersion.Group))
Expect(p.GroupVersionKind().Version).To(Equal(kcorev1.SchemeGroupVersion.Version))
Expect(p.GroupVersionKind().Kind).To(Equal("Pod"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Expect(p.GroupVersionKind()).To(Equal(kcorev1.SchemeGroupVersion.WithKind("Pod")))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@DirectXMan12
Copy link
Contributor

Looks good. Please squash the commits into logical commits (i.e. no "address comments" commits), and I'll merge.

@shawn-hurley
Copy link

@liyinan926 think you could rebase this pr?

@DirectXMan12 DirectXMan12 added this to the 0.2.0 milestone Feb 27, 2019
@shawn-hurley
Copy link

@liyinan926 do you think that you can rebase this PR?

@JoelSpeed
Copy link
Contributor

Just run into this issue, @liyinan926 have you time to fix the conflicts and rebase the PR? Happy to pick this up if you don't

@JoelSpeed
Copy link
Contributor

This is blocking me on a project so I've rebased the branch so that I can continue, let me know if you'd like me to open a PR to superseed this one https://github.com/pusher/controller-runtime/tree/list-gvk

I found an issue with the tests in which the length of the list can be three or four depending on which cache type we are using. For now I've added a SatisfyAny(HaveLen(3), HaveLen(4)) to the matcher, any ideas for a better way to fix this?

@JoelSpeed
Copy link
Contributor

I've also just had to push a change to DeepCopyObject() the objects before fixing their GVKs as it was setting off the race detector in my tests, looks like listing stopped deep copying at some point recently?

@DirectXMan12
Copy link
Contributor

@JoelSpeed go ahead and pick this up, and just credit @liyinan926 / keep them as an author on the commit.

@JoelSpeed
Copy link
Contributor

@DirectXMan12 / @liyinan926 I've opened #389 from my branch keeping original commit authorship to credit @liyinan926

@droot
Copy link
Contributor

droot commented May 16, 2019

closing this since these changes by pull in a separate PR #389

@droot droot closed this May 16, 2019
DirectXMan12 pushed a commit that referenced this pull request Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MapObject.Object contains empty GroupVersionKind
6 participants