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 network packet-capture #77

Merged

Conversation

dustman9000
Copy link
Member

@dustman9000 dustman9000 commented Dec 9, 2020

This adds a new domain (network) and action: (packet-capture) which runs a privileged tcpdump on nodes for a given duration (60s). After completion, will copy the .pcap files to the local directory (./capture-output/).

Options:

$ osdctl help network packet-capture
Start packet capture

Options:
  -d, --duration=60: Duration (in seconds) of packet capture
      --name='packet-capture': Name of Daemonset
  -n, --namespace='default': Namespace to deploy Daemonset
      --node-label-key='node-role.kubernetes.io/worker': Node label key
      --node-label-value='': Node label value

Usage:
  osdctl network packet-capture [flags] [options]

Use "osdctl options" for a list of global command-line options (applies to all commands).

Example run:

dustinrow@drow-mac:~/src/osd-utils-cli$ ./bin/osdctl network packet-capture
2020/12/09 20:53:51 Ensuring Packet Capture Daemonset
2020/12/09 20:53:51 Successfully ensured packet capture daemonset
2020/12/09 20:53:51 Waiting For Packet Capture Daemonset
2020/12/09 20:55:01 Copying Files From Packet Capture Pods
2020/12/09 20:55:01 Copying files from packet-capture-28qck
tar: Removing leading `/' from member names
2020/12/09 20:55:02 Copying files from packet-capture-8rsp7
tar: Removing leading `/' from member names
2020/12/09 20:55:03 Copying files from packet-capture-cxlnj
tar: Removing leading `/' from member names
2020/12/09 20:55:05 Copying files from packet-capture-jsbn7
tar: Removing leading `/' from member names
2020/12/09 20:55:07 Copying files from packet-capture-n5x7q
tar: Removing leading `/' from member names
2020/12/09 20:55:08 Copying files from packet-capture-vhcgj
tar: Removing leading `/' from member names
2020/12/09 20:55:09 Deleting Packet Capture Daemonset
dustinrow@drow-mac:~/src/osd-utils-cli$ ls -al ./capture-output/
total 5968
drwxr-xr-x  8 dustinrow staff     256 Dec  9 20:55 .
drwxr-xr-x 19 dustinrow staff     608 Dec  9 20:55 ..
-rw-r--r--  1 dustinrow staff  22972 Dec 14 13:56 ip-10-0-149-114.us-west-2.compute.internal-20201214T215510.pcap
-rw-r--r--  1 dustinrow staff  23310 Dec 14 13:56 ip-10-0-166-239.us-west-2.compute.internal-20201214T215510.pcap
-rw-r--r--  1 dustinrow staff  73776 Dec 14 13:56 ip-10-0-180-197.us-west-2.compute.internal-20201214T215510.pcap
-rw-r--r--  1 dustinrow staff  93627 Dec 14 13:54 ip-10-0-201-138.us-west-2.compute.internal-20201214T215359.pcap
-rw-r--r--  1 dustinrow staff  84173 Dec 14 13:56 ip-10-0-201-138.us-west-2.compute.internal-20201214T215510.pcap
-rw-r--r--  1 dustinrow staff  62683 Dec 14 13:56 ip-10-0-211-217.us-west-2.compute.internal-20201214T215510.pcap
-rw-r--r--  1 dustinrow staff 576531 Dec 14 13:54 ip-10-0-228-43.us-west-2.compute.internal-20201214T215359.pcap
-rw-r--r--  1 dustinrow staff 648548 Dec 14 13:56 ip-10-0-228-43.us-west-2.compute.internal-20201214T215510.pcap

@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 9, 2020
@dustman9000 dustman9000 force-pushed the add-network-packet-capture branch 5 times, most recently from 9f74b94 to b832843 Compare December 10, 2020 04:53
@dustman9000
Copy link
Member Author

/assign @rogbas
/assign @jharrington22

@dustman9000 dustman9000 changed the title WIP: Add network packet-capture Add network packet-capture Dec 10, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2020
@dustman9000 dustman9000 force-pushed the add-network-packet-capture branch from b832843 to 1feafea Compare December 10, 2020 05:03
@dustman9000 dustman9000 changed the title Add network packet-capture WIP: Add network packet-capture Dec 10, 2020
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2020
@dustman9000 dustman9000 force-pushed the add-network-packet-capture branch from 1feafea to 441f8c6 Compare December 10, 2020 19:44
@dustman9000 dustman9000 changed the title WIP: Add network packet-capture Add network packet-capture Dec 10, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 10, 2020
@dustman9000 dustman9000 force-pushed the add-network-packet-capture branch from 441f8c6 to 0b8abac Compare December 10, 2020 19:55
Copy link
Contributor

@iamkirkbater iamkirkbater left a comment

Choose a reason for hiding this comment

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

Overall the code looks good, I still have to build/test locally. Just a few small things we can discuss but nothing that should block this getting in.

@dustman9000
Copy link
Member Author

/label tide/merge-method-squash

@openshift-ci-robot openshift-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Dec 14, 2020
@rogbas
Copy link

rogbas commented Dec 14, 2020

Overall the change is looking good, I just added a question that not necessarily blocks merging this PR.

@rogbas
Copy link

rogbas commented Dec 14, 2020

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dustman9000, rogbas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 14, 2020
@openshift-merge-robot openshift-merge-robot merged commit 435edc2 into openshift:master Dec 14, 2020
devppratik pushed a commit to devppratik/osdctl that referenced this pull request Aug 23, 2023
* Add network packet-capture to perform a priviledged node tcpdump.

* Use timestamp in pcap filename and add 'pcap' alias

* Throw error when DS with the same name exists

* Change default packet capture DS name

* Change image name to openshift-sre org

* Change test function name

* Make docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants