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

Using skycfg with proto.Any #45

Closed
michaelkipper opened this issue Feb 19, 2019 · 1 comment
Closed

Using skycfg with proto.Any #45

michaelkipper opened this issue Feb 19, 2019 · 1 comment

Comments

@michaelkipper
Copy link

Related to #14, the generated.proto files in the Kubernetes API contain the metadata. (E.g.: https://github.com/kubernetes/api/blob/master/apps/v1/generated.proto#L221-L233)

Some hackery can extract the GroupVersionKind from the message type, which sucks but is maintainable.

But other Kubernetes resources (e.g. the Istio VirtualService @ https://github.com/istio/api/blob/master/networking/v1alpha3/virtual_service.proto#L119) don't have the ObjectMeta embedded. They rely on other constructs like client-gen to generate the Go struct but never generate the full protobuf message (E.g.: https://github.com/michaelkipper/istio-client-go/blob/master/pkg/apis/networking/v1alpha3/virtual_service.go#L33-L38)

One thought I had was to generate my own Protobuf wrapper:

message KubernetesWrapper {
  string APIVersion = 1 [json_name="apiVersion"];
  string Kind = 2 [json_name="kind"];
  k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta ObjectMeta = 3 [json_name="metadata"];
  google.protobuf.Any Spec = 4 [json_name="spec"];
}

That way we could localize the hackery in our .skylib files, rather than in the parser.

The question is, how do we get skycfg to process the google.protobuf.Any message?
Happy to contribute this upstream, if someone can help out with the design.

@jmillikin-stripe
Copy link
Contributor

Closing: support for google.protobuf.Any was implemented in PR #83

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