api icon indicating copy to clipboard operation
api copied to clipboard

gogo/protobuf -> golang/protobuf breaks api embeddings due to missing JSON tags

Open rahulanand16nov opened this issue 3 years ago • 2 comments

I am currently working with AuthorizationPolicy and use Rule struct in one of our CRDs but with the last update of protobuf library, it has included a few fields without JSON tags that cause issues with controller-gen when creating manifests.

/home/rahul/kuadrant-controller/bin/controller-gen rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:439:2: encountered struct field "state" without JSON tag in type "Rule"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:440:2: encountered struct field "sizeCache" without JSON tag in type "Rule"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:441:2: encountered struct field "unknownFields" without JSON tag in type "Rule"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:927:2: encountered struct field "state" without JSON tag in type "Rule_From"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:928:2: encountered struct field "sizeCache" without JSON tag in type "Rule_From"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:929:2: encountered struct field "unknownFields" without JSON tag in type "Rule_From"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:522:2: encountered struct field "state" without JSON tag in type "Source"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:523:2: encountered struct field "sizeCache" without JSON tag in type "Source"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:524:2: encountered struct field "unknownFields" without JSON tag in type "Source"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:976:2: encountered struct field "state" without JSON tag in type "Rule_To"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:977:2: encountered struct field "sizeCache" without JSON tag in type "Rule_To"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:978:2: encountered struct field "unknownFields" without JSON tag in type "Rule_To"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:683:2: encountered struct field "state" without JSON tag in type "Operation"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:684:2: encountered struct field "sizeCache" without JSON tag in type "Operation"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:685:2: encountered struct field "unknownFields" without JSON tag in type "Operation"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:808:2: encountered struct field "state" without JSON tag in type "Condition"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:809:2: encountered struct field "sizeCache" without JSON tag in type "Condition"
/home/rahul/go/pkg/mod/istio.io/[email protected]/security/v1beta1/authorization_policy.pb.go:810:2: encountered struct field "unknownFields" without JSON tag in type "Condition"
Error: not all generators ran successfully

Any solution for this?

rahulanand16nov avatar May 17 '22 13:05 rahulanand16nov

https://github.com/kubernetes-sigs/controller-tools/pull/584#issuecomment-940459870 seems to allow ignoring them

howardjohn avatar May 17 '22 13:05 howardjohn

Looks like it was merged on Jan 31st and the last release was on Jan 8th so maybe that's why I wasn't able to get it to work.

rahulanand16nov avatar May 17 '22 14:05 rahulanand16nov

Seems like based on the above this is fixed upstream

howardjohn avatar May 14 '24 22:05 howardjohn