├── jira-scripts ├── .gitignore ├── requirements.txt ├── single_query └── README.md ├── pkg └── tools │ └── tools.go ├── .ci-operator.yaml ├── vendor ├── github.com │ └── openshift │ │ └── build-machinery-go │ │ ├── make │ │ ├── lib │ │ │ ├── tmp.mk │ │ │ ├── doc.go │ │ │ ├── version.mk │ │ │ └── golang.mk │ │ ├── doc.go │ │ ├── targets │ │ │ ├── doc.go │ │ │ ├── golang │ │ │ │ ├── doc.go │ │ │ │ ├── test-unit.mk │ │ │ │ ├── build.mk │ │ │ │ └── verify-update.mk │ │ │ ├── openshift │ │ │ │ ├── doc.go │ │ │ │ ├── operator │ │ │ │ │ ├── doc.go │ │ │ │ │ ├── release.mk │ │ │ │ │ └── telepresence.mk │ │ │ │ ├── deps.mk │ │ │ │ ├── images.mk │ │ │ │ ├── yq.mk │ │ │ │ ├── codegen.mk │ │ │ │ ├── yaml-patch.mk │ │ │ │ ├── controller-gen.mk │ │ │ │ ├── rpm.mk │ │ │ │ ├── deps-glide.mk │ │ │ │ ├── bindata.mk │ │ │ │ ├── deps-gomod.mk │ │ │ │ └── crd-schema-gen.mk │ │ │ └── help.mk │ │ ├── golang.example.mk.help.log │ │ ├── operator.mk │ │ ├── default.example.mk.help.log │ │ ├── golang.example.mk │ │ ├── operator.example.mk.help.log │ │ ├── golang.mk │ │ ├── default.mk │ │ ├── default.example.mk │ │ └── operator.example.mk │ │ ├── scripts │ │ ├── doc.go │ │ ├── update-deps.sh │ │ └── run-telepresence.sh │ │ ├── OWNERS │ │ ├── doc.go │ │ ├── README.md │ │ ├── Makefile │ │ └── LICENSE └── modules.txt ├── go.mod ├── go.sum ├── .gitignore ├── debug-scripts ├── local-scripts │ ├── local-scripts-map │ ├── ci-artifacts-get │ ├── ovn-pprof-forwarding │ ├── ovn-db-run-locally │ └── ovn-dbs-run-locally ├── test-networking │ ├── ovn_nic_firmware │ ├── sdn_node_connectivity │ ├── main │ ├── ovn_network_tools_daemonset │ ├── sdn_pod_to_pod_connectivity │ ├── ovn_pod_to_pod_connectivity │ ├── ovn_pod_to_svc_connectivity │ ├── ovn_ipsec_connectivity │ ├── sdn_pod_to_svc_connectivity │ ├── common │ └── sdn_cluster_and_node_info ├── scripts │ ├── ovn-metrics-list │ ├── ovn-db-run-command │ ├── ovn-count-flows │ ├── ovn-get │ ├── pod-run-netns-command │ ├── sriov_network_info │ ├── ovn-perf-scanner │ └── ovn_cleanConntrack ├── network-tools └── utils ├── OWNERS ├── docs ├── script-template ├── generate-docs └── contributor.md ├── Makefile ├── Dockerfile ├── Dockerfile.fedora ├── README.md └── LICENSE /jira-scripts/.gitignore: -------------------------------------------------------------------------------- 1 | python-bugzilla 2 | jira_secrets.py 3 | __pycache__ 4 | -------------------------------------------------------------------------------- /jira-scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | jira 2 | python-bugzilla 3 | python-dateutil 4 | tabulate 5 | -------------------------------------------------------------------------------- /pkg/tools/tools.go: -------------------------------------------------------------------------------- 1 | // *build tools 2 | 3 | package tools 4 | 5 | import ( 6 | _ "github.com/openshift/build-machinery-go" 7 | ) 8 | -------------------------------------------------------------------------------- /.ci-operator.yaml: -------------------------------------------------------------------------------- 1 | build_root_image: 2 | name: release 3 | namespace: openshift 4 | tag: rhel-9-release-golang-1.24-openshift-4.21 5 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/lib/tmp.mk: -------------------------------------------------------------------------------- 1 | PERMANENT_TMP :=_output 2 | PERMANENT_TMP_GOPATH :=$(PERMANENT_TMP)/tools 3 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/lib/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/scripts/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/openshift/network-tools 2 | 3 | go 1.22.0 4 | 5 | require github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab 6 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/golang/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/operator/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - tnozicka 3 | - sttts 4 | - mfojtik 5 | - soltysh 6 | approvers: 7 | - tnozicka 8 | - sttts 9 | - mfojtik 10 | - soltysh 11 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab h1:lBrojddP6C9C2p67EMs2vcdpC8eF+H0DDom+fgI2IF0= 2 | github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= 3 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/golang.example.mk.help.log: -------------------------------------------------------------------------------- 1 | The following make targets are available: 2 | all 3 | build 4 | clean 5 | clean-binaries 6 | help 7 | test 8 | test-unit 9 | update 10 | update-gofmt 11 | verify 12 | verify-gofmt 13 | verify-golint 14 | verify-govet 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # IDEs 2 | /.vscode 3 | /.settings 4 | *.swp 5 | .vimrc 6 | .DS_Store 7 | .idea 8 | *.go~ 9 | 10 | # Binaries for programs and plugins 11 | *.exe 12 | *.exe~ 13 | *.dll 14 | *.so 15 | *.dylib 16 | 17 | # Test binary, build with `go test -c` 18 | *.test 19 | 20 | # Output of the go coverage tool, specifically when used with LiteIDE 21 | *.out 22 | 23 | -------------------------------------------------------------------------------- /debug-scripts/local-scripts/local-scripts-map: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | declare -Ag INTERNAL_COMMANDS=( 4 | ["ovn-pprof-forwarding"]="./local-scripts/ovn-pprof-forwarding" 5 | ["ci-artifacts-get"]="./local-scripts/ci-artifacts-get" 6 | ["ovn-db-run-locally"]="./local-scripts/ovn-db-run-locally" 7 | ["ovn-dbs-run-locally"]="./local-scripts/ovn-dbs-run-locally" 8 | ) -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/operator/release.mk: -------------------------------------------------------------------------------- 1 | # If we need unified behaviour specific to operators, this folder is the place. 2 | 3 | # It seems that our previous origin-release jq based replacement is suppose to be done 4 | # with `oc adm release new` so it might drop this target. 5 | #origin-release: 6 | # $(error Not implemented.) 7 | #.PHONY: origin-release 8 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/help.mk: -------------------------------------------------------------------------------- 1 | help: 2 | $(info The following make targets are available:) 3 | @$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --print-data-base --question no-such-target 2>&1 | grep -v 'no-such-target' | \ 4 | grep -v -e '^no-such-target' -e '^makefile' | \ 5 | awk '/^[^.%][-A-Za-z0-9_]*:/ { print substr($$1, 1, length($$1)-1) }' | sort -u 6 | .PHONY: help 7 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/deps.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | deps_gomod_mkfile := $(self_dir)/deps-gomod.mk 4 | deps_glide_mkfile := $(self_dir)/deps-glide.mk 5 | include $(addprefix $(self_dir), \ 6 | ../../lib/golang.mk \ 7 | ) 8 | 9 | ifneq "$(GO) list $(GO_MOD_FLAGS) -m" "" 10 | include $(deps_gomod_mkfile) 11 | else 12 | include $(deps_glide_mkfile) 13 | endif 14 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/operator.mk: -------------------------------------------------------------------------------- 1 | self_dir := $(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | 4 | # We need to be careful to expand all the paths before any include is done 5 | # or self_dir could be modified for the next include by the included file. 6 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 7 | include $(addprefix $(self_dir), \ 8 | default.mk \ 9 | targets/openshift/operator/*.mk \ 10 | ) 11 | 12 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/default.example.mk.help.log: -------------------------------------------------------------------------------- 1 | The following make targets are available: 2 | all 3 | build 4 | clean 5 | clean-binaries 6 | help 7 | image-ocp-cli 8 | images 9 | test 10 | test-unit 11 | update 12 | update-bindata 13 | update-codegen 14 | update-deps-overrides 15 | update-generated 16 | update-gofmt 17 | verify 18 | verify-bindata 19 | verify-codegen 20 | verify-deps 21 | verify-generated 22 | verify-gofmt 23 | verify-golint 24 | verify-govet 25 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/golang.example.mk: -------------------------------------------------------------------------------- 1 | all: build 2 | .PHONY: all 3 | 4 | 5 | # You can customize go tools depending on the directory layout. 6 | # example: 7 | GO_BUILD_PACKAGES :=./pkg/... 8 | # You can list all the golang related variables by: 9 | # $ make -n --print-data-base | grep ^GO 10 | 11 | # Include the library makefile 12 | include ./golang.mk 13 | # All the available targets are listed in .help 14 | # or you can list it live by using `make help` 15 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/operator.example.mk.help.log: -------------------------------------------------------------------------------- 1 | The following make targets are available: 2 | all 3 | build 4 | clean 5 | clean-binaries 6 | help 7 | image-ocp-openshift-apiserver-operator 8 | images 9 | telepresence 10 | test 11 | test-unit 12 | update 13 | update-bindata 14 | update-codegen 15 | update-deps-overrides 16 | update-generated 17 | update-gofmt 18 | verify 19 | verify-bindata 20 | verify-codegen 21 | verify-deps 22 | verify-generated 23 | verify-gofmt 24 | verify-golint 25 | verify-govet 26 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - arghosh93 3 | - arkadeepsen 4 | - jcaamano 5 | - jluhrsen 6 | - kyrtapz 7 | - martinkennelly 8 | - miheer 9 | - pliurh 10 | - pperiyasamy 11 | - ricky-rav 12 | - tssurya 13 | 14 | approvers: 15 | - abhat 16 | - arghosh93 17 | - danwinship 18 | - knobunc 19 | - pliurh 20 | - ricky-rav 21 | - tssurya 22 | - zshi-redhat 23 | 24 | # Bugzilla info; "ovn-kubernetes" is wrong but there is no "generic networking" subcomponent 25 | component: Networking 26 | subcomponent: ovn-kubernetes 27 | -------------------------------------------------------------------------------- /docs/script-template: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | description() { 5 | echo "One-line description" 6 | } 7 | 8 | help () { 9 | echo "This script is a template. Explain how it works here. 10 | 11 | USAGE will be set by network-tools and = \"network-tools script-name\" 12 | 13 | Usage: $USAGE arg1 arg2 14 | 15 | Examples: 16 | $USAGE str1 str2 17 | $USAGE str3 str4 18 | " 19 | } 20 | 21 | main() { 22 | echo "main func" 23 | } 24 | 25 | case "${1:-}" in 26 | description) description ;; 27 | -h|--help) help ;; 28 | *) main "$@" ;; 29 | esac 30 | -------------------------------------------------------------------------------- /vendor/modules.txt: -------------------------------------------------------------------------------- 1 | # github.com/openshift/build-machinery-go v0.0.0-20200917070002-f171684f77ab 2 | ## explicit; go 1.13 3 | github.com/openshift/build-machinery-go 4 | github.com/openshift/build-machinery-go/make 5 | github.com/openshift/build-machinery-go/make/lib 6 | github.com/openshift/build-machinery-go/make/targets 7 | github.com/openshift/build-machinery-go/make/targets/golang 8 | github.com/openshift/build-machinery-go/make/targets/openshift 9 | github.com/openshift/build-machinery-go/make/targets/openshift/operator 10 | github.com/openshift/build-machinery-go/scripts 11 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/lib/version.mk: -------------------------------------------------------------------------------- 1 | # $1 - required version 2 | # $2 - current version 3 | define is_equal_or_higher_version 4 | $(strip $(filter $(2),$(firstword $(shell set -euo pipefail && printf '%s\n%s' '$(1)' '$(2)' | sort -V -r -b)))) 5 | endef 6 | 7 | # $1 - program name 8 | # $2 - required version variable name 9 | # $3 - current version string 10 | define require_minimal_version 11 | $(if $($(2)),\ 12 | $(if $(strip $(call is_equal_or_higher_version,$($(2)),$(3))),,$(error `$(1)` is required with minimal version "$($(2))", detected version "$(3)". You can override this check by using `make $(2):=`)),\ 13 | ) 14 | endef 15 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/operator/telepresence.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | scripts_dir :=$(shell realpath $(self_dir)../../../../scripts) 3 | 4 | telepresence: 5 | $(info Running operator locally against a remote cluster using telepresence (https://telepresence.io)) 6 | $(info ) 7 | $(info To override the operator log level, set TP_VERBOSITY=) 8 | $(info To debug the operator, set TP_DEBUG=y (requires the delve debugger)) 9 | $(info See the run-telepresence.sh script for more usage and configuration details) 10 | $(info ) 11 | bash $(scripts_dir)/run-telepresence.sh 12 | .PHONY: telepresence 13 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/doc.go: -------------------------------------------------------------------------------- 1 | // required for gomod to pull in packages. 2 | 3 | package alpha_build_machinery 4 | 5 | // this is a dependency magnet to make it easier to pull in the build-machinery. We want a single import to pull all of it in. 6 | import ( 7 | _ "github.com/openshift/build-machinery-go/make" 8 | _ "github.com/openshift/build-machinery-go/make/lib" 9 | _ "github.com/openshift/build-machinery-go/make/targets" 10 | _ "github.com/openshift/build-machinery-go/make/targets/golang" 11 | _ "github.com/openshift/build-machinery-go/make/targets/openshift" 12 | _ "github.com/openshift/build-machinery-go/make/targets/openshift/operator" 13 | _ "github.com/openshift/build-machinery-go/scripts" 14 | ) 15 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/golang.mk: -------------------------------------------------------------------------------- 1 | all: build 2 | .PHONY: all 3 | 4 | self_dir := $(dir $(lastword $(MAKEFILE_LIST))) 5 | 6 | 7 | verify: verify-gofmt 8 | verify: verify-govet 9 | .PHONY: verify 10 | 11 | update: update-gofmt 12 | .PHONY: update 13 | 14 | 15 | test: test-unit 16 | .PHONY: test 17 | 18 | clean: clean-binaries 19 | .PHONY: clean 20 | 21 | 22 | # We need to be careful to expand all the paths before any include is done 23 | # or self_dir could be modified for the next include by the included file. 24 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 25 | include $(addprefix $(self_dir), \ 26 | targets/help.mk \ 27 | targets/golang/*.mk \ 28 | ) 29 | -------------------------------------------------------------------------------- /docs/generate-docs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DOCS_FILE="./docs/user.md" 4 | SEPARATOR="The following part of this file is auto-generated based on commands help." 5 | 6 | 7 | print_help() { 8 | ./debug-scripts/network-tools -h | tail -n +4 | 9 | while IFS= read -r line 10 | do 11 | command=$(echo $line | cut -s -d ":" -f 1) 12 | if [ -n "$command" ]; then 13 | echo "## \`network-tools $command\`" 14 | echo 15 | echo "\`\`\`" 16 | ./debug-scripts/network-tools $command -h 17 | echo "\`\`\`" 18 | fi 19 | done 20 | } 21 | 22 | auto_generated_start=$(( $(grep -n "$SEPARATOR" $DOCS_FILE | cut -d: -f 1) +1 )) 23 | sed -i "$auto_generated_start,$ d" $DOCS_FILE 24 | 25 | print_help >> $DOCS_FILE -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/default.mk: -------------------------------------------------------------------------------- 1 | self_dir := $(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | # We extend the default verify/update for Golang 4 | 5 | verify: verify-codegen 6 | verify: verify-bindata 7 | .PHONY: verify 8 | 9 | update: update-codegen 10 | update: update-bindata 11 | .PHONY: update 12 | 13 | 14 | # We need to be careful to expand all the paths before any include is done 15 | # or self_dir could be modified for the next include by the included file. 16 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 17 | include $(addprefix $(self_dir), \ 18 | targets/openshift/deps.mk \ 19 | targets/openshift/images.mk \ 20 | targets/openshift/bindata.mk \ 21 | targets/openshift/codegen.mk \ 22 | golang.mk \ 23 | ) 24 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/images.mk: -------------------------------------------------------------------------------- 1 | # IMAGE_BUILD_EXTRA_FLAGS lets you add extra flags for imagebuilder 2 | # e.g. to mount secrets and repo information into base image like: 3 | # make images IMAGE_BUILD_EXTRA_FLAGS='-mount ~/projects/origin-repos/4.2/:/etc/yum.repos.d/' 4 | IMAGE_BUILD_DEFAULT_FLAGS ?=--allow-pull 5 | IMAGE_BUILD_EXTRA_FLAGS ?= 6 | 7 | # $1 - target name 8 | # $2 - image ref 9 | # $3 - Dockerfile path 10 | # $4 - context 11 | define build-image-internal 12 | image-$(1): 13 | $(strip \ 14 | imagebuilder \ 15 | $(IMAGE_BUILD_DEFAULT_FLAGS) \ 16 | -t $(2) 17 | -f $(3) \ 18 | $(IMAGE_BUILD_EXTRA_FLAGS) \ 19 | $(4) \ 20 | ) 21 | .PHONY: image-$(1) 22 | 23 | images: image-$(1) 24 | .PHONY: images 25 | endef 26 | 27 | define build-image 28 | $(eval $(call build-image-internal,$(1),$(2),$(3),$(4))) 29 | endef 30 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/golang/test-unit.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | test-unit: 4 | ifndef JUNITFILE 5 | $(GO) test $(GO_MOD_FLAGS) $(GO_TEST_FLAGS) $(GO_TEST_PACKAGES) 6 | else 7 | ifeq (, $(shell which gotest2junit 2>/dev/null)) 8 | $(error gotest2junit not found! Get it by `go get -mod='' -u github.com/openshift/release/tools/gotest2junit`.) 9 | endif 10 | set -o pipefail; $(GO) test $(GO_MOD_FLAGS) $(GO_TEST_FLAGS) -json $(GO_TEST_PACKAGES) | gotest2junit > $(JUNITFILE) 11 | endif 12 | .PHONY: test-unit 13 | 14 | # We need to be careful to expand all the paths before any include is done 15 | # or self_dir could be modified for the next include by the included file. 16 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 17 | include $(addprefix $(self_dir), \ 18 | ../../lib/golang.mk \ 19 | ) 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: images 2 | .PHONY: all 3 | 4 | # Include the library makefile 5 | include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ 6 | targets/openshift/images.mk \ 7 | ) 8 | 9 | IMAGE_REGISTRY := registry.ci.openshift.org 10 | 11 | # This will call a macro called "build-image" which will generate image specific targets based on the parameters: 12 | # $0 - macro name 13 | # $1 - target name 14 | # $2 - image ref 15 | # $3 - Dockerfile path 16 | # $4 - context directory for image build 17 | $(call build-image,ocp-network-tools,$(IMAGE_REGISTRY)/ocp/4.7:ocp-network-tools, ./Dockerfile,.) 18 | 19 | # The "rhel" Dockerfile requires fiddling with RHEL subscriptions. 20 | # For testing purposes it's easier to just build a fedora-based image 21 | build-image-network-tools-test: 22 | podman build --no-cache -f ./Dockerfile.fedora -t network-tools-test . 23 | 24 | .PHONY: build-image-network-tools-test 25 | -------------------------------------------------------------------------------- /jira-scripts/single_query: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import time 3 | import bugzilla 4 | 5 | URL = "bugzilla.redhat.com" 6 | bzapi = bugzilla.Bugzilla(URL) 7 | 8 | query = bzapi.build_query( 9 | product="OpenShift Container Platform", 10 | component="Networking", 11 | sub_component="ovn-kubernetes", 12 | ) 13 | 14 | query["status"] = "NEW" 15 | 16 | t1 = time.time() 17 | bugs = bzapi.query(query) 18 | t2 = time.time() 19 | print("Found %d bugs with our query" % len(bugs)) 20 | print("Query processing time: %s" % (t2 - t1)) 21 | 22 | for bug in bugs: 23 | print("Fetched bug #%s:" % bug.id) 24 | print(" Product = %s" % bug.product) 25 | print(" Assigned = %s" % bug.assigned_to) 26 | print(" Component = %s" % bug.component) 27 | print(" Status = %s" % bug.status) 28 | print(" Resolution= %s" % bug.resolution) 29 | print(" Summary = %s" % bug.summary) 30 | print("-------------------\n") 31 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/scripts/update-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | readonly GLIDE_MINOR_VERSION="13" 4 | readonly REQUIRED_GLIDE_VERSION="0.$GLIDE_MINOR_VERSION" 5 | 6 | function verify_glide_version() { 7 | if ! command -v glide &> /dev/null; then 8 | echo "[FATAL] Glide was not found in \$PATH. Please install version ${REQUIRED_GLIDE_VERSION} or newer." 9 | exit 1 10 | fi 11 | 12 | local glide_version 13 | glide_version=($(glide --version)) 14 | if ! echo "${glide_version[2]#v}" | awk -F. -v min=$GLIDE_MINOR_VERSION '{ exit $2 < min }'; then 15 | echo "Detected glide version: ${glide_version[*]}." 16 | echo "Please install Glide version ${REQUIRED_GLIDE_VERSION} or newer." 17 | exit 1 18 | fi 19 | } 20 | 21 | verify_glide_version 22 | 23 | glide update --strip-vendor 24 | 25 | # glide doesn't handle mercurial properly and leaves internal files (equivalent of .git/) laying around 26 | # Given those files differ by mercurial version it was cloned with, verify-deps would break 27 | find ./vendor -name '.hg_archival.txt' -delete 28 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/yq.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | YQ ?=$(PERMANENT_TMP_GOPATH)/bin/yq 4 | yq_dir :=$(dir $(YQ)) 5 | 6 | 7 | ensure-yq: 8 | ifeq "" "$(wildcard $(YQ))" 9 | $(info Installing yq into '$(YQ)') 10 | mkdir -p '$(yq_dir)' 11 | curl -s -f -L https://github.com/mikefarah/yq/releases/download/2.4.0/yq_$(GOHOSTOS)_$(GOHOSTARCH) -o '$(YQ)' 12 | chmod +x '$(YQ)'; 13 | else 14 | $(info Using existing yq from "$(YQ)") 15 | endif 16 | .PHONY: ensure-yq 17 | 18 | clean-yq: 19 | $(RM) '$(YQ)' 20 | if [ -d '$(yq_dir)' ]; then rmdir --ignore-fail-on-non-empty -p '$(yq_dir)'; fi 21 | .PHONY: clean-yq 22 | 23 | clean: clean-yq 24 | 25 | 26 | # We need to be careful to expand all the paths before any include is done 27 | # or self_dir could be modified for the next include by the included file. 28 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 29 | include $(addprefix $(self_dir), \ 30 | ../../lib/golang.mk \ 31 | ../../lib/tmp.mk \ 32 | ) 33 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/golang/build.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | define build-package 4 | $(if $(GO_BUILD_BINDIR),mkdir -p '$(GO_BUILD_BINDIR)',) 5 | $(strip $(GO) build $(GO_MOD_FLAGS) $(GO_BUILD_FLAGS) $(GO_LD_FLAGS) \ 6 | $(if $(GO_BUILD_BINDIR),-o '$(GO_BUILD_BINDIR)/$(notdir $(1))$(GOEXE)',) \ 7 | $(1)) 8 | 9 | endef 10 | 11 | # We need to build each package separately so go build creates appropriate binaries 12 | build: 13 | $(if $(strip $(GO_BUILD_PACKAGES_EXPANDED)),,$(error no packages to build: GO_BUILD_PACKAGES_EXPANDED var is empty)) 14 | $(foreach package,$(GO_BUILD_PACKAGES_EXPANDED),$(call build-package,$(package))) 15 | .PHONY: build 16 | 17 | clean-binaries: 18 | $(RM) $(go_build_binaries) 19 | .PHONY: clean-binaries 20 | 21 | clean: clean-binaries 22 | .PHONY: clean 23 | 24 | # We need to be careful to expand all the paths before any include is done 25 | # or self_dir could be modified for the next include by the included file. 26 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 27 | include $(addprefix $(self_dir), \ 28 | ../../lib/golang.mk \ 29 | ) 30 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/codegen.mk: -------------------------------------------------------------------------------- 1 | CODEGEN_PKG ?=./vendor/k8s.io/code-generator/ 2 | CODEGEN_GENERATORS ?=all 3 | CODEGEN_OUTPUT_BASE ?=../../.. 4 | CODEGEN_GO_HEADER_FILE ?=/dev/null 5 | 6 | CODEGEN_API_PACKAGE ?=$(error CODEGEN_API_PACKAGE is required) 7 | CODEGEN_GROUPS_VERSION ?=$(error CODEGEN_GROUPS_VERSION is required) 8 | CODEGEN_OUTPUT_PACKAGE ?=$(error CODEGEN_OUTPUT_PACKAGE is required) 9 | 10 | define run-codegen 11 | $(CODEGEN_PKG)/generate-groups.sh \ 12 | "$(CODEGEN_GENERATORS)" \ 13 | "$(CODEGEN_OUTPUT_PACKAGE)" \ 14 | "$(CODEGEN_API_PACKAGE)" \ 15 | "$(CODEGEN_GROUPS_VERSION)" \ 16 | --output-base $(CODEGEN_OUTPUT_BASE) \ 17 | --go-header-file $(CODEGEN_GO_HEADER_FILE) \ 18 | $1 19 | endef 20 | 21 | 22 | verify-codegen: 23 | $(call run-codegen,--verify-only) 24 | .PHONY: verify-codegen 25 | 26 | verify-generated: verify-codegen 27 | .PHONY: verify-generated 28 | 29 | verify: verify-generated 30 | .PHONY: verify 31 | 32 | 33 | update-codegen: 34 | $(call run-codegen) 35 | .PHONY: update-codegen 36 | 37 | update-generated: update-codegen 38 | .PHONY: update-generated 39 | 40 | update: update-generated 41 | .PHONY: update 42 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/yaml-patch.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | YAML_PATCH ?=$(PERMANENT_TMP_GOPATH)/bin/yaml-patch 4 | yaml_patch_dir :=$(dir $(YAML_PATCH)) 5 | 6 | 7 | ensure-yaml-patch: 8 | ifeq "" "$(wildcard $(YAML_PATCH))" 9 | $(info Installing yaml-patch into '$(YAML_PATCH)') 10 | mkdir -p '$(yaml_patch_dir)' 11 | curl -s -f -L https://github.com/krishicks/yaml-patch/releases/download/v0.0.10/yaml_patch_$(GOHOSTOS) -o '$(YAML_PATCH)' 12 | chmod +x '$(YAML_PATCH)'; 13 | else 14 | $(info Using existing yaml-patch from "$(YAML_PATCH)") 15 | endif 16 | .PHONY: ensure-yaml-patch 17 | 18 | clean-yaml-patch: 19 | $(RM) '$(YAML_PATCH)' 20 | if [ -d '$(yaml_patch_dir)' ]; then rmdir --ignore-fail-on-non-empty -p '$(yaml_patch_dir)'; fi 21 | .PHONY: clean-yaml-patch 22 | 23 | clean: clean-yaml-patch 24 | 25 | 26 | # We need to be careful to expand all the paths before any include is done 27 | # or self_dir could be modified for the next include by the included file. 28 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 29 | include $(addprefix $(self_dir), \ 30 | ../../lib/golang.mk \ 31 | ../../lib/tmp.mk \ 32 | ) 33 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.21 AS builder 2 | WORKDIR /go/src/github.com/openshift/network-tools 3 | COPY . . 4 | 5 | # needed for ovnkube-trace 6 | FROM registry.ci.openshift.org/ocp/4.21:ovn-kubernetes AS ovnkube-trace 7 | 8 | # tools (openshift-tools) is based off cli 9 | FROM registry.ci.openshift.org/ocp/4.21:tools 10 | COPY --from=builder /go/src/github.com/openshift/network-tools/debug-scripts/ /opt/bin/ 11 | COPY --from=ovnkube-trace /usr/bin/ovnkube-trace /usr/bin/ 12 | 13 | # remove internal scripts from the image and create a symlink for network-tools and gather entrypoint for must-gather 14 | RUN rm -rf /opt/bin/local-scripts && ln -s /opt/bin/network-tools /usr/bin/network-tools && ln -s /opt/bin/network-tools /usr/bin/gather 15 | 16 | 17 | # Make sure to maintain alphabetical ordering when adding new packages. 18 | RUN INSTALL_PKGS="\ 19 | bcc \ 20 | bcc-tools \ 21 | conntrack-tools \ 22 | iproute \ 23 | nginx \ 24 | numactl \ 25 | perf \ 26 | python3-bcc \ 27 | traceroute \ 28 | wireshark-cli \ 29 | " && \ 30 | yum -y install --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False $INSTALL_PKGS && \ 31 | yum clean all && rm -rf /var/cache/* 32 | -------------------------------------------------------------------------------- /debug-scripts/local-scripts/ci-artifacts-get: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | source ./utils 4 | 5 | description() { 6 | echo "Download ci prow job artifacts." 7 | } 8 | 9 | help () { 10 | echo "Download ci prow job artifacts. 11 | 12 | ATTENTION! This is local command, can't be used with must-gather. 13 | ATTENTION! You need gsutil [https://cloud.google.com/storage/docs/gsutil_install] installed. 14 | 15 | Usage: $USAGE [-v] prowjob_url dest_path 16 | 17 | Examples: 18 | $USAGE https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/26359/pull-ci-openshift-origin-master-e2e-aws-single-node/1422822145540493312 ./ 19 | " 20 | } 21 | 22 | main() { 23 | if [[ "$1" == "-v" ]]; then 24 | output_ops="" 25 | shift 26 | else 27 | output_ops=" >/dev/null 2>&1" 28 | fi 29 | gsurl="gs:/" 30 | IFS=$'/' read -a arr <<< "$1" 31 | for substr in "${arr[@]:5}" ; do 32 | gsurl+="/$substr" 33 | done 34 | output_dir=$(ensure_output_dir "${2:-}") 35 | echo "Downloading to $output_dir" 36 | echo "It can take a couple of minutes, please wait" 37 | eval "gsutil -m cp -r $gsurl $output_dir $output_ops" 38 | echo DONE! 39 | } 40 | 41 | case "${1:-}" in 42 | description) description ;; 43 | -h|--help) help ;; 44 | *) main "$@" ;; 45 | esac 46 | 47 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/golang/verify-update.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | go_files_count :=$(words $(GO_FILES)) 4 | 5 | verify-gofmt: 6 | $(info Running `$(GOFMT) $(GOFMT_FLAGS)` on $(go_files_count) file(s).) 7 | @TMP=$$( mktemp ); \ 8 | $(GOFMT) $(GOFMT_FLAGS) $(GO_FILES) | tee $${TMP}; \ 9 | if [ -s $${TMP} ]; then \ 10 | echo "$@ failed - please run \`make update-gofmt\`"; \ 11 | exit 1; \ 12 | fi; 13 | .PHONY: verify-gofmt 14 | 15 | update-gofmt: 16 | $(info Running `$(GOFMT) $(GOFMT_FLAGS) -w` on $(go_files_count) file(s).) 17 | @$(GOFMT) $(GOFMT_FLAGS) -w $(GO_FILES) 18 | .PHONY: update-gofmt 19 | 20 | 21 | # FIXME: go vet needs to use $(GO_MOD_FLAGS) when this is fixed https://github.com/golang/go/issues/35955 22 | # It will be enforced in CI by setting the env var there, so this remains to fix the dev experience 23 | verify-govet: 24 | $(GO) vet $(GO_MOD_FLAGS) $(GO_PACKAGES) 25 | .PHONY: verify-govet 26 | 27 | verify-golint: 28 | $(GOLINT) $(GO_PACKAGES) 29 | .PHONY: verify-govet 30 | 31 | # We need to be careful to expand all the paths before any include is done 32 | # or self_dir could be modified for the next include by the included file. 33 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 34 | include $(addprefix $(self_dir), \ 35 | ../../lib/golang.mk \ 36 | ) 37 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/controller-gen.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | CONTROLLER_GEN_VERSION ?=v0.2.5 4 | CONTROLLER_GEN ?=$(PERMANENT_TMP_GOPATH)/bin/controller-gen 5 | controller_gen_dir :=$(dir $(CONTROLLER_GEN)) 6 | 7 | ensure-controller-gen: 8 | ifeq "" "$(wildcard $(CONTROLLER_GEN))" 9 | $(info Installing controller-gen into '$(CONTROLLER_GEN)') 10 | mkdir -p '$(controller_gen_dir)' 11 | curl -s -f -L https://github.com/openshift/kubernetes-sigs-controller-tools/releases/download/$(CONTROLLER_GEN_VERSION)/controller-gen-$(GOHOSTOS)-$(GOHOSTARCH) -o '$(CONTROLLER_GEN)' 12 | chmod +x '$(CONTROLLER_GEN)'; 13 | else 14 | $(info Using existing controller-gen from "$(CONTROLLER_GEN)") 15 | endif 16 | .PHONY: ensure-controller-gen 17 | 18 | clean-controller-gen: 19 | $(RM) '$(CONTROLLER_GEN)' 20 | if [ -d '$(controller_gen_dir)' ]; then rmdir --ignore-fail-on-non-empty -p '$(controller_gen_dir)'; fi 21 | .PHONY: clean-controller-gen 22 | 23 | clean: clean-controller-gen 24 | 25 | # We need to be careful to expand all the paths before any include is done 26 | # or self_dir could be modified for the next include by the included file. 27 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 28 | include $(addprefix $(self_dir), \ 29 | ../../lib/golang.mk \ 30 | ../../lib/tmp.mk \ 31 | ) 32 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/rpm.mk: -------------------------------------------------------------------------------- 1 | RPM_OUTPUT_DIR ?=_output 2 | RPM_TOPDIR ?=$(abspath ./) 3 | RPM_BUILDDIR ?=$(RPM_TOPDIR) 4 | RPM_BUILDROOT ?=$(RPM_TOPDIR) 5 | RPM_SOURCEDIR ?=$(RPM_TOPDIR) 6 | RPM_SPECDIR ?=$(RPM_TOPDIR) 7 | RPM_RPMDIR ?=$(RPM_TOPDIR)/$(RPM_OUTPUT_DIR)/rpms 8 | RPM_SRCRPMDIR ?=$(RPM_TOPDIR)/$(RPM_OUTPUT_DIR)/srpms 9 | 10 | RPM_SPECFILES ?=$(wildcard *.spec) 11 | RPM_BUILDFLAGS ?=-ba 12 | RPM_EXTRAFLAGS ?= 13 | 14 | rpm-build: 15 | $(strip \ 16 | rpmbuild $(RPM_BUILDFLAGS) \ 17 | --define "_topdir $(RPM_TOPDIR)" \ 18 | --define "_builddir $(RPM_BUILDDIR)" \ 19 | --define "_buildrootdir $(RPM_BUILDROOT)" \ 20 | --define "_rpmdir $(RPM_RPMDIR)" \ 21 | --define "_srcrpmdir $(RPM_SRCRPMDIR)" \ 22 | --define "_specdir $(RPM_SPECDIR)" \ 23 | --define "_sourcedir $(RPM_SOURCEDIR)" \ 24 | --define "go_package $(GO_PACKAGE)" \ 25 | $(RPM_EXTRAFLAGS) \ 26 | $(RPM_SPECFILES) \ 27 | ) 28 | 29 | clean-rpms: 30 | $(RM) -r '$(RPM_RPMDIR)' '$(RPM_SRCRPMDIR)' 31 | if [ -d '$(RPM_OUTPUT_DIR)' ]; then rmdir --ignore-fail-on-non-empty '$(RPM_OUTPUT_DIR)'; fi 32 | .PHONY: clean-rpms 33 | 34 | clean: clean-rpms 35 | 36 | # We need to be careful to expand all the paths before any include is done 37 | # or self_dir could be modified for the next include by the included file. 38 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 39 | include $(addprefix $(self_dir), \ 40 | ../../lib/golang.mk \ 41 | ) 42 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/deps-glide.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | scripts_dir :=$(self_dir)/../../../scripts 3 | 4 | # We need to force localle so different envs sort files the same way for recursive traversals 5 | deps_diff :=LC_COLLATE=C diff --no-dereference -N 6 | 7 | update-deps: 8 | $(scripts_dir)/$@.sh 9 | .PHONY: update-deps 10 | 11 | # $1 - temporary directory to restore vendor dependencies from glide.lock 12 | define restore-deps 13 | ln -s $(abspath ./) "$(1)"/current 14 | cp -R -H ./ "$(1)"/updated 15 | $(RM) -r "$(1)"/updated/vendor 16 | cd "$(1)"/updated && glide install --strip-vendor && find ./vendor -name '.hg_archival.txt' -delete 17 | cd "$(1)" && $(deps_diff) -r {current,updated}/vendor/ > updated/glide.diff || true 18 | endef 19 | 20 | verify-deps: tmp_dir:=$(shell mktemp -d) 21 | verify-deps: 22 | $(call restore-deps,$(tmp_dir)) 23 | @echo $(deps_diff) '$(tmp_dir)'/{current,updated}/glide.diff 24 | @ $(deps_diff) '$(tmp_dir)'/{current,updated}/glide.diff || ( \ 25 | echo "ERROR: Content of 'vendor/' directory doesn't match 'glide.lock' and the overrides in 'glide.diff'!" && \ 26 | echo "If this is an intentional change (a carry patch) please update the 'glide.diff' using 'make update-deps-overrides'." && \ 27 | exit 1 \ 28 | ) 29 | .PHONY: verify-deps 30 | 31 | update-deps-overrides: tmp_dir:=$(shell mktemp -d) 32 | update-deps-overrides: 33 | $(call restore-deps,$(tmp_dir)) 34 | cp "$(tmp_dir)"/{updated,current}/glide.diff 35 | .PHONY: update-deps-overrides 36 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/bindata.mk: -------------------------------------------------------------------------------- 1 | TMP_GOPATH :=$(shell mktemp -d) 2 | 3 | 4 | .ensure-go-bindata: 5 | ln -s $(abspath ./vendor) "$(TMP_GOPATH)/src" 6 | export GO111MODULE=off && export GOPATH=$(TMP_GOPATH) && export GOBIN=$(TMP_GOPATH)/bin && go install "./vendor/github.com/go-bindata/go-bindata/..." 7 | 8 | # $1 - input dirs 9 | # $2 - prefix 10 | # $3 - pkg 11 | # $4 - output 12 | # $5 - output prefix 13 | define run-bindata 14 | $(TMP_GOPATH)/bin/go-bindata -nocompress -nometadata \ 15 | -prefix "$(2)" \ 16 | -pkg "$(3)" \ 17 | -o "$(5)$(4)" \ 18 | -ignore "OWNERS" \ 19 | $(1) && \ 20 | gofmt -s -w "$(5)$(4)" 21 | endef 22 | 23 | # $1 - name 24 | # $2 - input dirs 25 | # $3 - prefix 26 | # $4 - pkg 27 | # $5 - output 28 | define add-bindata-internal 29 | update-bindata-$(1): .ensure-go-bindata 30 | $(call run-bindata,$(2),$(3),$(4),$(5),) 31 | .PHONY: update-bindata-$(1) 32 | 33 | update-bindata: update-bindata-$(1) 34 | .PHONY: update-bindata 35 | 36 | 37 | verify-bindata-$(1): .ensure-go-bindata 38 | verify-bindata-$(1): TMP_DIR := $$(shell mktemp -d) 39 | verify-bindata-$(1): 40 | $(call run-bindata,$(2),$(3),$(4),$(5),$$(TMP_DIR)/) && \ 41 | diff -Naup {.,$$(TMP_DIR)}/$(5) 42 | .PHONY: verify-bindata-$(1) 43 | 44 | verify-bindata: verify-bindata-$(1) 45 | .PHONY: verify-bindata 46 | endef 47 | 48 | 49 | update-generated: update-bindata 50 | .PHONY: update-bindata 51 | 52 | update: update-generated 53 | .PHONY: update 54 | 55 | 56 | verify-generated: verify-bindata 57 | .PHONY: verify-bindata 58 | 59 | verify: verify-generated 60 | .PHONY: verify 61 | 62 | 63 | define add-bindata 64 | $(eval $(call add-bindata-internal,$(1),$(2),$(3),$(4),$(5))) 65 | endef 66 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/README.md: -------------------------------------------------------------------------------- 1 | # library-go/build-machinery-go 2 | These are the building blocks for this and many of our other repositories to share code for Makefiles, helper scripts and other build related machinery. 3 | 4 | ## Makefiles 5 | `make/` directory contains several predefined makefiles `(*.mk)` to choose from and include one of them as a base in your final `Makefile`. These are the predefined flows providing you with e.g. `build`, `test` or `verify` targets. To start with it is recommended you base Makefile on the corresponding `*.example.mk` using copy&paste. 6 | 7 | As some advanced targets are generated, every Makefile contains `make help` target listing all the available ones. All of the "example" makefiles have a corresponding `.help` file listing all the targets available there. 8 | 9 | Also for advanced use and if none of the predefined flows doesn't fit your needs, you can compose the flow from modules in similar way to how the predefined flows do, 10 | 11 | ### Golang 12 | Standard makefile for building pure Golang projects. 13 | - [make/golang.mk](make/golang.mk) 14 | - [make/golang.example.mk](make/golang.example.mk) 15 | - [make/golang.example.mk.help](make/golang.example.mk.help) 16 | 17 | ### Default 18 | Standard makefile for OpenShift Golang projects. 19 | 20 | Extends [#Golang](). 21 | 22 | - [make/default.mk](make/default.mk) 23 | - [make/default.example.mk](make/default.example.mk) 24 | - [make/default.example.mk.help](make/default.example.mk.help) 25 | 26 | ### Operator 27 | Standard makefile for OpenShift Golang projects. 28 | 29 | Extends [#Default](). 30 | 31 | - [make/operator.mk](make/operator.mk) 32 | - [make/operator.example.mk](make/operator.example.mk) 33 | - [make/operator.example.mk.help](make/operator.example.mk.help) 34 | 35 | 36 | ## Scripts 37 | `scripts` contain more complicated logic that is used in some make targets. 38 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/default.example.mk: -------------------------------------------------------------------------------- 1 | all: build 2 | .PHONY: all 3 | 4 | # You can customize go tools depending on the directory layout. 5 | # example: 6 | GO_BUILD_PACKAGES :=./pkg/... 7 | # You can list all the golang related variables by: 8 | # $ make -n --print-data-base | grep ^GO 9 | 10 | # Include the library makefile 11 | include ./default.mk 12 | # All the available targets are listed in .help 13 | # or you can list it live by using `make help` 14 | 15 | # Codegen module needs setting these required variables 16 | CODEGEN_OUTPUT_PACKAGE :=github.com/openshift/cluster-openshift-apiserver-operator/pkg/generated 17 | CODEGEN_API_PACKAGE :=github.com/openshift/cluster-openshift-apiserver-operator/pkg/apis 18 | CODEGEN_GROUPS_VERSION :=openshiftapiserver:v1alpha1 19 | # You can list all codegen related variables by: 20 | # $ make -n --print-data-base | grep ^CODEGEN 21 | 22 | # This will call a macro called "build-image" which will generate image specific targets based on the parameters: 23 | # $1 - target name 24 | # $2 - image ref 25 | # $3 - Dockerfile path 26 | # $4 - context 27 | # It will generate target "image-$(1)" for builing the image an binding it as a prerequisite to target "images". 28 | $(call build-image,ocp-cli,registry.svc.ci.openshift.org/ocp/4.2:cli,./images/cli/Dockerfile.rhel,.) 29 | 30 | # This will call a macro called "add-bindata" which will generate bindata specific targets based on the parameters: 31 | # $0 - macro name 32 | # $1 - target suffix 33 | # $2 - input dirs 34 | # $3 - prefix 35 | # $4 - pkg 36 | # $5 - output 37 | # It will generate targets {update,verify}-bindata-$(1) logically grouping them in unsuffixed versions of these targets 38 | # and also hooked into {update,verify}-generated for broader integration. 39 | $(call add-bindata,v3.11.0,./bindata/v3.11.0/...,bindata,v311_00_assets,pkg/operator/v311_00_assets/bindata.go) 40 | 41 | -------------------------------------------------------------------------------- /debug-scripts/test-networking/ovn_nic_firmware: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | source ./test-networking/common 5 | 6 | 7 | do_nic_firmware_check () { 8 | local nodes=($(get_pod_by_label openshift-ovn-kubernetes app=ovnkube-node)) 9 | local first_node_fw=$(oc exec -n openshift-ovn-kubernetes -c ovnkube-node ${nodes[0]} -- bash -c 'ethtool -i $(ovs-vsctl list-ports br-ex|grep -v patch-br-ex) | grep firmware-version | cut -d ":" -f2 | sed "s/^ *//g"') 10 | local first_node_worker=$(oc get -n openshift-ovn-kubernetes pod ${nodes[0]} -o jsonpath={.spec.nodeName}) 11 | for n in ${nodes[@]:1} ; do 12 | n_fw=$(oc exec -n openshift-ovn-kubernetes -c ovnkube-node ${n} -- bash -c 'ethtool -i $(ovs-vsctl list-ports br-ex|grep -v patch-br-ex) | grep firmware-version | cut -d ":" -f2 | sed "s/^ *//g"') 13 | n_worker=$(oc get -n openshift-ovn-kubernetes pod ${n} -o jsonpath={.spec.nodeName}) 14 | if [[ ${n_fw} == ${first_node_fw} ]]; then 15 | echo "SUCCESS: "Node ${n_worker}" has firmware version "${n_fw}" just like node ${first_node_worker}" 16 | else 17 | echo "FAILURE: "Node ${n_worker}" has firmware version "${n_fw}" unlike node ${first_node_worker}, which is ${first_node_fw}" 18 | fi 19 | done 20 | } 21 | 22 | description() { 23 | echo "Check the firmware of Openshift OVN cluster nodes match" 24 | } 25 | 26 | help() { 27 | echo " 28 | This script checks the firmware of Openshift OVN cluster nodes match. 29 | If there is a NIC firmware mismatch, it will show the firmware version mismatch. 30 | 31 | Usage: $USAGE 32 | 33 | Examples: 34 | $USAGE 35 | 36 | oc adm must-gather $NETWORK_TOOLS_IMAGE -- $USAGE 37 | " 38 | } 39 | 40 | main () { 41 | logdir=$(prepare_logdir openshift-ovn-nic-firmware) 42 | do_nic_firmware_check |& tee $logdir/log 43 | } 44 | 45 | case "${1:-}" in 46 | description) description ;; 47 | -h|--help) help ;; 48 | *) main "$@" ;; 49 | esac 50 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/operator.example.mk: -------------------------------------------------------------------------------- 1 | all: build 2 | .PHONY: all 3 | 4 | 5 | # You can customize go tools depending on the directory layout. 6 | # example: 7 | GO_BUILD_PACKAGES :=./pkg/... 8 | # You can list all the golang related variables by: 9 | # $ make -n --print-data-base | grep ^GO 10 | 11 | # Include the library makefile 12 | include ./operator.mk 13 | # All the available targets are listed in .help 14 | # or you can list it live by using `make help` 15 | 16 | 17 | # Codegen module needs setting these required variables 18 | CODEGEN_OUTPUT_PACKAGE :=github.com/openshift/cluster-openshift-apiserver-operator/pkg/generated 19 | CODEGEN_API_PACKAGE :=github.com/openshift/cluster-openshift-apiserver-operator/pkg/apis 20 | CODEGEN_GROUPS_VERSION :=openshiftapiserver:v1alpha1 21 | # You can list all codegen related variables by: 22 | # $ make -n --print-data-base | grep ^CODEGEN 23 | 24 | # This will call a macro called "build-image" which will generate image specific targets based on the parameters: 25 | # $1 - target name 26 | # $2 - image ref 27 | # $3 - Dockerfile path 28 | # $4 - context 29 | # It will generate target "image-$(1)" for builing the image an binding it as a prerequisite to target "images". 30 | $(call build-image,ocp-openshift-apiserver-operator,registry.svc.ci.openshift.org/ocp/4.2:openshift-apiserver-operator,./Dockerfile.rhel,.) 31 | 32 | # This will call a macro called "add-bindata" which will generate bindata specific targets based on the parameters: 33 | # $0 - macro name 34 | # $1 - target suffix 35 | # $2 - input dirs 36 | # $3 - prefix 37 | # $4 - pkg 38 | # $5 - output 39 | # It will generate targets {update,verify}-bindata-$(1) logically grouping them in unsuffixed versions of these targets 40 | # and also hooked into {update,verify}-generated for broader integration. 41 | $(call add-bindata,v3.11.0,./bindata/v3.11.0/...,bindata,v311_00_assets,pkg/operator/v311_00_assets/bindata.go) 42 | 43 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/deps-gomod.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | # We need to force localle so different envs sort files the same way for recursive traversals 4 | deps_diff :=LC_COLLATE=C diff --no-dereference -N 5 | 6 | # $1 - temporary directory 7 | define restore-deps 8 | ln -s $(abspath ./) "$(1)"/current 9 | cp -R -H ./ "$(1)"/updated 10 | $(RM) -r "$(1)"/updated/vendor 11 | cd "$(1)"/updated && $(GO) mod tidy && $(GO) mod vendor && $(GO) mod verify 12 | cd "$(1)" && $(deps_diff) -r {current,updated}/vendor/ > updated/deps.diff || true 13 | endef 14 | 15 | verify-deps: tmp_dir:=$(shell mktemp -d) 16 | verify-deps: 17 | $(call restore-deps,$(tmp_dir)) 18 | $(deps_diff) "$(tmp_dir)"/{current,updated}/go.mod || ( echo '`go.mod` content is incorrect - did you run `go mod tidy`?' && false ) 19 | $(deps_diff) "$(tmp_dir)"/{current,updated}/go.sum || ( echo '`go.sum` content is incorrect - did you run `go mod tidy`?' && false ) 20 | @echo $(deps_diff) '$(tmp_dir)'/{current,updated}/deps.diff 21 | @ $(deps_diff) '$(tmp_dir)'/{current,updated}/deps.diff || ( \ 22 | echo "ERROR: Content of 'vendor/' directory doesn't match 'go.mod' configuration and the overrides in 'deps.diff'!" && \ 23 | echo 'Did you run `go mod vendor`?' && \ 24 | echo "If this is an intentional change (a carry patch) please update the 'deps.diff' using 'make update-deps-overrides'." && \ 25 | false \ 26 | ) 27 | .PHONY: verify-deps 28 | 29 | update-deps-overrides: tmp_dir:=$(shell mktemp -d) 30 | update-deps-overrides: 31 | $(call restore-deps,$(tmp_dir)) 32 | cp "$(tmp_dir)"/{updated,current}/deps.diff 33 | .PHONY: update-deps-overrides 34 | 35 | 36 | # We need to be careful to expand all the paths before any include is done 37 | # or self_dir could be modified for the next include by the included file. 38 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 39 | include $(addprefix $(self_dir), \ 40 | ../../lib/golang.mk \ 41 | ) 42 | -------------------------------------------------------------------------------- /Dockerfile.fedora: -------------------------------------------------------------------------------- 1 | # This Dockerfile builds the development image of network-tools repo. 2 | # 3 | # NOTE: 4 | # 5 | # This image is only for development environment, so please DO NOT DEPLOY 6 | # this image in any production environment. 7 | # 8 | FROM registry.ci.openshift.org/ocp/4.12:ovn-kubernetes AS ovnkube-trace 9 | 10 | FROM registry.ci.openshift.org/ocp/4.12:tools AS tools 11 | 12 | FROM fedora:latest 13 | COPY --from=ovnkube-trace /usr/bin/ovnkube-trace /usr/bin/ 14 | COPY --from=tools /usr/bin/oc /usr/bin/oc 15 | 16 | # Make sure to maintain alphabetical ordering when adding new packages. 17 | # bash-completion to stress-ng is copied from registry.ci.openshift.org/ocp/4.11:tools Dockerfile 18 | # https://github.com/openshift/oc/blob/master/images/tools/Dockerfile 19 | RUN INSTALL_PKGS="\ 20 | bash-completion \ 21 | bc \ 22 | bcc \ 23 | bcc-tools \ 24 | bind-utils \ 25 | blktrace \ 26 | conntrack-tools \ 27 | crash \ 28 | e2fsprogs \ 29 | ethtool \ 30 | file \ 31 | fio \ 32 | git \ 33 | glibc-utils \ 34 | gzip \ 35 | hwloc \ 36 | iotop \ 37 | iproute \ 38 | iputils \ 39 | jq \ 40 | less \ 41 | ltrace \ 42 | mailx \ 43 | net-tools \ 44 | nginx \ 45 | nmap-ncat \ 46 | numactl \ 47 | parted \ 48 | pciutils \ 49 | perf \ 50 | procps-ng \ 51 | psmisc \ 52 | python3-bcc \ 53 | strace \ 54 | stress-ng \ 55 | sysstat \ 56 | tcpdump \ 57 | tmux \ 58 | traceroute \ 59 | util-linux \ 60 | vim-enhanced \ 61 | wget \ 62 | wireshark-cli \ 63 | xfsprogs \ 64 | " && \ 65 | yum -y install --setopt=tsflags=nodocs --setopt=skip_missing_names_on_install=False $INSTALL_PKGS && \ 66 | yum clean all && rm -rf /var/cache/* 67 | 68 | COPY debug-scripts/ /opt/bin/ 69 | # remove internal scripts from the image and create a symlink for network-tools and gather entrypoint for must-gather 70 | RUN rm -rf /opt/bin/local-scripts && ln -s /opt/bin/network-tools /usr/bin/network-tools && ln -s /opt/bin/network-tools /usr/bin/gather 71 | -------------------------------------------------------------------------------- /debug-scripts/test-networking/sdn_node_connectivity: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | source ./test-networking/common 5 | 6 | # Expects $1 to be in the format that oc get -o name outputs 7 | sdn_underlay_ip(){ 8 | oc get "${1}" -o template --template '{{.hostIP}}' 9 | } 10 | 11 | # Expects $1 to be in the format that oc get -o name outputs 12 | sdn_overlay_ip(){ 13 | local subnet=$(oc get "${1}" -o template --template '{{.subnet}}') 14 | 15 | # Subnet addresses always have by definition the last byte set to zero. 16 | # This means we can assume the last number of the address will always be 17 | # even, so for all we care we only need to handle '[02468]/[012]?[0-9]$'. 18 | echo "${subnet}" | sed -E \ 19 | -e 's@8/([012])?[0-9]$@9@' \ 20 | -e 's@6/([012])?[0-9]$@7@' \ 21 | -e 's@4/([012])?[0-9]$@5@' \ 22 | -e 's@2/([012])?[0-9]$@3@' \ 23 | -e 's@0/([012])?[0-9]$@1@' 24 | } 25 | 26 | do_sdn_node_connectivity_check() { 27 | for node in $(oc get hostsubnet -o name); do 28 | local success=overlay 29 | if ! ping $(sdn_overlay_ip "${node}") -w 2 -W 1 2>&1 >/dev/null ; then 30 | success=underlay 31 | if ! ping $(sdn_underlay_ip "${node}") -w 2 -W 1 2>&1 >/dev/null ; then 32 | success=no 33 | fi 34 | fi 35 | 36 | if [[ "${success}" == "overlay" ]]; then 37 | echo "SUCCESS: Can ping ${node} on the overlay" 38 | elif [[ "${success}" == "underlay" ]]; then 39 | echo "FAIL: Cannot ping ${node} on the overlay but can reach it on the underlay." 40 | else 41 | echo "FAIL: Cannot ping ${node} on the overlay or the underlay." 42 | fi 43 | done 44 | } 45 | 46 | description() { 47 | echo "Check the node connectivity on an Openshift SDN cluster" 48 | } 49 | 50 | help() 51 | { 52 | echo 53 | echo "This script checks the node connectivity on an Openshift SDN cluster from a must-gather pod. 54 | ATTENTION! Can't be run locally 55 | 56 | Usage: oc adm must-gather $NETWORK_TOOLS_IMAGE -- $USAGE 57 | 58 | Examples: 59 | oc adm must-gather $NETWORK_TOOLS_IMAGE -- $USAGE 60 | " 61 | } 62 | 63 | main () { 64 | logdir=$(prepare_logdir openshift-sdn-node-connectivity) 65 | do_sdn_node_connectivity_check |& tee $logdir/log 66 | } 67 | 68 | case "${1:-}" in 69 | description) description ;; 70 | -h|--help) help ;; 71 | *) main "$@" ;; 72 | esac 73 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/Makefile: -------------------------------------------------------------------------------- 1 | SHELL :=/bin/bash 2 | all: verify 3 | .PHONY: all 4 | 5 | makefiles :=$(wildcard ./make/*.example.mk) 6 | examples :=$(wildcard ./make/examples/*/Makefile.test) 7 | 8 | # $1 - makefile name relative to ./make/ folder 9 | # $2 - target 10 | # $3 - output folder 11 | # We need to change dir to the final makefile directory or relative paths won't match. 12 | # Dynamic values are replaced with "" so we can do diff against checkout versions. 13 | # Avoid comparing local paths by stripping the prefix. 14 | # Delete lines referencing temporary files and directories 15 | # Unify make error output between versions 16 | # Ignore old cp errors on centos7 17 | # Ignore different make output with `-k` option 18 | define update-makefile-log 19 | mkdir -p "$(3)" 20 | set -o pipefail; $(MAKE) -j 1 -C "$(dir $(1))" -f "$(notdir $(1))" --no-print-directory --warn-undefined-variables $(2) 2>&1 | \ 21 | sed 's/\.\(buildDate\|versionFromGit\|commitFromGit\|gitTreeState\)="[^"]*" /.\1="" /g' | \ 22 | sed -E 's~/.*/(github.com/openshift/build-machinery-go/.*)~/\1~g' | \ 23 | sed '/\/tmp\/tmp./d' | \ 24 | sed '/git checkout -b/d' | \ 25 | sed -E 's~^[<> ]*((\+\+\+|\-\-\-) \./(testing/)?manifests/.*.yaml).*~\1~' | \ 26 | sed -E 's/^(make\[2\]: \*\*\* \[).*: (.*\] Error 1)/\1\2/' | \ 27 | grep -v 'are the same file' | \ 28 | grep -E -v -e '^make\[2\]: Target `.*'"'"' not remade because of errors\.$$' | \ 29 | tee "$(3)"/"$(notdir $(1))"$(subst ..,.,.$(2).log) 30 | 31 | endef 32 | 33 | 34 | # $1 - makefile name relative to ./make/ folder 35 | # $2 - target 36 | # $3 - output folder 37 | define check-makefile-log 38 | $(call update-makefile-log,$(1),$(2),$(3)) 39 | diff -N "$(1)$(subst ..,.,.$(2).log)" "$(3)/$(notdir $(1))$(subst ..,.,.$(2).log)" 40 | 41 | endef 42 | 43 | update-makefiles: 44 | $(foreach f,$(makefiles),$(call check-makefile-log,$(f),help,$(dir $(f)))) 45 | $(foreach f,$(examples),$(call check-makefile-log,$(f),,$(dir $(f)))) 46 | .PHONY: update-makefiles 47 | 48 | verify-makefiles: tmp_dir:=$(shell mktemp -d) 49 | verify-makefiles: 50 | $(foreach f,$(makefiles),$(call check-makefile-log,$(f),help,$(tmp_dir)/$(dir $(f)))) 51 | $(foreach f,$(examples),$(call check-makefile-log,$(f),,$(tmp_dir)/$(dir $(f)))) 52 | .PHONY: verify-makefiles 53 | 54 | verify: verify-makefiles 55 | .PHONY: verify 56 | 57 | update: update-makefiles 58 | .PHONY: update 59 | 60 | 61 | include ./make/targets/help.mk 62 | -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/lib/golang.mk: -------------------------------------------------------------------------------- 1 | include $(addprefix $(dir $(lastword $(MAKEFILE_LIST))), \ 2 | version.mk \ 3 | ) 4 | 5 | GO ?=go 6 | 7 | GOPATH ?=$(shell $(GO) env GOPATH) 8 | GOOS ?=$(shell $(GO) env GOOS) 9 | GOHOSTOS ?=$(shell $(GO) env GOHOSTOS) 10 | GOARCH ?=$(shell $(GO) env GOARCH) 11 | GOHOSTARCH ?=$(shell $(GO) env GOHOSTARCH) 12 | GOEXE ?=$(shell $(GO) env GOEXE) 13 | GOFLAGS ?=$(shell $(GO) env GOFLAGS) 14 | 15 | GOFMT ?=gofmt 16 | GOFMT_FLAGS ?=-s -l 17 | GOLINT ?=golint 18 | 19 | go_version :=$(shell $(GO) version | sed -E -e 's/.*go([0-9]+.[0-9]+.[0-9]+).*/\1/') 20 | GO_REQUIRED_MIN_VERSION ?=1.14.4 21 | ifneq "$(GO_REQUIRED_MIN_VERSION)" "" 22 | $(call require_minimal_version,$(GO),GO_REQUIRED_MIN_VERSION,$(go_version)) 23 | endif 24 | 25 | # Projects not using modules can clear the variable, but by default we want to prevent 26 | # our projects with modules to unknowingly ignore vendor folder until golang is fixed to use 27 | # vendor folder by default if present. 28 | # 29 | # Conditional to avoid Go 1.13 bug on false double flag https://github.com/golang/go/issues/32471 30 | # TODO: Drop the contitional when golang is fixed so we can see the flag being explicitelly set in logs. 31 | ifeq "$(findstring -mod=vendor,$(GOFLAGS))" "-mod=vendor" 32 | GO_MOD_FLAGS ?= 33 | else 34 | GO_MOD_FLAGS ?=-mod=vendor 35 | endif 36 | 37 | GO_PACKAGE ?=$(shell $(GO) list $(GO_MOD_FLAGS) -m -f '{{ .Path }}' || echo 'no_package_detected') 38 | GO_PACKAGES ?=./... 39 | GO_TEST_PACKAGES ?=$(GO_PACKAGES) 40 | GO_FILES ?=$(shell find . -name '*.go' -not -path '*/vendor/*' -not -path '*/_output/*' -print) 41 | 42 | 43 | GO_BUILD_PACKAGES ?=./cmd/... 44 | GO_BUILD_PACKAGES_EXPANDED ?=$(shell $(GO) list $(GO_MOD_FLAGS) $(GO_BUILD_PACKAGES)) 45 | go_build_binaries =$(notdir $(GO_BUILD_PACKAGES_EXPANDED)) 46 | GO_BUILD_FLAGS ?=-trimpath 47 | GO_BUILD_BINDIR ?= 48 | 49 | GO_TEST_FLAGS ?=-race 50 | 51 | GO_LD_EXTRAFLAGS ?= 52 | 53 | SOURCE_GIT_TAG ?=$(shell git describe --long --tags --abbrev=7 --match 'v[0-9]*' || echo 'v0.0.0-unknown') 54 | SOURCE_GIT_COMMIT ?=$(shell git rev-parse --short "HEAD^{commit}" 2>/dev/null) 55 | SOURCE_GIT_TREE_STATE ?=$(shell ( ( [ ! -d ".git/" ] || git diff --quiet ) && echo 'clean' ) || echo 'dirty') 56 | 57 | define version-ldflags 58 | -X $(1).versionFromGit="$(SOURCE_GIT_TAG)" \ 59 | -X $(1).commitFromGit="$(SOURCE_GIT_COMMIT)" \ 60 | -X $(1).gitTreeState="$(SOURCE_GIT_TREE_STATE)" \ 61 | -X $(1).buildDate="$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" 62 | endef 63 | GO_LD_FLAGS ?=-ldflags "-s -w $(call version-ldflags,$(GO_PACKAGE)/pkg/version) $(GO_LD_EXTRAFLAGS)" 64 | -------------------------------------------------------------------------------- /debug-scripts/test-networking/main: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | source ./test-networking/common 5 | source ./utils 6 | 7 | description() { 8 | echo "Runs connectivity checks for ovn-kubernetes or openshift-sdn networking plugins" 9 | } 10 | 11 | help() { 12 | echo "Run default debug sequence based on Networking plugin. 13 | Only OpenShiftSDN and OVNKubernetes plugins are supported for now. You can also run all scripts manually and provide 14 | some options. 15 | 16 | Default scripts are: 17 | * OVNKubernetes = ovn_pod_to_pod_connectivity, ovn_pod_to_svc_connectivity, ovn_ipsec_connectivity 18 | * OpenshiftSDN = sdn_pod_to_pod_connectivity, sdn_pod_to_svc_connectivity, sdn_cluster_and_node_info 19 | 20 | Usage: $USAGE 21 | 22 | Examples: 23 | $USAGE 24 | 25 | oc adm must-gather $NETWORK_TOOLS_IMAGE -- $USAGE 26 | " 27 | } 28 | 29 | function main() { 30 | ensure_ns 31 | network_plugin=$(get_network_plugin) 32 | echo "INFO: Cluster is using $network_plugin network plugin" 33 | # Create basic resources that can be reused for any test. 34 | # NOTE: Test specific resources should be created within the script. 35 | 36 | client="network-tools-debug-pod-$(get_random_name)" 37 | server="network-tools-debug-svc"-$(get_random_name) 38 | create_pod_on_node $client 39 | create_svc $server 40 | global_namespace=$(oc get pod $client -o jsonpath={.metadata.namespace}) 41 | # make sure all script will have the same output dir 42 | export LOGDIR=${LOGDIR:-"./network-test-logs-$(get_random_name)"} 43 | if [[ "$network_plugin" == "$OVN_PLUGIN" ]] ; then 44 | # run scripts 45 | ./test-networking/ovn_pod_to_pod_connectivity "$global_namespace"/"$client" "$global_namespace"/"$server" 46 | ./test-networking/ovn_pod_to_svc_connectivity "$global_namespace"/"$client" "$global_namespace"/"$server" 47 | ./test-networking/ovn_ipsec_connectivity 48 | elif [[ "$network_plugin" == "$SDN_PLUGIN" ]] ; then 49 | # run scripts 50 | ./test-networking/sdn_pod_to_pod_connectivity "$global_namespace"/"$client" "$global_namespace"/"$server" 51 | ./test-networking/sdn_pod_to_svc_connectivity "$global_namespace"/"$client" "$global_namespace"/"$server" 52 | ./test-networking/sdn_cluster_and_node_info 53 | if [ -n "$POD_NAME" ]; then 54 | # sdn_node_connectivity should not be run locally, $POD_NAME will be set when running with must-gather 55 | ./test-networking/sdn_node_connectivity 56 | fi 57 | else 58 | echo "Unable to debug cluster networking. Only OpenShiftSDN and OVNKubernetes plugins are supported" 59 | fi 60 | } 61 | 62 | case "${1:-}" in 63 | description) description ;; 64 | -h|--help) help ;; 65 | *) main "$@" ;; 66 | esac -------------------------------------------------------------------------------- /vendor/github.com/openshift/build-machinery-go/make/targets/openshift/crd-schema-gen.mk: -------------------------------------------------------------------------------- 1 | self_dir :=$(dir $(lastword $(MAKEFILE_LIST))) 2 | 3 | # $1 - crd file 4 | # $2 - patch file 5 | define patch-crd-yq 6 | $(YQ) m -i -x '$(1)' '$(2)' 7 | 8 | endef 9 | 10 | # $1 - crd file 11 | # $2 - patch file 12 | define patch-crd-yaml-patch 13 | $(YAML_PATCH) -o '$(2)' < '$(1)' > '$(1).patched' 14 | mv '$(1).patched' '$(1)' 15 | 16 | endef 17 | 18 | empty := 19 | 20 | define diff-file 21 | diff -Naup '$(1)' '$(2)' 22 | 23 | endef 24 | 25 | # $1 - apis 26 | # $2 - manifests 27 | # $3 - output 28 | define run-crd-gen 29 | '$(CONTROLLER_GEN)' \ 30 | schemapatch:manifests="$(2)" \ 31 | paths="$(subst $(empty) ,;,$(1))" \ 32 | output:dir="$(3)" 33 | $$(foreach p,$$(wildcard $(2)/*.crd.yaml-merge-patch),$$(call patch-crd-yq,$$(subst $(2),$(3),$$(basename $$(p))).yaml,$$(p))) 34 | $$(foreach p,$$(wildcard $(2)/*.crd.yaml-patch),$$(call patch-crd-yaml-patch,$$(subst $(2),$(3),$$(basename $$(p))).yaml,$$(p))) 35 | endef 36 | 37 | 38 | # $1 - target name 39 | # $2 - apis 40 | # $3 - manifests 41 | # $4 - output 42 | define add-crd-gen-internal 43 | 44 | update-codegen-crds-$(1): ensure-controller-gen ensure-yq ensure-yaml-patch 45 | $(call run-crd-gen,$(2),$(3),$(4)) 46 | .PHONY: update-codegen-crds-$(1) 47 | 48 | update-codegen-crds: update-codegen-crds-$(1) 49 | .PHONY: update-codegen-crds 50 | 51 | verify-codegen-crds-$(1): VERIFY_CODEGEN_CRD_TMP_DIR:=$$(shell mktemp -d) 52 | verify-codegen-crds-$(1): ensure-controller-gen ensure-yq ensure-yaml-patch 53 | $(call run-crd-gen,$(2),$(3),$$(VERIFY_CODEGEN_CRD_TMP_DIR)) 54 | $$(foreach p,$$(wildcard $(4)/*crd.yaml),$$(call diff-file,$$(p),$$(subst $(4),$$(VERIFY_CODEGEN_CRD_TMP_DIR),$$(p)))) 55 | .PHONY: verify-codegen-crds-$(1) 56 | 57 | verify-codegen-crds: verify-codegen-crds-$(1) 58 | .PHONY: verify-codegen-crds 59 | 60 | endef 61 | 62 | 63 | update-generated: update-codegen-crds 64 | .PHONY: update-generated 65 | 66 | update: update-generated 67 | .PHONY: update 68 | 69 | verify-generated: verify-codegen-crds 70 | .PHONY: verify-generated 71 | 72 | verify: verify-generated 73 | .PHONY: verify 74 | 75 | 76 | define add-crd-gen 77 | $(eval $(call add-crd-gen-internal,$(1),$(2),$(3),$(4))) 78 | endef 79 | 80 | 81 | # We need to be careful to expand all the paths before any include is done 82 | # or self_dir could be modified for the next include by the included file. 83 | # Also doing this at the end of the file allows us to use self_dir before it could be modified. 84 | include $(addprefix $(self_dir), \ 85 | ../../lib/golang.mk \ 86 | ../../lib/tmp.mk \ 87 | ../../targets/openshift/controller-gen.mk \ 88 | ../../targets/openshift/yq.mk \ 89 | ../../targets/openshift/yaml-patch.mk \ 90 | ) 91 | -------------------------------------------------------------------------------- /debug-scripts/scripts/ovn-metrics-list: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | source ./utils 5 | 6 | description() { 7 | echo "Collect OVN networking metrics: control-plane, node, and ovn" 8 | } 9 | 10 | help () { 11 | echo "This script collects OVN networking metrics: control-plane, node, and ovn. 12 | Metrics will be collected from leader host, unless a node is provided. 13 | If output folder is not specified, local path will be used. 14 | 15 | Usage: $USAGE [-n node] [output_folder] 16 | 17 | Examples: 18 | $USAGE 19 | $USAGE -n node_name 20 | $USAGE --node node_name /some/path/metrics 21 | $USAGE /some/path/metrics 22 | 23 | oc adm must-gather $NETWORK_TOOLS_IMAGE -- $USAGE /must-gather 24 | " 25 | } 26 | 27 | main() { 28 | dir=$(ensure_output_dir "${1:-}") 29 | echo "Output directory ${dir}" 30 | if [ -n "${node_name}" ]; then 31 | # Validate node name provided 32 | oc get node $node_name -o name 2>/dev/null || { echo "Can't get node ${node_name}" 1>&2; exit 1; } 33 | else 34 | node_name="$(get_ovnk_leader_node)" 35 | fi 36 | # Find out if there is a control/master pod running in the provided node. Leader/control-plane nodes will have one. 37 | node_control_pod="$(oc get pods -n $OVN_NAMESPACE --field-selector spec.nodeName=${node_name} -l 'app in (ovnkube-master,ovnkube-control-plane)' -o=jsonpath='{.items..metadata.name}')" 38 | node_pod="$(oc get pods -n $OVN_NAMESPACE --field-selector spec.nodeName=$node_name -l app=ovnkube-node -o=jsonpath='{.items..metadata.name}')" 39 | OVN_CTL_CONTAINER="$(get_ovn_controller_container_name)" 40 | if [ $(get_ovn_mode) == "ovn-ic" ]; then 41 | [ -n "${node_control_pod}" ] && \ 42 | oc -n "$OVN_NAMESPACE" exec "$node_control_pod" -c ovnkube-cluster-manager -- curl "127.0.0.1:29108/metrics" > "$dir/$node_control_pod-29108(control-plane)" 43 | oc -n "$OVN_NAMESPACE" exec "$node_pod" -c "$OVN_CTL_CONTAINER" -- curl "127.0.0.1:29103/metrics" > "$dir/$node_pod-29103(node)" 44 | oc -n "$OVN_NAMESPACE" exec "$node_pod" -c "$OVN_CTL_CONTAINER" -- curl "127.0.0.1:29105/metrics" > "$dir/$node_pod-29105(ovn)" 45 | else 46 | [ -n "${node_control_pod}" ] && \ 47 | oc -n "$OVN_NAMESPACE" exec "$node_control_pod" -c "$OVN_CTL_CONTAINER" -- curl "127.0.0.1:29102/metrics" > "$dir/$node_control_pod-29102(master)" 48 | oc -n "$OVN_NAMESPACE" exec "$node_pod" -c ovnkube-node -- curl "127.0.0.1:29103/metrics" > "$dir/$node_pod-29103(node)" 49 | oc -n "$OVN_NAMESPACE" exec "$node_pod" -c ovnkube-node -- curl "127.0.0.1:29105/metrics" > "$dir/$node_pod-29105(ovn)" 50 | fi 51 | } 52 | 53 | node_name="" 54 | case "${1:-}" in 55 | -n|--node) 56 | node_name="$2" 57 | shift 2 58 | ;; 59 | *) ;; 60 | esac 61 | 62 | case "${1:-}" in 63 | description) description ;; 64 | -h|--help) help ;; 65 | *) main "$@" ;; 66 | esac 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | network-tools 2 | ============= 3 | 4 | `network-tools` is a collection of tools for debugging OpenShift cluster network issues. 5 | It contains both debugging scripts (described in the next section) and useful tools to get 6 | information from the cluster. This repo is supposed to be used by network engineers and 7 | support to debug and diagnose issues. Customers can also be advised to use commands from this 8 | image to help get required information. 9 | 10 | ## How to use 11 | 12 | ### Locally 13 | To use network-tools locally, you can just clone this repo and run 14 | `./debug-scripts/network-tools -h` - that will list all available commands. 15 | 16 | You can also create a symlink for your convenience to just use `network-tools` 17 | `ln -s /debug-scripts/network-tools /usr/bin/network-tools` 18 | `network-tools -h` 19 | 20 | ### On the cluster 21 | 22 | You can use almost all the same scripts on the cluster via network-tools image, to run one command you can use 23 | `oc adm must-gather --image-stream openshift/network-tools:latest -- network-tools -h` 24 | 25 | WARNING! `must-gather` doesn't allow interactive input, don't use interactive options with must-gather. 26 | WARNING! For clusters older than 4.13, use `--image quay.io/openshift/origin-network-tools:latest` instead of `--image-streams` 27 | 28 | For more examples and options check [user docs](https://github.com/openshift/network-tools/blob/main/docs/user.md) 29 | 30 | ## Debugging Scripts 31 | Debugging scripts are kept in `debug-scripts`. The content of that folder is placed in `/opt/bin` in the image. 32 | Symlink is created for `/opt/bin/network-tools` to `/usr/bin/network-tools` that allows to just call `network-tools`. 33 | 34 | `debug-scripts/local-scripts` folder contains scripts that shouldn't be run on the cluster via `oc adm must-gather`, they 35 | are not copied to the image. But these scripts are available for local use (`network-tools -h` will list currently available commands). 36 | 37 | `debug-scripts/network-tools` is a single entry point for all commands that were tested and properly documented. Not all scripts from 38 | `debug-scripts` folder may be included to the `network-tools`. If you need to run such a script, call it directly via 39 | `debug-scripts/