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

Add Kubernetes Manifests #5

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions cmd/goul/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:alpine AS build
RUN apk add --update git gcc musl-dev libpcap-dev openssh-client

WORKDIR /app
COPY . .
RUN go mod init nexclipper/goul
Copy link
Member

Choose a reason for hiding this comment

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

I just committed go.mod and go.sum (to make it compatible with recent go) so this line can make an error. Could you please remove this line?

RUN go mod tidy
RUN go build -o goul

FROM alpine
LABEL version=0.1.0
RUN apk add --update --no-cache libpcap-dev
COPY --from=build /app/goul /usr/bin/goul
CMD [ "goul", "--help" ]
30 changes: 30 additions & 0 deletions cmd/goul/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
goul-server:
image: nexclipper/goul:0.2-head
restart: always
privileged: true
environment:
- GOUL_DEVICE="eth0"
ports:
- "6001:6001"
command:
- goul
- --server
- --debug
- --dev=eth0

goul-client:
image: nexclipper/goul:0.2-head
depends_on:
- goul-server
links:
- goul-server
environment:
- GOUL_SERVER_ADDRESS="goul-server"
- GOUL_DEVICE="eth0"
command:
- goul
- --addr=goul-server
- --dev=eth0
- --debug
34 changes: 34 additions & 0 deletions cmd/goul/goul-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: goul-client
namespace: nc
labels:
app: goul-client
spec:
replicas: 1
selector:
matchLabels:
app: goul-client
template:
metadata:
labels:
app: goul-client
spec:
# nodeSelector:
# key: client
hostNetwork: true
containers:
- name: goul-client
image: nexclipper/goul:0.2-head
ports:
- containerPort: 6001
env:
- name: GOUL_PORT
value: "6001"
- name: GOUL_DEVICE
value: "ens6f0"
- name: GOUL_SERVER_ADDRESS
value: "172.16.9.126"
command: ["goul"]
args: ["--addr=$(GOUL_SERVER_ADDRESS)", "--debug", "--dev=$(GOUL_DEVICE)", "--port=$(GOUL_PORT)"]
Copy link
Member

Choose a reason for hiding this comment

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

The client container runs with no tcpdump filter so it will pass all packets (including STP and other management protocols) on the device to the server. If the server runs on the same LAN segment it could break the LAN or break the host network (by shutting down the switch port connected to the host by the switch that detects looping.)

30 changes: 30 additions & 0 deletions cmd/goul/goul-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: goul-server
namespace: nc
labels:
app: goul-server
spec:
replicas: 1
selector:
matchLabels:
app: goul-server
template:
metadata:
labels:
app: goul-server
spec:
# nodeSelector:
# key: server
hostNetwork: true
containers:
- name: goul-server
image: nexclipper/goul:0.2-head
ports:
- containerPort: 6001
env:
- name: GOUL_DEVICE
value: "ens6f0"
command: ["goul"]
args: ["--server", "--debug", "--dev=$(GOUL_DEVICE)"]