Contributing to OpenShift Network-Tools will enable us to provide a better way to debug OpenShift Cluster Networking. Any type of contributions such as improving existing scripts, fixing bugs, adding new scripts are valuable and most welcome. Please open issues on github for this repository if you find any. RH employees can also reach out to us on #forum-sdn.
This repository aims at providing debugging tools for:
- Checking overall cluster connectivity
- Features developed as a part of OpenShift Networking. Currently supported areas include:
- OpenShiftSDN
- OVNKubernetes
- SRIOV
- Capturing packet dumps and traces from interfaces of nodes/pods/resources in the cluster real-time
- Gather networking metrics/logs from the cluster in situations where API is unreachable (must-gather will not help) by running the scripts locally
- Allowing to spinning up a hostnetwork pod with priviledges which has the basic networking command line tools installed
- Running commands in the pod's network namespace
- All other networking-related tools that can improve debugging process
- All scripts live in
debug-scripts
. debug-scripts/network-tools
is the entry point that provides list of all available commandsdebug-scripts/local-scripts
are not copied to the image and usually only make sense to run locallydebug-scripts/test-networking
is a set of script that run connectivity checks on the clusterdebug-scripts/scripts
contains all other scripts, is your script is not local, add it here- When the image is build, the scripts are then copied into
/opt/bin/
. - All docs live in
network-tools/docs
. - All dependencies should be vendored and they live in
vendor
. - The main dockerfile used for the official release image build is
Dockerfile
. - The dockerfile for development purposes is based of off fedora and is called
Dockerfile.fedora
.
Please follow the undermentioned instructions when adding a new script to the network-tools repo. This is to maintain a minimum level of uniformity.
- Name of the script should reflect what it intends to do, the general pattern is
<object>_<action>
or<object1>_<object2>...
where the scope reduces, e.g. if a script only works for ovn-k clusters, it should start withovn
and for openshift-sdn withsdn
- Functions that are reused in more than one script should be added to the
utils
. - You can use
docs/script-template
as a template for a new script, make sure to updatedescription
andhelp
functions - Add command name <-> script path association in
network-tools
other_commands
or inlocal-scripts/local-scripts-map
for local scripts. - Make sure your script can be run both locally and with
oc adm must-gather
- Make sure that
network-tools -h
andnetwork-tools <new script name> -h
shows your command and its help properly. - Update documentation by running
./docs/generate-docs
. - Even though this image can be accessed only by privileges users/administrators, avoid security vulnerabilities.
- If script assumes to have direct ssh access into the nodes in the cluster, it should be explicitly stated in the help function and must be used only under exceptional circumstances like when the api is down and new pods cannot be created.
- All resources created for testing, must use the
network-tools
image. - All resource names should start with the prefix
network-tools-*
.
To test a new version on the cluster use Dockerfile.fedora
-
Build an image
docker build -f Dockerfile.fedora . -t quay.io/<username>/network-tools:v1
if you get error accessing
registry.ci.openshift.org
,- get your token from https://oauth-openshift.apps.ci.l2s4.p1.openshiftapps.com/oauth/token/request
- run
podman login --authfile ~/.docker/config.json -u <username> -p <token> registry.ci.openshift.org
-
Push
docker push quay.io/<username>/network-tools:v1
-
Make sure repo is public or setup secrets for your repo
-
Use this image to run must-gather
oc adm must-gather --image quay.io/<username>/network-tools:v1 -- network-tools -h
- Open an issue against the repository specifying the of the detail bug.
- Open a PR with the fix against the repository indicating the issue.
- If any networking CLI tools or packages need to be shipped to enhance debugging experience, open a PR adding it to the
Dockerfile
's install packages with adequate justification.