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

Integrate groupVersion info into proto.package. #14

Open
dilyevsky opened this issue Nov 27, 2018 · 2 comments
Open

Integrate groupVersion info into proto.package. #14

dilyevsky opened this issue Nov 27, 2018 · 2 comments

Comments

@dilyevsky
Copy link
Contributor

dilyevsky commented Nov 27, 2018

So I tried to write more involved Kubernetes definitions using similar code in

func gvkFromMsgType(m proto.Message) (group, version, kind string, err error) {
t := gogo_proto.MessageName(m)
if !strings.HasPrefix(t, k8sAPIPrefix) {
err = errors.New("unexpected message type: " + t)
return
}
ss := strings.Split(t[len(k8sAPIPrefix):], ".")
if ss[0] == "core" { // Is there a better way?
ss[0] = ""
}
group, version, kind = ss[0], ss[1], ss[2]
return
}
and it appears to be failing spectacularly for apiGroups like rbac.authorization.k8s.io and so on because authorization.k8s.io part is not actually encoded anywhere in generated proto packages.

I'm thinking to pass this via proto.package (perhaps, proto.k8s_package) import definitions instead via additional argument and store groupVersion info inside skyProtoMessage.

Opening as issue first to discuss since this implies an api change.

@jmillikin-stripe
Copy link
Contributor

I don't think we want to add Kubernetes API group directly into the protobuf handling, but it might be worth adding a skycfg/kubernetes package to hold all this k8s-specific magic. Given how irregular the Kubernetes API group names are, it might require a hardcoded lookup table to fully implement gvkFromMsgType().

@dilyevsky
Copy link
Contributor Author

I don't think we want to add Kubernetes API group directly into the protobuf handling, but it might be worth adding a skycfg/kubernetes package to hold all this k8s-specific magic

👍 I'll sketch out some interfaces and send a wip pr.

Given how irregular the Kubernetes API group names are, it might require a hardcoded lookup table...

This is basically what I'm trying to avoid by having the user do all the hardcoding =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants