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

🐛 Fakeclient: Allow manipulating registered types through unstructured #1662

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

alvaroaleman
Copy link
Member

Currently, manipulating an object that is registered through
unstructured will break all subsequent List requests that include said
object. This happens because the tracker unconditionally saves objects but
it's List() assumes that what it finds can be assigned to the .Items slice
of an object produced through scheme.New(ListGVK).

Fixes #1511

/assign @vincepri @joelanford

Currently, manipulating an object that is registered through
unstructured will break all subsequent List requests that include said
object. This happens because the tracker unconditionally saves objects but
it's List() assumes that what it finds can be assigned to the .Items slice
of an object produced through scheme.New(ListGVK).
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 11, 2021
@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 Sep 11, 2021
@joelanford
Copy link
Member

/approve

@alvaroaleman
Copy link
Member Author

@joelanford was it intended to not lgtm the change and only approve?

Copy link
Member

@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.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 14, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, joelanford, 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:
  • OWNERS [alvaroaleman,joelanford,vincepri]

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 merged commit f20692b into kubernetes-sigs:master Sep 14, 2021
@k8s-ci-robot k8s-ci-robot added this to the v0.10.x milestone Sep 14, 2021
l-qing added a commit to katanomi/pkg that referenced this pull request Jan 5, 2022
This logic can be removed after upgrading to controller-runtime v0.10.1
Ref: kubernetes-sigs/controller-runtime#1662
l-qing added a commit to katanomi/pkg that referenced this pull request Jan 5, 2022
This logic can be removed after upgrading to controller-runtime v0.10.1
Ref: kubernetes-sigs/controller-runtime#1662

Co-authored-by: qingliu <qingliu@alauda.io>
@nathaniel-lehrer-ib
Copy link

Hello, thanks for the fix :) I need to upgrade my packages to get this fix -- which version/package is this fixed in? I'm currently using:

	k8s.io/api v0.21.4
	k8s.io/apimachinery v0.21.4
	k8s.io/client-go v0.21.4

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.

fakeClient.List tries to populate UnstructuredList with objects of underlying type
5 participants