Skip to content

Integrate groupVersion info into proto.package. #14

@dilyevsky

Description

@dilyevsky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions