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

Unable to Run "antctl get ovsflow --help" Command #5810

Closed
XinShuYang opened this issue Dec 19, 2023 · 9 comments · Fixed by #5895
Closed

Unable to Run "antctl get ovsflow --help" Command #5810

XinShuYang opened this issue Dec 19, 2023 · 9 comments · Fixed by #5895
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to a documentation.

Comments

@XinShuYang
Copy link
Contributor

XinShuYang commented Dec 19, 2023

Describe the bug
According to the Antrea antctl documentation, this command is supposed to list all Antrea flow tables. However, when I attempt to run it during testing antrea bot, it does not work as expected.

antctl get ovsflow --help lists all Antrea flow tables.
https://github.com/antrea-io/antrea/blob/main/docs/antctl.md#dumping-ovs-flows

To Reproduce
Run antctl get ovsflow --help

Expected
As described in the documentation, this command should list all antrea flow tables.

Actual Behavior

Output:

 antctl get ovsflows --help
Dump all the OVS flows or the flows installed for the specified entity.

Usage:
  antctl get ovsflows [flags]

Aliases:
  ovsflows, of

Examples:
  Dump all OVS flows
  $ antctl get ovsflows
  Dump OVS flows of a local Pod
  $ antctl get ovsflows -p pod1 -n ns1
  Dump OVS flows of a Service
  $ antctl get ovsflows -S svc1 -n ns1
  Dump OVS flows of a NetworkPolicy
  $ antctl get ovsflows -N np1 -n ns1
  Dump OVS flows of a flow Table
  $ antctl get ovsflows -T IngressRule
  Dump OVS groups
  $ antctl get ovsflows -G 10,20
  Dump all OVS groups
  $ antctl get ovsflows -G all

  Antrea OVS Flow Tables:

Flags:
  -G, --groups string          Comma separated OVS group IDs. Use 'all' to dump all groups
  -h, --help                   help for ovsflows
  -n, --namespace string       Namespace of the entity
  -N, --networkpolicy string   NetworkPolicy name. If present, Namespace must be provided.
  -o, --output string          output format: json|table|yaml|raw (default "table")
  -p, --pod string             Name of a local Pod. If present, Namespace must be provided.
  -S, --service string         Name of a Service. If present, Namespace must be provided.
  -T, --table string           Comma separated Antrea OVS flow table names or numbers

Global Flags:
  -k, --kubeconfig string   absolute path to the kubeconfig file
  -s, --server string       address and port of the API server, taking precedence over the default endpoint and the one set in kubeconfig
  -t, --timeout duration    time limit of the execution of the command
  -v, --verbose             enable verbose output
@XinShuYang XinShuYang added kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to a documentation. labels Dec 19, 2023
@antoninbas
Copy link
Contributor

What kind of error / output do you get?

@XinShuYang
Copy link
Contributor Author

What kind of error / output do you get?

Updated issue description, IMO we should use 'ovsflows' in the command instead of 'ovsflow', right?

@luolanzone
Copy link
Contributor

@XinShuYang I think it's a doc bug, I feel we can simply remove the description considering antctl get ovsflows has been mentioned in the previous paragraph, or we can change it to "antctl get ovsflows --help shows more details about the usage" @quan any thoughts?

@antoninbas
Copy link
Contributor

I agree that there is a documentation, as antctl get ovsflows --help does not actually give the list of tables. Not to mention that the command is antctl get ovsflows and not antctl get ovsflow.

But the output provided by @XinShuYang is misleading, since this is the output when trying to run the command in controller mode, while the command is only supported in agent mode. This is the actual output:

root@kind-worker:/# antctl get ovsflows --help
Dump all the OVS flows or the flows installed for the specified entity.

Usage:
  antctl get ovsflows [flags]

Aliases:
  ovsflows, of

Examples:
  Dump all OVS flows
  $ antctl get ovsflows
  Dump OVS flows of a local Pod
  $ antctl get ovsflows -p pod1 -n ns1
  Dump OVS flows of a Service
  $ antctl get ovsflows -S svc1 -n ns1
  Dump OVS flows of a NetworkPolicy
  $ antctl get ovsflows -N np1 -n ns1
  Dump OVS flows of a flow Table
  $ antctl get ovsflows -T IngressRule
  Dump OVS groups
  $ antctl get ovsflows -G 10,20
  Dump all OVS groups
  $ antctl get ovsflows -G all

  Antrea OVS Flow Tables:

