-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
[code-generator] Breaking gen_client()
function in kube_codegen
script
#121247
Comments
/sig api-machinery |
/cc @thockin |
/triage accepted |
Hi @ary1992 . I knew that there were all sorts of clients out there doing all sorts of things with these scripts, so I am not surprised to find you. :) Do you have a PR which attempts to use kube_codegen, so I can repro your issues directly? |
I think you have one too many Aside from that, the real problem here is that these old codegen tools make some deeeeeeep assumptions about the ability to string-join various arguments and get the right results. It's awful. I was trying to make it simpler in this script, which I did for all of the in-tree consumers, but out of tree people apparently don't always follow the same conventions. For example, we generate clients for every directory that requests it. For a reason I do not know, you have files like If you specify |
So this code expects that you generate an omnibus client. What if I add a flag, like In truth the codegen tools need to be fixed, but that has SO MUCH ripple I just can't right now. |
As the codegen was breaking us at several step, hence didn't prepared the PR. |
Thanks for the PR. kubernetes/staging/src/k8s.io/code-generator/kube_codegen.sh Lines 590 to 594 in 8453eb0
It removes all the generated files first and then calls the |
Why are you generating a client for an internal version that isn't served?
…On Wed, Oct 25, 2023, 2:12 AM Ashish Ranjan Yadav ***@***.***> wrote:
#121411 <#121411>
Thanks for the PR.
I have one more concern, is it possible to call versioned and
internalversion client-gen on the same pkg? With the current script, that
is not possible because of the line
https://github.com/kubernetes/kubernetes/blob/8453eb0c24ea61794157b451e4442ea570abce45/staging/src/k8s.io/code-generator/kube_codegen.sh#L590-L594
It removes all the generated files first and then calls the client-gen.
Hence the later clientset gen will remove the earlier generated clients.
—
Reply to this email directly, view it on GitHub
<#121247 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABKWAVGMR2TAJKX2DJBSL6DYBDJZFAVCNFSM6AAAAAA6BUOBPOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZYHA2DENZUHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
My mistake. We need to stop using clients for internal versions. |
What would you like to be added?
gen_client()
function inkube_codegen
script has following issues:gen_client()
function only supportstypes.go
file https://github.com/kubernetes/code-generator/blob/e4611069dfb4b0c04c7751afae1b9fef64828964/kube_codegen.sh#L539-L544 but we have multiple types file with name astype_*.go
in our repo. Hence this function is not working in our case.For the mitigation there is already an open PR. I have asked for including our changes as well.
types_managedseed.go
andtypes_managedseedset.go
. Because of this--input-dirs github.com/gardener/gardener/pkg/apis/seedmanagement/v1alpha1
forinformer-gen
appears twice and it generates duplicate informersWe only need unique elements before passing it to
informer-gen
. I followed this approach for unique elements:pkg/apis/<package_name>
refer . Earlier we were generating client only forpkg/apis/core
andpkg/apis/seedmanagement
. But with the newkube-codegen
I am not able to do that.I am using the following call to
gen_client
function:It results in following flags to
client-gen
As there is no directory as
github.com/gardener/gardener/pkg/apis/seedmanagement/seedmanagement/v1alpha1
, it doesnot generate anything. Is it still possible to callclient-gen
on specific folder as it was done with earlier scripts?One mitigation I can think of is to call
gen_client
function on wholegithub.com/gardener/gardener/pkg/apis
and then remove the+genclient
marker from the types for which genclient is not needed. But the issue is we won't be able to pass theoutput-pkg-root
flag for each pkg.Why is this needed?
gen_client()
function inkube_codegen
script is not working as expected.The text was updated successfully, but these errors were encountered: