-
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 command for packetcapture #6884
base: main
Are you sure you want to change the base?
Conversation
4a616d6
to
bf4cb68
Compare
cc @antoninbas Can you help review this? also maybe merge #3659 first cc @luolanzone |
676981f
to
b27b72b
Compare
Signed-off-by: Hang Yan <[email protected]>
Signed-off-by: Hang Yan <[email protected]>
b27b72b
to
43a9451
Compare
Command.Flags().StringVarP(&option.flow, "flow", "f", "", "specify the flow (packet headers) of the PacketCapture , including tcp_src, tcp_dst, udp_src, udp_dst") | ||
Command.Flags().BoolVarP(&option.nowait, "nowait", "", false, "if set, command returns without retrieving results") | ||
Command.Flags().StringVarP(&option.outputDir, "output-dir", "o", ".", "save the packets file to the target directory") | ||
} |
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.
we should let users configure a timeout as well. IIRC, when the timeout expires we still generate a pcap with the packets captured so far, even if the target packet number has not been reached.
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.
there is a global timeout flag, i think that should work too?
} | ||
|
||
func packetCaptureRunE(cmd *cobra.Command, args []string) error { | ||
option.timeout, _ = cmd.Flags().GetDuration("timeout") |
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.
is there a reason why the timeout flag is not defined alongside the other flags?
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.
antctl has a global timeout flag which apply to all sub-command, should we reuse that instead define a new one?
restInterface rest.Interface | ||
} | ||
|
||
func (p *podFile) CopyFromPod(ctx context.Context, namespace, name, containerName, srcPath, dstDir string) 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.
We already have ExecInPod
defined in pkg/antctl/raw/check/
. Can we unify a bit?
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 will try.
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.
`) | ||
|
||
func init() { | ||
Command = &cobra.Command{ |
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 update the antctl document to include this new command.
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.
will do.
Please fix the antctl e2e test failures: https://github.com/antrea-io/antrea/actions/runs/13198383877?pr=6884 |
Co-authored-by: Lan <[email protected]> Co-authored-by: Antonin Bas <[email protected]>
@hangyan there are lots of failures in github checks, please check and fix them. |
e1ba1b2
to
3436bfe
Compare
I disable the flag to run packetcapture sub-command in agentMode but controllerMode will still fail. One must be chosen, or this sub-command wont be registered to the rootCmd. However, seems packetcapture doens't make much sense in agentMode or controllerMode(controllerMode also contains outside of cluster case I think, but the e2e will check the command in controller pod). The tests expect run Can we make an exception in the test-case or we need to provide some sane defaults for it to working in the controllerMode? |
Signed-off-by: Hang Yan <[email protected]>
5ac92d9
to
e44de62
Compare
TODO items:
after #3659 , the CodeQL alert should be fixed and UT coverage will also be improved.