Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ lint: $(GOLANGCI_LINT) ## Lint the code
build_code: validate_go lint
@go mod vendor
go build -ldflags "-X 'main.BuildVersion=$(BUILD_VERSION)' -X 'main.BuildDate=$(BUILD_DATE)'" "${CMD_DIR}${FLP_BIN_FILE}"
go build -ldflags "-X 'main.BuildVersion=$(BUILD_VERSION)' -X 'main.BuildDate=$(BUILD_DATE)'" "${CMD_DIR}${CG_BIN_FILE}"

.PHONY: build
build: build_code docs ## Build flowlogs-pipeline executable and update the docs
Expand Down
7 changes: 5 additions & 2 deletions cmd/confgenerator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ import (
)

var (
BuildVersion string
BuildDate string
cfgFile string
logLevel string
envPrefix = "FLP_CONFGEN"
Expand Down Expand Up @@ -143,8 +145,9 @@ func main() {
}

func run() {
// Starting log message
log.Infof("starting %s", filepath.Base(os.Args[0]))
// Initial log message
fmt.Printf("Starting %s:\n=====\nBuild Version: %s\nBuild Date: %s\n\n",
filepath.Base(os.Args[0]), BuildVersion, BuildDate)
// Dump the configuration
dumpConfig()
// creating a new configuration generator
Expand Down
38 changes: 38 additions & 0 deletions cmd/confgenerator/main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 IBM, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package main

import (
"os"
"os/exec"
"testing"
)

func TestTheMain(t *testing.T) {
if os.Getenv("BE_CRASHER") == "1" {
main()
return
}
cmd := exec.Command(os.Args[0], "-test.run=TestTheMain")
cmd.Env = append(os.Environ(), "BE_CRASHER=1")
err := cmd.Run()
if e, ok := err.(*exec.ExitError); ok && !e.Success() {
return
}
t.Fatalf("process ran with err %v, want exit status 1", err)
}
11 changes: 7 additions & 4 deletions contrib/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ RUN make build_code

# final stage
FROM ubuntu
RUN apt-get update -y
RUN apt-get install -y netbase
RUN apt-get install -y curl
RUN apt-get install -y net-tools
RUN apt-get update && apt-get install -y \
netbase \
curl \
net-tools \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /app/flowlogs-pipeline /app/
COPY --from=builder /app/confgenerator /app/

# expose ports
EXPOSE 2055
Expand Down
3 changes: 3 additions & 0 deletions docs/confGenerator.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Flags:

```

> Note: confgenerator is available also from `netobserv/flowlogs-pipeline` quay image. To use execute:
> `docker run --entrypoint /app/confgenerator quay.io/netobserv/flowlogs-pipeline:latest --help`

> Note: The default location for network definitions in flowlogs-pipeline is `/network_definitions` folder

The files and folder structure required as input for `confGenerator` are:
Expand Down