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

v1beta1.controlplane.antrea.tanzu.vmware.com used v1beta2 types and field selectors were missing #2304

Closed
tnqn opened this issue Jun 24, 2021 · 0 comments · Fixed by #2305
Closed
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@tnqn
Copy link
Member

tnqn commented Jun 24, 2021

Describe the bug

When debugging #2303, I found that listing the networkpolicy.v1beta1.controlplane.antrea.tanzu.vmware.com API didn't get error when listing networkpolicy.v1beta1.networking.antrea.tanzu.vmware.com got "MarshalJSON error", while they were supposed to use same types and get same results.

It turned out thatv1beta1.controlplane.antrea.tanzu.vmware.com was actually using v1beta2 types by mistake. It was introduced when renaming the API group to antrea.io:

&v1beta2.AppliedToGroup{},
&v1beta2.AppliedToGroupPatch{},
&v1beta2.AppliedToGroupList{},
&v1beta2.AddressGroup{},
&v1beta2.AddressGroupPatch{},
&v1beta2.AddressGroupList{},
&v1beta2.NetworkPolicy{},
&v1beta2.NetworkPolicyList{},
&v1beta2.NodeStatsSummary{},

This would cause the consumer of the legacy controlplane v1beta1 API got unexpected response.

Beside, the field selectors of v1beta1.controlplane.antrea.tanzu.vmware.com and v1beta1.networking.antrea.tanzu.vmware.com were not registered, which caused "nodeName" fieldSelector not working.

# kubectl get networkpolicy.v1beta1.networking.antrea.tanzu.vmware.com --field-selector "nodeName=abc"
Error from server (BadRequest): Unable to find "networking.antrea.tanzu.vmware.com/v1beta1, Resource=networkpolicies" that match label selector "", field selector "nodeName=abc": "nodeName" is not a known field selector: only "metadata.name", "metadata.namespace"
# kubectl get networkpolicy.v1beta1.controlplane.antrea.tanzu.vmware.com --field-selector "nodeName=abc"
Error from server (BadRequest): Unable to find "controlplane.antrea.tanzu.vmware.com/v1beta1, Resource=networkpolicies" that match label selector "", field selector "nodeName=abc": "nodeName" is not a known field selector: only "metadata.name", "metadata.namespace"

Versions:
Please provide the following information:

  • Antrea version (Docker image tag). 1.0.0-1.1.0
@tnqn tnqn added the kind/bug Categorizes issue or PR as related to a bug. label Jun 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant