Skip to content

Conversation

@troy0820
Copy link
Member

Resolves #3347

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 13, 2025
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 13, 2025
@troy0820 troy0820 changed the title ⚠ Update List in namespaced client to list objects that are cluster scoped 🐛 Update List in namespaced client to list objects that are cluster scoped Oct 13, 2025
@troy0820
Copy link
Member Author

I can add a test for this

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 13, 2025
@troy0820 troy0820 force-pushed the troy0820/namespaced-client branch 2 times, most recently from 7bd96c1 to f5174cf Compare October 13, 2025 17:12
Signed-off-by: Troy Connor <troy0820@users.noreply.github.com>
@troy0820 troy0820 force-pushed the troy0820/namespaced-client branch from f5174cf to 3153d31 Compare October 13, 2025 17:18
@troy0820
Copy link
Member Author

/test pull-controller-runtime-test

Copy link
Member

@alvaroaleman alvaroaleman left a comment

Choose a reason for hiding this comment

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

thanks!

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, troy0820

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
Copy link
Contributor

LGTM label has been added.

Git tree hash: f68e39039b0c1886ac02565ab8637e2a44b0e174

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 13, 2025
result := &corev1.NodeList{}
opts := &client.ListOptions{}
Expect(getClient().List(ctx, result, opts)).NotTo(HaveOccurred())
Expect(result.Items).NotTo(BeEmpty())
Copy link
Member

Choose a reason for hiding this comment

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

Will this work? We are not creating a node in the beforeEach or did I miss it?

Copy link
Member Author

Choose a reason for hiding this comment

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

We are not creating a node but a node exist? I am making the assumption but when tested it showed that the node exists when querying the result.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had to change it from len(result.Items) to EXPECT(result.Items) to not be Empty when that gave me 9. The test passes showing that the nodelist is not empty.

Copy link
Member

@sbueringer sbueringer Oct 13, 2025

Choose a reason for hiding this comment

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

Hm. This seems to fail on my Machine somehow (at least when run with Intellij)? Which Nodes do you get?

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible the node object(s) get created by other tests running in parallel using the same client? That would both explain the flaking and the inability to use len.

Sorry, I missed this before approving

Copy link
Member

Choose a reason for hiding this comment

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

Probably. We could also simply make this case self-contained by creating a Node with some namespaced prefix

Copy link
Member Author

Choose a reason for hiding this comment

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

The flakiness of this is unfortunate because I made the assumption that because the node is there, it is always there. We can contain it by creating a node in the Before Spec if that helps with the testing suite.

Copy link
Member Author

Choose a reason for hiding this comment

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

#3353 <-- Follow up for updating the test.

@k8s-ci-robot k8s-ci-robot merged commit cddb2d9 into kubernetes-sigs:main Oct 13, 2025
10 checks passed
@troy0820
Copy link
Member Author

/cherry-pick release-0.22

@k8s-infra-cherrypick-robot

@troy0820: new pull request created: #3352

In response to this:

/cherry-pick release-0.22

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.

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

Namespaced Client unable to List non-namespaced objects

5 participants