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

Implement the CLI for antrea #203

Closed
weiqiangt opened this issue Dec 6, 2019 · 1 comment · Fixed by #208
Closed

Implement the CLI for antrea #203

weiqiangt opened this issue Dec 6, 2019 · 1 comment · Fixed by #208
Assignees
Labels
proposal A concrete proposal for adding a feature

Comments

@weiqiangt
Copy link
Contributor

Describe what you are trying to solve

There is no CLI for antrea, but there are needs of a CLI to inspect antrea.

Describe the solution you have in mind

There should be a cross-platform CLI client, called antctl maybe, provides well-organized commands with verbosity helps and examples. It should work like other CLIs in the community, e.g. kubectl and docker.
Before implementing the antctl, we should first implement a general framework for it, because the implementation of each command is generally the same: defining command, implementing input and flags, implementing retrievement and implementing the output formatter, a framework could help us to reduce these trivial works.

Describe how your solution impacts user flows

Users could use antctl to access status of different antrea components.

To access the status of an agent, user could run antctl in the antrea-agent container of the antrea-agent pod.

To access the status of the controller, users could either run antctl in the controller pod or anywhere that can access to the kubernetes cluster.

In conclusion, the agent is only able to be accessed in its container, the controller is able to be accessed both in its container and somewhere out of the cluster.

antctl should be packed into the antrea/antrea-ubuntu image, then users could use it directly.

For remote accessing to antrea controller, we should provide antctl binaries for both macOS, Linux and Windows. antctl binaries should also be published in each release.

Describe the main design/architecture of your solution

According to the desired user flows, the antctl server should be accessed in two mode: local mode and remote mode.

Because both client and server reside in the same pod, in local mode we don't need to do any AA work. It's a pure C/S workflow.

workflow of the local mode:

antctl local mode

In remote mode, the client is in somewhere out of the cluster, thus we need to have access control. In Kubernetes, developers could add extension API server to extend APIs of the clusters. The Kubernetes API server can also delegate the authentication and authorization of the requests to extension API servers. The antrea controller contains a extension API server, we can leverage it to implement the antctl server. By using RBAC provides by Kubernetes, we can set access controls of antctl requests and exist requests seperatly on the same extension API server.

workflow of the remote mode:

antctl remote mode

To reduce redandunt definitons of commands, we should have an universal antctl definition which could be applied to both the client side and the server side.

    
                |-------------------|   apply     |-------------------|
                | antctl definition |-----------> |   antctl client   |
                |-------------------|  |          |-------------------|
                                       |
                                       |          |-------------------|
                                        \-------> |   antctl server   |
                                                  |-------------------|
                                                  

There are many CLI libs provides in Go community, Cobra is the most popular one. Both kubectl and docker are built upon it. In antctl, we can implement our command definition based on Cobra's.

Alternative solutions that you considered

None.

Test plan

In this proposal, a CLI framework and a minimum antctl are expected. thus we also need add new e2e test to cover this new component.

In e2e test, we should ensure the access controls and command flag configurations works properly.

Additional context

None.

@weiqiangt weiqiangt added the proposal A concrete proposal for adding a feature label Dec 6, 2019
@weiqiangt weiqiangt added this to the Antrea v0.2.0 release milestone Dec 6, 2019
@weiqiangt weiqiangt self-assigned this Dec 6, 2019
@antoninbas
Copy link
Contributor

As discussed at the 12/18/2019 community meeting, we are moving this out of the 0.2.0 release.

weiqiangt added a commit to weiqiangt/antrea that referenced this issue Jan 8, 2020
Resolves antrea-io#203.
Signed-off-by: Weiqiang TANG <weiqiangt@vmware.com>
zyiou pushed a commit to zyiou/antrea that referenced this issue Jul 2, 2021
Add source & destination Pod labels field into registry, these
information will be filled on the Flow Aggregator side and are
necessary in developing network policy recommendation feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A concrete proposal for adding a feature
Projects
None yet
2 participants