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 "antctl proxy" support #1452

Merged
merged 5 commits into from
Nov 2, 2020
Merged

Conversation

antoninbas
Copy link
Contributor

@antoninbas antoninbas commented Oct 29, 2020

With this command antctl can operate as a reverse proxy for Antrea APIs,
similarly to "kubectl proxy" for the K8s APIs (we rely on the
k8s.io/kubectl Go module for the implementation). Thanks to this,
troubleshooting the APIs can become much easier and we hide complexity
from clients. One example is that it becomes much easier to use "go tool
pprof". The drawback here is that the HTTPS connection between the proxy
and the Antrea Agent / Controller is not secure (this can be fixed for
the Controller at least); in this it is very similar to the
supportbundle command implementation.

Fixes #1434

@antrea-bot
Copy link
Collaborator

Thanks for your PR.
Unit tests and code linters are run automatically every time the PR is updated.
E2e, conformance and network policy tests can only be triggered by a member of the vmware-tanzu organization. Regular contributors to the project should join the org.

The following commands are available:

  • /test-e2e: to trigger e2e tests.
  • /skip-e2e: to skip e2e tests.
  • /test-conformance: to trigger conformance tests.
  • /skip-conformance: to skip conformance tests.
  • /test-whole-conformance: to trigger all conformance tests on linux.
  • /skip-whole-conformance: to skip all conformance tests on linux.
  • /test-networkpolicy: to trigger networkpolicy tests.
  • /skip-networkpolicy: to skip networkpolicy tests.
  • /test-windows-conformance: to trigger windows conformance tests.
  • /skip-windows-conformance: to skip windows conformance tests.
  • /test-windows-networkpolicy: to trigger windows networkpolicy tests.
  • /skip-windows-networkpolicy: to skip windows networkpolicy tests.
  • /test-hw-offload: to trigger ovs hardware offload test.
  • /skip-hw-offload: to skip ovs hardware offload test.
  • /test-all: to trigger all tests (except whole conformance).
  • /skip-all: to skip all tests (except whole conformance).

@codecov-io
Copy link

codecov-io commented Oct 29, 2020

Codecov Report

Merging #1452 into master will increase coverage by 0.01%.
The diff coverage is 16.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1452      +/-   ##
==========================================
+ Coverage   67.85%   67.86%   +0.01%     
==========================================
  Files         159      159              
  Lines       12829    12830       +1     
==========================================
+ Hits         8705     8707       +2     
- Misses       3203     3204       +1     
+ Partials      921      919       -2     
Flag Coverage Δ
integration-tests 47.63% <ø> (-0.04%) ⬇️
kind-e2e-tests 55.59% <ø> (+0.23%) ⬆️
unit-tests 42.26% <16.66%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/antctl/antctl.go 100.00% <ø> (ø)
pkg/antctl/command_list.go 30.90% <16.66%> (-0.58%) ⬇️
pkg/apiserver/certificate/certificate.go 71.05% <0.00%> (-6.58%) ⬇️
pkg/ovs/openflow/ofctrl_bridge.go 70.35% <0.00%> (-0.80%) ⬇️
...ntroller/networkpolicy/networkpolicy_controller.go 80.69% <0.00%> (-0.54%) ⬇️
...ntroller/networkpolicy/networkpolicy_controller.go 67.03% <0.00%> (+1.11%) ⬆️
pkg/agent/stats/collector.go 97.70% <0.00%> (+5.74%) ⬆️
pkg/controller/networkpolicy/tier.go 100.00% <0.00%> (+10.00%) ⬆️
...ver/registry/controlplane/nodestatssummary/rest.go 100.00% <0.00%> (+50.00%) ⬆️

@antoninbas antoninbas force-pushed the antctl-proxy branch 2 times, most recently from ad1331c to 023ea20 Compare October 29, 2020 23:56
@antoninbas antoninbas marked this pull request as ready for review October 29, 2020 23:57
@antoninbas
Copy link
Contributor Author

antctl binary size increased by about 2% (50MB -> 51MB) with some small variations based on the platform

docs/troubleshooting.md Outdated Show resolved Hide resolved
@@ -384,3 +386,32 @@ results:
componentInfo: Output
action: Delivered
```

### Antctl Proxy
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mention antctl will get the controller/agent Node IP from K8s API, and connects to that IP?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, updated that section

tnqn
tnqn previously approved these changes Oct 30, 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. Thanks for the work, I believe it will be very useful when debugging APIs under development as well. Previously I have to use a script to get the token and construct the API request manually.

With this command antctl can operate as a reverse proxy for Antrea APIs,
similarly to "kubectl proxy" for the K8s APIs (we rely on the
k8s.io/kubectl Go module for the implementation). Thanks to this,
troubleshooting the APIs can become much easier and we hide complexity
from clients. One example is that it becomes much easier to use "go tool
pprof". The drawback here is that the HTTPS connection between the proxy
and the Antrea Agent / Controller is not secure (this can be fixed for
the Controller at least); in this it is very similar to the
supportbundle command implementation.

Fixes antrea-io#1434
@antoninbas
Copy link
Contributor Author

/test-all

jianjuns
jianjuns previously approved these changes Oct 30, 2020
@antoninbas
Copy link
Contributor Author

/test-all

@antoninbas antoninbas merged commit 3c4899e into antrea-io:master Nov 2, 2020
@antoninbas antoninbas deleted the antctl-proxy branch November 2, 2020 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to enable profiling in Antrea components
7 participants