Flags:
  -G, --groups string          Comma separated OVS group IDs. Use 'all' to dump all groups
  -h, --help                   help for ovsflows
  -n, --namespace string       Namespace of the entity
  -N, --networkpolicy string   NetworkPolicy name. If present, Namespace must be provided.
  -o, --output string          output format: json|table|yaml|raw (default "table")
  -p, --pod string             Name of a local Pod. If present, Namespace must be provided.
  -S, --service string         Name of a Service. If present, Namespace must be provided.
  -T, --table string           Comma separated Antrea OVS flow table names or numbers

Global Flags:
  -k, --kubeconfig string   absolute path to the kubeconfig file
  -s, --server string       address and port of the API server, taking precedence over the default endpoint and the one set in kubeconfig
  -t, --timeout duration    time limit of the execution of the command
  -v, --verbose             enable verbose output

@XinShuYang
Copy link
Contributor Author

XinShuYang commented Dec 20, 2023

I agree that there is a documentation, as antctl get ovsflows --help does not actually give the list of tables. Not to mention that the command is antctl get ovsflows and not antctl get ovsflow.

But the output provided by @XinShuYang is misleading, since this is the output when trying to run the command in controller mode, while the command is only supported in agent mode. This is the actual output:

root@kind-worker:/# antctl get ovsflows --help
Dump all the OVS flows or the flows installed for the specified entity.

Usage:
  antctl get ovsflows [flags]

Aliases:
  ovsflows, of

Examples:
  Dump all OVS flows
  $ antctl get ovsflows
  Dump OVS flows of a local Pod
  $ antctl get ovsflows -p pod1 -n ns1
  Dump OVS flows of a Service
  $ antctl get ovsflows -S svc1 -n ns1
  Dump OVS flows of a NetworkPolicy
  $ antctl get ovsflows -N np1 -n ns1
  Dump OVS flows of a flow Table
  $ antctl get ovsflows -T IngressRule
  Dump OVS groups
  $ antctl get ovsflows -G 10,20
  Dump all OVS groups
  $ antctl get ovsflows -G all

  Antrea OVS Flow Tables:

Flags:
  -G, --groups string          Comma separated OVS group IDs. Use 'all' to dump all groups
  -h, --help                   help for ovsflows
  -n, --namespace string       Namespace of the entity
  -N, --networkpolicy string   NetworkPolicy name. If present, Namespace must be provided.
  -o, --output string          output format: json|table|yaml|raw (default "table")
  -p, --pod string             Name of a local Pod. If present, Namespace must be provided.
  -S, --service string         Name of a Service. If present, Namespace must be provided.
  -T, --table string           Comma separated Antrea OVS flow table names or numbers

Global Flags:
  -k, --kubeconfig string   absolute path to the kubeconfig file
  -s, --server string       address and port of the API server, taking precedence over the default endpoint and the one set in kubeconfig
  -t, --timeout duration    time limit of the execution of the command
  -v, --verbose             enable verbose output

Thanks, updated my results. Even after replacing 'ovsflow' with 'ovsflows', I still find the sentence antctl get ovsflows --help lists all Antrea flow tables in the document confusing. Do you know if there is a command that can list all flow tables? @antoninbas

@luolanzone
Copy link
Contributor

luolanzone commented Dec 20, 2023

@wenyingd confirmed that this is actually a code bug, according to the code here https://github.com/antrea-io/antrea/blob/faec22afd659c13f99e9dadfa91e71e2943b0429/pkg/antctl/antctl.go#L386C2-L386C2, it's indeed supposed to print the table list with --help. So it's a code bug instead of a doc issue. 🥲

@luolanzone
Copy link
Contributor

I feel we may need to print the table list with a new parameter instead of printing them in a help message considering it will a quite long list. what's your suggestion? @antoninbas @tnqn

@XinShuYang
Copy link
Contributor Author

I feel we may need to print the table list with a new parameter instead of printing them in a help message considering it will a quite long list. what's your suggestion? @antoninbas @tnqn

Given that we already have antctl get ovsflows -G all to dump all OVS groups. How about using antctl get ovsflows -T all to list all flow tables?

@antoninbas
Copy link
Contributor

antoninbas commented Dec 20, 2023

The equivalent of antctl get ovsflows -G all for tables is antctl get ovsflows (although it would be nice to have antctl get ovsflows -T all for symmetry).
antctl get ovsflows --table-names (or antctl get ovsflows --table-names-only) is a possible option if we want a subcommand that only prints a list of table names.

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. kind/documentation Categorizes issue or PR as related to a documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants