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

Initial import #1

Merged
merged 1 commit into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# IDEs
/.vscode
/.settings
*.swp
.vimrc
.DS_Store
.idea
*.go~

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.12 AS builder
WORKDIR /go/src/github.com/openshift/debug-network
COPY . .
ENV GO_PACKAGE github.com/openshift/debug-network

FROM registry.svc.ci.openshift.org/openshift/origin-v4.0:cli
COPY --from=builder /go/src/github.com/openshift/debug-network/debug-scripts/* /usr/bin/

8 changes: 8 additions & 0 deletions Dockerfile.rhel7
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM registry.svc.ci.openshift.org/ocp/builder:golang-1.12 AS builder
WORKDIR /go/src/github.com/openshift/debug-network
COPY . .
ENV GO_PACKAGE github.com/openshift/debug-network

FROM registry.svc.ci.openshift.org/ocp/4.6:cli
COPY --from=builder /go/src/github.com/openshift/debug-network/debug-scripts/* /usr/bin/
RUN yum -y install jq tcpdump traceroute net-tools nmap-ncat pciutils strace numactl; yum clean all
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
all: images
.PHONY: all

# Include the library makefile
include $(addprefix ./vendor/github.com/openshift/library-go/alpha-build-machinery/make/, \
targets/openshift/images.mk \
)

IMAGE_REGISTRY :=registry.svc.ci.openshift.org

# This will call a macro called "build-image" which will generate image specific targets based on the parameters:
# $0 - macro name
# $1 - target name
# $2 - image ref
# $3 - Dockerfile path
# $4 - context directory for image build
$(call build-image,ocp-debug-network,$(IMAGE_REGISTRY)/ocp/4.6:ocp-debug-network, ./Dockerfile.rhel7,.)
4 changes: 4 additions & 0 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reviewers:
- rcarrillocruz
approvers:
- rcarrillocruz
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
debug-network
=============

`openshift-debug-network` is a tool for debugging network.
The directory structure, as well as specific details behind this tool can be found [in this enhancement](https://github.com/openshift/enhancements/blob/master/enhancements/oc/debug-network.md).

## Debugging Scripts
Debugging scripts are kept in `./debug-scripts`. The content of that folder is placed in `/usr/bin` in the image.
The debug network scripts should only include debug logic for OpenShift Networking.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be Networking plugins that are developed as part of OpenShift.

Outside components are encouraged to produce a similar "debug-network" image, but this is not the spot to be
included.
4 changes: 4 additions & 0 deletions debug-scripts/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
reviewers:
- rcarrillocruz
approvers:
- rcarrillocruz
7 changes: 7 additions & 0 deletions debug-scripts/debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# generate /debug-network/version file
. version
echo "openshift/debug-network" > /debug-network/version
version >> /debug-networking/version

17 changes: 17 additions & 0 deletions debug-scripts/version
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

function version() {
# get version from image
version=$( \
oc status | grep '^pod' | \
sed -n -r -e 's/.*([[:digit:]]+\.[[:digit:]]+(:?\.[[:digit:]])?(:?-[^@]+)?).*/\1/p' \
)

# if version not found, fallback to imageID
[ -z "${version}" ] && version=$(oc status | grep '^pod.*runs' | sed -r -e 's/^pod.*runs //')

# if version still not found, use Unknown
[ -z "${version}" ] && version="Unknown"

echo ${version}
}
25 changes: 25 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module github.com/openshift/debug-networking

go 1.14

require (
github.com/Microsoft/hcsshim v0.8.9 // indirect
github.com/containerd/containerd v1.4.0 // indirect
github.com/containerd/continuity v0.0.0-20200710164510-efbc4488d8fe // indirect
github.com/containers/storage v1.23.4 // indirect
github.com/docker/docker v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible // indirect
github.com/fsouza/go-dockerclient v1.6.5 // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/openshift/imagebuilder v1.1.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
golang.org/x/net v0.0.0-20200904194848-62affa334b73 // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f // indirect
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
google.golang.org/grpc v1.31.1 // indirect
google.golang.org/protobuf v1.25.0 // indirect
k8s.io/klog v1.0.0 // indirect
)
292 changes: 292 additions & 0 deletions go.sum

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions pkg/tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// *build tools

package tools

import (
_ "github.com/openshift/library-go/alpha-build-machinery"
)
201 changes: 201 additions & 0 deletions vendor/github.com/openshift/library-go/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.