Skip to content

Commit ea0fe54

Browse files
author
Mario Macias
authored
NETOBSERV-258: JSON+Kafka export (#33)
* NETOBSERV-258: integration tests env & not-yet-working JSON+Kafka conversion * working JSON conversion * tests are passing * fix linter and parallel tests * documented and cleaned-up code * reused common code in e2e tests * Disabling kafka batch timeout * Updated build image
1 parent 5c6d858 commit ea0fe54

File tree

269 files changed

+91118
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+91118
-553
lines changed

Dockerfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,11 @@
11
# Build the manager binary
2-
FROM registry.access.redhat.com/ubi8/go-toolset:1.16.7-5 as builder
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.17.7 as builder
33

44
ARG SW_VERSION="unknown"
55
ARG GOVERSION="1.17.8"
66

77
WORKDIR /opt/app-root
88

9-
# TEMPORARY STEPS UNTIL ubi8 releases a go1.17 image
10-
RUN wget -q https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz && tar -xzf go$GOVERSION.linux-amd64.tar.gz
11-
ENV GOROOT /opt/app-root/go
12-
RUN mkdir -p /opt/app-root/gopath
13-
ENV GOPATH /opt/app-root/gopath
14-
ENV PATH $GOROOT/bin:$GOPATH/bin:$PATH
15-
WORKDIR /opt/app-root/src
16-
# END OF LINES TO REMOVE
17-
189
# Copy the go manifests and source
1910
COPY .git/ .git/
2011
COPY bpf/ bpf/
@@ -29,9 +20,9 @@ COPY Makefile Makefile
2920
RUN make compile
3021

3122
# Create final image from minimal + built binary
32-
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5-240
23+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
3324
WORKDIR /
34-
COPY --from=builder /opt/app-root/src/bin/netobserv-ebpf-agent .
25+
COPY --from=builder /opt/app-root/bin/netobserv-ebpf-agent .
3526
USER 65532:65532
3627

3728
ENTRYPOINT ["/netobserv-ebpf-agent"]

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ IMG_SHA = $(IMAGE_TAG_BASE):$(BUILD_SHA)
2222
LOCAL_GENERATOR_IMAGE ?= ebpf-generator:latest
2323

2424
CILIUM_EBPF_VERSION := v0.8.1
25-
GOLANGCI_LINT_VERSION = v1.42.1
25+
GOLANGCI_LINT_VERSION = v1.46.2
2626

2727
CLANG ?= clang
2828
CFLAGS := -O2 -g -Wall -Werror $(CFLAGS)
@@ -49,11 +49,11 @@ vendors:
4949
.PHONY: prereqs
5050
prereqs:
5151
@echo "### Check if prerequisites are met, and installing missing dependencies"
52-
test -f $(go env GOPATH)/bin/golangci-lint || GOFLAGS="" go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
53-
test -f $(go env GOPATH)/bin/bpf2go || go install github.com/cilium/ebpf/cmd/bpf2go@${CILIUM_EBPF_VERSION}
54-
test -f $(go env GOPATH)/bin/protoc-gen-go || go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
55-
test -f $(go env GOPATH)/bin/protoc-gen-go-grpc || go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
56-
test -f $(go env GOPATH)/bin/kind || go install sigs.k8s.io/kind@latest
52+
test -f $(shell go env GOPATH)/bin/golangci-lint || GOFLAGS="" go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
53+
test -f $(shell go env GOPATH)/bin/bpf2go || go install github.com/cilium/ebpf/cmd/bpf2go@${CILIUM_EBPF_VERSION}
54+
test -f $(shell go env GOPATH)/bin/protoc-gen-go || go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
55+
test -f $(shell go env GOPATH)/bin/protoc-gen-go-grpc || go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
56+
test -f $(shell go env GOPATH)/bin/kind || go install sigs.k8s.io/kind@latest
5757

5858
.PHONY: fmt
5959
fmt: ## Run go fmt against code.
@@ -130,4 +130,4 @@ tests-e2e: prereqs
130130
# environments: (1) as image tagged in the local repository (2) as image archive.
131131
$(OCI_BIN) build . -t localhost/ebpf-agent:test
132132
$(OCI_BIN) save -o ebpf-agent.tar localhost/ebpf-agent:test
133-
GOOS=$(GOOS) go test -v -mod vendor -tags e2e ./e2e/...
133+
GOOS=$(GOOS) go test -p 1 -timeout 30m -v -mod vendor -tags e2e ./e2e/...

docs/config.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
The following environment variables are available to configure the NetObserv eBFP Agent:
44

5-
* `FLOWS_TARGET_HOST` (required). Host name or IP of the target Flow collector.
6-
* `FLOWS_TARGET_PORT` (required). Port of the target flow collector.
5+
* `EXPORT` (default: `grpc`). Flows' exporter protocol. Accepted values are: `grpc` or `kafka`.
6+
* `FLOWS_TARGET_HOST` (required if `EXPORT` is `grpc`). Host name or IP of the target Flow collector.
7+
* `FLOWS_TARGET_PORT` (required if `EXPORT` is `grpc`). Port of the target flow collector.
78
* `INTERFACES` (optional). Comma-separated list of the interface names from where flows will be collected. If
89
empty, the agent will use all the interfaces in the system, excepting the ones listed in
910
the `EXCLUDE_INTERFACES` variable.
@@ -33,3 +34,15 @@ The following environment variables are available to configure the NetObserv eBF
3334
`LISTEN_POLL_PERIOD` variable.
3435
* `LISTEN_POLL_PERIOD` (default: `10s`). When `LISTEN_INTERFACES` value is `poll`, this duration
3536
string specifies the frequency in which the current network interfaces are polled.
37+
* `KAFKA_BROKERS` (required if `EXPORT` is `kafka`). Comma-separated list of tha addresses of the
38+
brokers of the Kafka cluster that this agent is configured to send messages to.
39+
* `KAFKA_TOPIC`(default: `network-flows`). Name of the topic where the flows' processor will receive
40+
the flows from.
41+
* `KAFKA_BATCH_SIZE` (default: `100`). Limit on how many messages will be buffered before being sent
42+
to a Kafka partition.
43+
* `KAFKA_BATCH_BYTES` (default: `1048576`). Limit of the maximum size of a request in bytes before
44+
being sent to a Kafka partition.
45+
* `KAFKA_ASYNC` (default: `true`). If `true`, the message writing process will never block. It also
46+
means that errors are ignored since the caller will not receive the returned value.
47+
* `KAFKA_COMPRESSION` (default: `none`). Compression codec to be used to compress messages. Accepted
48+
values: `none`, `gzip`, `snappy`, `lz4`, `zstd`.

docs/vsipfix.md

Lines changed: 0 additions & 162 deletions
This file was deleted.

0 commit comments

Comments
 (0)