-
Notifications
You must be signed in to change notification settings - Fork 366
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
Add missing metav1.ObjectMeta to NetworkPolicyEvaluation API type #6675
Add missing metav1.ObjectMeta to NetworkPolicyEvaluation API type #6675
Conversation
It seems that omitting the field was a mistake when defining the API. New versions of the K8s code generators (client-gen specifically) will not work with types missing this field. See kubernetes/code-generator@688a73a This is preventing us from updating to a more recent version of the K8s libraries and of the code generators. Note that I believe that this API was modeled after the upstream TokenReview API (which like this one only supports the "create" verb, and returns a response immediately). The TokenReview type does include a metav1.ObjectMeta field. Unfortunately, for backwards-compatibility, we need to use Protobuf field number 3 for the metadata field, while K8s always uses 1. This is a bit surprising, but it should only affect the wire format, and nothing else. Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
Thanks for catching this issue. LGTM except that codegen seemingly needs update |
Thanks! Codegen test +1 |
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
/test-all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one minor comment
Request *NetworkPolicyEvaluationRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"` | ||
Response *NetworkPolicyEvaluationResponse `json:"response,omitempty" protobuf:"bytes,2,opt,name=response"` | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,3,opt,name=metadata"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a comment inline why this is 3 to avoid it to be “corrected” by accident?
Could this be fixed when we introduce a new version for NetworkPolicyEvaluation API? I suppose yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Could this be fixed when we introduce a new version for NetworkPolicyEvaluation API? I suppose yes.
Yes I also believe that this can be fixed in a future version, without any negative impact. Protobuf message types are completely independent across versions.
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Antonin Bas <antonin.bas@broadcom.com>
/test-all |
It seems that omitting the field was a mistake when defining the API. New versions of the K8s code generators (client-gen specifically) will not work with types missing this field.
See kubernetes/code-generator@688a73a.
This is preventing us from updating to a more recent version of the K8s libraries and of the code generators.
Note that I believe that this API was modeled after the upstream TokenReview API (which like this one only supports the "create" verb, and returns a response immediately). The TokenReview type does include a metav1.ObjectMeta field.
Unfortunately, for backwards-compatibility, we need to use Protobuf field number 3 for the metadata field, while K8s always uses 1. This is a bit surprising, but it should only affect the wire format, and nothing else.