-
Notifications
You must be signed in to change notification settings - Fork 386
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
Support antctl in the flow aggregator #2878
Conversation
387ef70
to
fac4249
Compare
Codecov Report
@@ Coverage Diff @@
## main #2878 +/- ##
==========================================
- Coverage 61.06% 60.91% -0.16%
==========================================
Files 289 292 +3
Lines 24548 24698 +150
==========================================
+ Hits 14991 15045 +54
- Misses 7938 8015 +77
- Partials 1619 1638 +19
Flags with carried forward coverage won't be shown. Click here to find out more.
|
fac4249
to
579433b
Compare
This pull request introduces 2 alerts when merging 579433b into 4d0eea7 - view on LGTM.com new alerts:
|
579433b
to
a8900d4
Compare
a8900d4
to
d40f7da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Yanjun working on this.
1b3502a
to
ff5fed0
Compare
3c7598e
to
2f7a180
Compare
2f7a180
to
2f13613
Compare
2f13613
to
01f9374
Compare
docs/antctl.md
Outdated
verbosity level of Antrea Controller or Agent using the `antctl log-level` | ||
command. The command can only run locally inside the `antrea-controller` or | ||
`antrea-agent` container. | ||
verbosity level of Antrea Controller, Antrea Agent or Flow Aggregator using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this separately for Flow Aggregator, as the support version number is different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Use 1.4 for now, if it does not catch up the release 1.4, will update to later version.
01f9374
to
917c66d
Compare
@antoninbas @srikartati Would you like to take another look at this PR before I upgrade go-ipfix to a new version? Thanks a lot! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me @yanjunz97
test/e2e/antctl_test.go
Outdated
func TestAntctlFlowAggregator(t *testing.T) { | ||
skipIfHasWindowsNodes(t) | ||
skipIfNotRequired(t, "mode-irrelevant") | ||
|
||
data, _, _, err := setupTestWithIPFIXCollector(t) | ||
if err != nil { | ||
t.Fatalf("Error when setting up test: %v", err) | ||
} | ||
defer teardownFlowAggregator(t, data) | ||
defer teardownTest(t, data) | ||
|
||
t.Run("testAntctlFlowAggregatorLocalAccess", func(t *testing.T) { | ||
testAntctlFlowAggregatorLocalAccess(t, data) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is unfortunate that we have to setup everything just for this small test, then tear it down. Can we merge this test with the other FlowAggregator e2e tests instead, so we only do the set up once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried to merge the tests by using setupTestWithIPFIXCollector
for all antctl test, but noticed some of the testAntctlControllerRemoteAccess
may fail when using coverage on CI. Still looking for the reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
solved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not really what I had in mind. We are still calling setupTestWithIPFIXCollector
twice (once for antctl tests and once for the Flow Aggregator tests). We should try to call it once IMO, and move the antctl tests for the Flow Aggregator to test/e2e/flowaggregator_test.go
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it, thanks. Updated.
5c507aa
to
647965c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 small comments, otherwise LGTM
Suggestions for follow-up PRs:
- ability to filter based on K8s names instead of network header fields
- use Prometheus to export FlowAggregator metrics and leverage that instead in the CLI if possible
- for the FlowAggregator antctl e2e tests, write some "real" tests instead of just calling the commands without arguments. In particular we can call
antctl get flowrecords -o json
and check that the contents are as expected.
test/e2e/framework.go
Outdated
@@ -1326,6 +1326,21 @@ func (data *TestData) getAntreaPodOnNode(nodeName string) (podName string, err e | |||
return pods.Items[0].Name, nil | |||
} | |||
|
|||
// getFlowAggregator retrieves the name of the Flow-Aggregator Pod (flow-aggregator-*) running on a specific Node. | |||
func (data *TestData) getFlowAggregator(nodeName string) (podName string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use this function in the implementation of gracefulExitFlowAggregator
to avoid code duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/e2e/flowaggregator_test.go
Outdated
// testAntctlLocalAccess ensures antctl is accessible in a Flow Aggregator Pod. | ||
func testAntctlLocalAccess(t *testing.T, data *TestData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe call it something more specific to avoid potential name collisions in the future
for example testFlowAggregatorAntctl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
647965c
to
e99815a
Compare
/test-all |
/test-all-features-conformance |
All tests passed. This PR can be merged together with #2909 if no other comment. |
@yanjunz97 I merged #2909 but looks like you have to rebase now |
Signed-off-by: Yanjun Zhou <[email protected]>
e99815a
to
7c797d5
Compare
/test-all |
/test-integration |
1 similar comment
/test-integration |
Thanks! Rebased and passed the tests |
This reverts commit 617ce25.
This commit supports antctl in the flow aggregator pod. It supports three commands only running locally inside the flow-aggregator container.
antctl get log-level
command works the same as the one in antrea-agent or antrea-controller.antctl get flowrecords [-o json]
command can dump all matched flow records. The command provides a compact display of the flow records in the default table output format. Using thejson
oryaml
antctl output format can print more information of the flow records. The command supports the 5-tuple flow key or a subset of 5-tuples as a filter. A 5-tuple flow key contains Source IP, Destination IP, Source Port, Destination Port and Transport Protocol. If the filter is empty, all flow records will be dumped.Example outputs of dumping flow records:
antctl get recordmetrics
command can print all metrics related to the Flow Aggregator. The metrics include number of records received by the collector process in the Flow Aggregator, number of records exported by the Flow Aggregator, number of active flows that are being tracked, number of exporters connected to the Flow AggregatorFixes: #1966