Skip to content

Commit

Permalink
[WIP] testing nat gateway
Browse files Browse the repository at this point in the history
Signed-off-by: gotti <[email protected]>
  • Loading branch information
gotti committed Aug 27, 2024
1 parent 1a8eab2 commit 2040975
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/nat-gateway/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,19 @@ func main() {
setupLog.Error(err, "unable to create FouTunnelController")
os.Exit(1)
}
if err := fc.Init(); err != nil {
setupLog.Error(err, "failed to Initialize FoUTunnelController")
os.Exit(1)
}
nc, err := nat.NewController("eth0", ipv4, ipv6)
if err != nil {
setupLog.Error(err, "unable to create nat.Controller")
os.Exit(1)
}
if err := nc.Init(); err != nil {
setupLog.Error(err, "failed to Initialize nat.Controller")
os.Exit(1)
}

if err = controller.NewPodWatcher(
mgr.GetClient(),
Expand Down
26 changes: 26 additions & 0 deletions config/samples/nat-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nat-client
annotations:
egress.pona.cybozu.com/egress: egress
labels:
app.kubernetes.io/component: nat-client
spec:
selector:
matchLabels:
app.kubernetes.io/component: nat-client
replicas: 1
template:
metadata:
labels:
app.kubernetes.io/component: nat-client
annotations:
egress.pona.cybozu.com/egress: egress
spec:
containers:
- name: nat-client
image: ghcr.io/cybozu/ubuntu-debug:22.04
command: ["sleep"]
args:
- infinity
4 changes: 3 additions & 1 deletion dockerfiles/Dockerfile.nat-gateway
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o na

FROM ghcr.io/cybozu/ubuntu:22.04
WORKDIR /
RUN apt-get -yy update && apt-get install -yy netbase kmod iptables iproute2

COPY --from=builder /workspace/nat-gateway .
USER 65532:65532
USER 0:0

ENTRYPOINT ["/nat-gateway"]

0 comments on commit 2040975

Please sign in to comment.