-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Can't generate client and protobuf code simultaneously for API groups with dots in their name #25860
Comments
cc @caesarxuchao @smarterclayton for client-gen and protobuf namer, respectively |
Do you need dots in your package name? |
@smarterclayton "rbac.authorization" or some to that affect was preferred per discussion in #23396, and #24900 but it's not an implementation requirement. Would be happy to change the API group name if others are okay with that. cc @erictune @liggitt @deads2k edit: to be clearer I'd actually prefer this route so we can continue with #25634 |
Can we just do "rbac"? Nothing in the code requires the package name to == On Thu, May 19, 2016 at 5:05 PM, Eric Chiang notifications@github.com
|
Updating #25634 to rename the api group to "rbac". Will close this issue if there's no push back on that thread. |
No push back. Closing for now. |
It nests under the existing |
Ah, I see. Not renaming the API group, just the package. |
Sorry, should have been clearer.
|
the group got renamed in https://github.com/kubernetes/kubernetes/pull/25634/files#diff-7e3f9c25e85c04b5583c2a61d4adf58eL25 I'd prefer the qualified group name, even if it means the package doesn't match |
Yes, please use the qualified group name, but the short package name. Sorry for the confusion. On Fri, May 20, 2016 at 10:23 AM, Jordan Liggitt notifications@github.com
|
Sorry if I wasn't clear in my initial comment but the bug is, but the TL;DR is:
The existing "authentication.k8s.io" group doesn't generate clients or protobufs, so it never saw this problem. The other API groups added during this release cycle, "app" and "policy" didn't either because they don't have a dot in their names. |
So we can't use the qualified group name at the moment. EDIT: I also don't have permission to re-open this issue. |
Ok, the first one is a definite bug. The second one was what I think is an Group names are APIs, so we can't change group name after creation, so if On May 20, 2016, at 1:17 PM, Eric Chiang notifications@github.com wrote: Sorry if I wasn't clear in my initial comment but the bug is, but the TL;DR
The existing "authentication.k8s.io" group doesn't generate clients or — |
I don't want to demand a user to specify a |
Why not just read it from a comment on the package doc? On May 20, 2016, at 3:22 PM, Chao Xu notifications@github.com wrote: I don't want to demand a user to specify a const GroupName to be able to — |
Package names aren't special, we shouldn't assume they are. On May 20, 2016, at 3:22 PM, Chao Xu notifications@github.com wrote: I don't want to demand a user to specify a const GroupName to be able to — |
If it's so hard to fix this from the protobuf side, I can let client-gen use the We should make a rule on how to name the directories under |
I'm more concerned that right now we're focused on enabling proto across On Fri, May 20, 2016 at 4:15 PM, Chao Xu notifications@github.com wrote:
|
This was fixed in #25634 by adding a logic to client generate which detect a doc.go comment. That comment is used at the actual group name instead of the directory name.
Directory names are still expected to not have a dot in them. Example here: kubernetes/pkg/apis/rbac/doc.go Line 17 in 294e49f
|
Protobuf has pretty strict rules on what sorts of names can be in package definitions (basically If we put all the protos in one place, it'll probably be something like |
am probably hitting this issue 3 three years later from the discussion.. i was trying to generate protobuf codes from a repo under
from the error, i think the generator is somehow mixing up |
In #25634 I'm trying to add an API group called "rbac.authorization.k8s.io" which currently lives in the directory "pkg/apis/rbac"
Unfortunately, client generation with go2idl creates the file pkg/client/clientset_generated/internalclientset/typed/rbac/unversioned/rbac_client.go which has a snippet that looks like this:
The string "rbac" is wrong since the group's name is "rbac.authorization.k8s.io". However changing it manually causes "hack/verify-codegen.sh" to fail.
To deal with this I moved the directory from "pkg/apis/rbac" to "pkg/apis/rbac.authorization.k8s.io" so go2idl generates the correct string.
Now protobuf generation fails with a lot of error messages that look like this:
From what I can tell, it's currently impossible to correctly generate assets for API groups which require client generation, if that group name has a dot in it.
Is there anything I can do to fix the protobuf or go2idl generation?
cc @erictune @sym3tri @gtank
The text was updated successfully, but these errors were encountered: