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

🐛 Fix HasResource pkg method to properly stop when a match is found #4190

Merged

Conversation

camilamacedo86
Copy link
Member

  • Updated the HasResource method to correctly stop the iteration when a matching GVK is found.
  • Replaced the immediate return inside the loop with a boolean flag and a break statement to ensure the function exits early when a resource is found.
  • This resolves the issue where the method was not stopping as expected after finding a matching resource

PS.: This issue was found when I was implementing the e2e tests for generate alpha command: #4181

- Updated the HasResource method to correctly stop the iteration when a matching GVK is found.
- Replaced the immediate return inside the loop with a boolean flag  and a break statement to ensure the function exits early when a resource is found.
- This resolves the issue where the method was not stopping as expected after finding a matching resource
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 23, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: camilamacedo86

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/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 23, 2024
Copy link
Member Author

@camilamacedo86 camilamacedo86 left a comment

Choose a reason for hiding this comment

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

I am moving forward since it is small fix and is blocking other changes
We have a lot of PRs which we really need help on reviews.
So, I will not make nobody waste the time here.

@camilamacedo86 camilamacedo86 added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 23, 2024
@camilamacedo86 camilamacedo86 merged commit c810d8d into kubernetes-sigs:master Sep 23, 2024
14 of 17 checks passed
@camilamacedo86 camilamacedo86 deleted the fix-has-resource branch September 23, 2024 07:31
TAM360 pushed a commit to TAM360/kubebuilder that referenced this pull request Sep 26, 2024
…ubernetes-sigs#4190)

Fix HasResource method to properly stop when a match is found

- Updated the HasResource method to correctly stop the iteration when a matching GVK is found.
- Replaced the immediate return inside the loop with a boolean flag  and a break statement to ensure the function exits early when a resource is found.
- This resolves the issue where the method was not stopping as expected after finding a matching resource
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants