Skip to content

Conversation

@carmal891
Copy link
Contributor

What type of PR is this?
/kind bug

What this PR does / why we need it:
This PR fixes an issue where make generate doesn't properly clean up generated client files before regeneration, causing leftover files to accumulate and potentially cause linter errors. The fix adds targeted cleanup of generated client directories

  • pkg/client/clientset/
  • pkg/client/listers/
  • pkg/client/informers/

before running the code generation tools.

Which issue(s) this PR fixes:

Fixes #4077

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 11, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @carmal891!

It looks like this is your first PR to kubernetes-sigs/gateway-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 11, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @carmal891. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@carmal891
Copy link
Contributor Author

This WIP PR may require adjustments based on the discussion in #4077. Will update from draft status once the approach is finalized.

@rikatz
Copy link
Member

rikatz commented Sep 12, 2025

/cc @candita

all: generate vet fmt verify test

.PHONY: clean-generated
clean-generated:
Copy link
Member

Choose a reason for hiding this comment

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

question for others: do we care about cleaning also "config/crd/{standard|experimental} ? Also, there is a "kustomization.yaml" file inside it, we should either re-generate it based on the CRDs we are generating.

I think we can do this as a followup, but as the generation is part of update-codegen (running pkg/generator), and probably would be good to also keep a consistency of the current API.

As an example, once we decide to promote ListenerSet, it will become a different API (ListenerSet vs XListenerSet) and a different CRD, but by the current approach the old XListenerSet CRD manifest will stick there until someone cleans it

Copy link
Contributor

Choose a reason for hiding this comment

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

We will need to leave the existing XListenerSet around for some time for backward compatibility, and we haven't actually defined how the transition out of the experimental API group will work yet - it could be that we will leave XListenerSet around to be a place to prototype new things, unsure as yet.

So, I think it's better to make cleanup for that in particular require a definite action from a person.

clean-generated:
rm -rf pkg/client/clientset
rm -rf pkg/client/listers
rm -rf pkg/client/informers
Copy link
Member

Choose a reason for hiding this comment

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

you may also want to add "applyconfiguration" directory

Copy link
Contributor Author

@carmal891 carmal891 Sep 12, 2025

Choose a reason for hiding this comment

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

@rikatz Regarding apply configuration, I intentionally ignored the dir as I had observed a bug which I wanted to clarify. More details mentioned here :
#4077 (comment) in the Additional Finding section . Kindly help to clarify

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rikatz Please note as per discussion with @candita here, I have raised a separate issue(bug) for the applyconfiguration cleanup

@rikatz
Copy link
Member

rikatz commented Sep 12, 2025

/ok-to-test
/triage accepted

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 12, 2025
@carmal891 carmal891 marked this pull request as ready for review September 18, 2025 05:26
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 18, 2025
@carmal891 carmal891 requested a review from rikatz September 18, 2025 05:27
Copy link
Member

@rikatz rikatz left a comment

Choose a reason for hiding this comment

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

/lgtm
Thank you!

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

Hi @candita,
This PR has already received LGTM but is pending one final approval for merging. Would you mind reviewing it when convenient?

@rikatz
Copy link
Member

rikatz commented Sep 23, 2025

@carmal891 it needs now some project maintainer to approve it

@carmal891
Copy link
Contributor Author

@robscott @youngnick @mlavacca This PR has received LGTM but is pending maintainer approval for merging. Could you help review the same when convenient ?. Thanks

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 26, 2025
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @carmal891!


all: generate vet fmt verify test

.PHONY: clean-generated
Copy link
Member

Choose a reason for hiding this comment

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

This is great @carmal891! This would be very helpful to include in https://gateway-api.sigs.k8s.io/contributing/devguide/ as well if you can find the time.

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

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carmal891, rikatz, robscott

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2025
@carmal891
Copy link
Contributor Author

@rikatz @candita Although there are 2 approvals, I can see the LGTM label seems to have been removed after I rebased the branch. Could you assist here ?

@rikatz
Copy link
Member

rikatz commented Sep 29, 2025

@carmal891 please look at Rob's comment on your code :)

I was waiting you to send the update to the docs as well, to do another review

Thanks!

@rikatz
Copy link
Member

rikatz commented Sep 29, 2025

IMO it is fine, we don't have all of the Makefile targets documented.

@robscott I think we are good?

@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 Sep 29, 2025
@rikatz
Copy link
Member

rikatz commented Sep 29, 2025

/lgtm
Thank you!

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

@rikatz @robscott I initially thought the command didn’t need to be highlighted explicitly. But looking at it again, I felt it’s worth pointing out that make also cleans up previously generated code, which wasn’t mentioned earlier. :)
So slightly rephrased Build the code section in the dev-guide

@k8s-ci-robot k8s-ci-robot merged commit 530c1ee into kubernetes-sigs:main Sep 29, 2025
8 checks passed
tylerauerbeck pushed a commit to tylerauerbeck/gateway-api that referenced this pull request Nov 27, 2025
…etes-sigs#4082)

* Adds a clean-generated target to remove stale generated files

* Update the docs for make generate
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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need to manually delete generated files before running make generate

5 participants