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

Add missing metav1.ObjectMeta to NetworkPolicyEvaluation API type #6675

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ type NetworkPolicyNodeStatus struct {
// NetworkPolicyEvaluation contains the request and response for a NetworkPolicy evaluation.
type NetworkPolicyEvaluation struct {
metav1.TypeMeta
metav1.ObjectMeta
Request *NetworkPolicyEvaluationRequest
Response *NetworkPolicyEvaluationResponse
}
Expand Down
430 changes: 238 additions & 192 deletions pkg/apis/controlplane/v1beta2/generated.pb.go

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions pkg/apis/controlplane/v1beta2/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions pkg/apis/controlplane/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,16 @@ type NetworkPolicyNodeStatus struct {
// NetworkPolicyEvaluation contains the request and response for a NetworkPolicy evaluation.
type NetworkPolicyEvaluation struct {
metav1.TypeMeta `json:",inline"`
Request *NetworkPolicyEvaluationRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"`
Response *NetworkPolicyEvaluationResponse `json:"response,omitempty" protobuf:"bytes,2,opt,name=response"`
// ObjectMeta was omitted by mistake when this type was first defined, and was added later on.
// To ensure backwards-compatibility, we had to use Protobuf field number 3 when adding the
// field, as 1 was already taken by the request field. This is unusual, as K8s API types
// always use 1 as the Protobuf field number for the metadata field, and that's also what we
// do for all other Antrea API types. It should only affect the wire format, and nothing else.
// When a new version of this API is introduced in the future (e.g., v1), we can correct
// this and assign 1 as the Protobuf field number for the metadata field.
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,3,opt,name=metadata"`
Copy link
Member

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.

Copy link
Contributor Author

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.

Request *NetworkPolicyEvaluationRequest `json:"request,omitempty" protobuf:"bytes,1,opt,name=request"`
Response *NetworkPolicyEvaluationResponse `json:"response,omitempty" protobuf:"bytes,2,opt,name=response"`
}

// Entity contains Namespace and Pod name as a request parameter.
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/controlplane/v1beta2/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/controlplane/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkg/apis/controlplane/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion pkg/apiserver/openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading