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 antctl framework #208

Merged
merged 7 commits into from
Jan 16, 2020

Conversation

weiqiangt
Copy link
Contributor

Resolves #203.

@antrea-bot

This comment has been minimized.

Copy link
Contributor

@jianjuns jianjuns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this.
Just got time to do a quick scan of the change but not in-depth review yet. I put some questions, but I think it could help review if you could add some comments to explain more the concepts in the code.

Makefile Outdated Show resolved Hide resolved
name: antctl
rules:
- nonResourceURLs:
- /apis/antctl.antrea.io/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use some generic naming instead of indicating this is for antctl only? Like clusterinfo, or controllerinfo/agentinfo or nodeinfo?
@tnqn: what you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, they should be named with what they are, instead of who use them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks guys, but could you give me some suggestions for the name?
This endpoint was used for accessing antctl server side and we will add commands not related to info, like support-bundle.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use clusterinfo or now (or controllerinfo and agentinfo if we want to separate controller and agent/node).

Not sure about support-bundle. What API groups K8s uses for logging/metrics, etc.?

Copy link
Contributor Author

@weiqiangt weiqiangt Dec 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to clusterinfo.antrea.tanzu.vmware.
The metrics in Kubelet does not have API group, it's a bare endpoint.

cmd/antctl/main.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
pkg/antctl/commandbundle.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/handlers/version.go Outdated Show resolved Hide resolved
pkg/antctl/handlers/version.go Show resolved Hide resolved
pkg/antctl/server.go Outdated Show resolved Hide resolved
@weiqiangt weiqiangt force-pushed the weiqiangt/antctl-framework branch 3 times, most recently from 066c81f to f33dbbe Compare December 13, 2019 02:51
Makefile Show resolved Hide resolved
name: antctl
rules:
- nonResourceURLs:
- /apis/antctl.antrea.io/v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use clusterinfo or now (or controllerinfo and agentinfo if we want to separate controller and agent/node).

Not sure about support-bundle. What API groups K8s uses for logging/metrics, etc.?

@weiqiangt weiqiangt force-pushed the weiqiangt/antctl-framework branch 3 times, most recently from 9587a34 to b31ecd1 Compare December 17, 2019 06:25
.dockerignore Outdated Show resolved Hide resolved
pkg/antctl/commandbundle.go Outdated Show resolved Hide resolved
cmd/antrea-agent/agent.go Outdated Show resolved Hide resolved
cmd/antrea-controller/controller.go Outdated Show resolved Hide resolved
cmd/antrea-controller/controller.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late review.

One global review comment is that more detailed comments would be useful and sometimes even comments for private functions are useful IMO. A lot of the function comments are just a translation of the function name into a short english sentence at the moment and I don't think that's very useful. For example:

// applyToCommand applies the CommandOption to a cobra.Command with the Client.
func (co *CommandOption) applyToCommand(cmd *cobra.Command, client *Client) {

If you look at K8s source code, most of the time you will see some actually useful information in the function comments (e.g. https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/client_config.go#L541).

Another comment is that it would probably be useful to have some skeleton of documentation to accompany this PR (not detailed, just where can you expect to run the CLI binary for client / controller). We can then improve it over time.

Makefile Outdated Show resolved Hide resolved
test/e2e/infra/vagrant/push_antrea.sh Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/commandoption.go Outdated Show resolved Hide resolved
pkg/antctl/definitions.go Outdated Show resolved Hide resolved
@antrea-bot

This comment has been minimized.

@weiqiangt weiqiangt force-pushed the weiqiangt/antctl-framework branch 3 times, most recently from 751d804 to 783f8bb Compare December 23, 2019 04:41
build/yamls/antrea-ipsec.yml Outdated Show resolved Hide resolved
build/yamls/antrea.yml Outdated Show resolved Hide resolved
build/yamls/base/controller.yml Outdated Show resolved Hide resolved
cmd/antctl/main.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/command_list.go Outdated Show resolved Hide resolved
pkg/antctl/handlers/interface.go Show resolved Hide resolved
@tnqn
Copy link
Member

tnqn commented Jan 10, 2020

Besides, I see server side code is still under pkg/antctl, do you plan to change it as @jianjuns suggested, or leave it to later improvement, or we want to keep it as is?

@weiqiangt
Copy link
Contributor Author

Besides, I see server side code is still under pkg/antctl, do you plan to change it as @jianjuns suggested, or leave it to later improvement, or we want to keep it as is?

I would like to refactor this in another PR.

Signed-off-by: Weiqiang TANG <[email protected]>
@weiqiangt
Copy link
Contributor Author

/test-all

@weiqiangt
Copy link
Contributor Author

Hi folks, thanks a lot for reviewing this PR. I have addressed all comments and created issues to track several future works of it. The document for the antctl will also be added in a separate PR(it was picked out from this PR).

tnqn
tnqn previously approved these changes Jan 14, 2020
Copy link
Member

@tnqn tnqn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding comments.

I mostly found typos, but also left a few other review comments.

pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/client.go Outdated Show resolved Hide resolved
pkg/antctl/antctl.go Outdated Show resolved Hide resolved
pkg/antctl/handlers/version.go Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
test/e2e/antctl_test.go Outdated Show resolved Hide resolved
@weiqiangt weiqiangt dismissed stale reviews from tnqn via ba4bbe0 January 15, 2020 15:55
weiqiangt and others added 3 commits January 16, 2020 00:12
@weiqiangt
Copy link
Contributor Author

/test-all

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jianjuns
Copy link
Contributor

Again, I believe we should decouple API server from antctl, but we can merge the current implementation, and change later (maybe after commands for runtime info are done).

@weiqiangt
Copy link
Contributor Author

Again, I believe we should decouple API server from antctl, but we can merge the current implementation, and change later (maybe after commands for runtime info are done).

Copied.

@weiqiangt weiqiangt merged commit 36e5e35 into antrea-io:master Jan 16, 2020
@weiqiangt weiqiangt deleted the weiqiangt/antctl-framework branch January 16, 2020 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement the CLI for antrea
8 participants