Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ container-build: build
@echo "Building the container image"
$(CONTAINER_BUILD) -f containers/Containerfile \
--build-arg RHEL_VERSION=$(RHEL_VERSION) \
-t $(CONTAINER_NS)/$(BIN):latest ./containers
-t $(CONTAINER_NS)/$(BIN):latest .

gha-build:
@echo "Building the container image for GHA"
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $ make build
```shell
$ git clone http://github.com/cloud-bulldozer/k8s-netperf
$ cd k8s-netperf
$ make docker-build
$ make container-build
```

## Running
Expand Down Expand Up @@ -95,6 +95,23 @@ Flags:

> *Note: With OpenShift, we attempt to discover the OpenShift route. If that route is not reachable, it might be required to `port-forward` the service and pass that via the `--prom` option.*

## Running in a Container

You can also run `k8s-netperf` in a container. Here is an example command on how to execute it:

```shell
$ podman run -v ~/.kube/config:/root/.kube/config -v $(pwd)/netperf.yml:/netperf.yml quay.io/cloud-bulldozer/k8s-netperf:latest k8s-netperf --config /netperf.yml
```

This command does the following:

* ```-v ~/.kube/config:/root/.kube/config```: Mounts your local kubeconfig into the container at /root/.kube/config. This allows k8s-netperf to interact with your Kubernetes cluster.
* ```-v $(pwd)/netperf.yml:/netperf.yml```: Mounts your local netperf.yml configuration file into the container at /netperf.yml.
* ```quay.io/cloud-bulldozer/k8s-netperf:latest```: Specifies the container image to run. In this case, it's the latest version of k8s-netperf from quay.io.
* ```k8s-netperf --config /netperf.yml```: The command to run inside the container. This starts k8s-netperf with your configuration file.

Please replace `~/.kube/config` and `$(pwd)/netperf.yml` with the paths to your kubeconfig and `netperf.yml` files, respectively.

### Config file
#### Config File v2
The v2 config file will be executed in the order the tests are presented in the config file.
Expand Down
27 changes: 24 additions & 3 deletions containers/Containerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
# RHEL_VERSION defined in Makefile
FROM golang:1.19 AS builder
# smoke test to verify if golang is available
RUN go version

ARG PROJECT_VERSION=latest

COPY . /go/src/github.com/jtaleric/k8s-netperf/
WORKDIR /go/src/github.com/jtaleric/k8s-netperf/
RUN set -Eeux && \
go mod download && \
go mod verify

RUN GOOS=linux GOARCH=amd64 \
go build \
-trimpath \
-ldflags="-w -s -X 'main.Version=${PROJECT_VERSION}'" \
-o ./k8s-netperf cmd/k8s-netperf/k8s-netperf.go
RUN go test -cover -v ./...

ARG RHEL_VERSION
FROM registry.access.redhat.com/${RHEL_VERSION}:latest

COPY appstream.repo /etc/yum.repos.d/centos8-appstream.repo
COPY ./containers/appstream.repo /etc/yum.repos.d/centos8-appstream.repo

COPY netperf.diff /tmp/netperf.diff
COPY ./containers/netperf.diff /tmp/netperf.diff
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && dnf clean all
RUN dnf install -y uperf && dnf clean all

Expand All @@ -31,4 +50,6 @@ RUN curl -L https://github.com/esnet/iperf/releases/download/3.16/iperf-3.16.tar

RUN rm -rf netperf && \
dnf clean all
COPY super-netperf /usr/bin/super-netperf
COPY ./containers/super-netperf /usr/bin/super-netperf

COPY --from=builder /go/src/github.com/jtaleric/k8s-netperf/k8s-netperf /usr/bin/k8s-netperf