Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bea73f3
First commit
Sep 5, 2025
b162d50
Bump github.com/onsi/ginkgo/v2 from 2.25.2 to 2.27.1
dependabot[bot] Oct 23, 2025
1f3c46f
Fix controller integration tests
Oct 23, 2025
abee32c
Modify references to private repo
Oct 23, 2025
2b955a2
Bump actions/upload-artifact from 4 to 5
dependabot[bot] Oct 27, 2025
6289953
Merge pull request #17 from k8snetworkplumbingwg/dependabot/github_ac…
SchSeba Oct 27, 2025
9c1706e
Bump github.com/onsi/ginkgo/v2 from 2.27.1 to 2.27.2
dependabot[bot] Oct 28, 2025
1beccdf
Bump google.golang.org/grpc from 1.75.1 to 1.77.0
dependabot[bot] Nov 18, 2025
280ba75
logging: Print info at startup
zeeke Nov 14, 2025
cefb79a
Bump actions/checkout from 4 to 6
dependabot[bot] Dec 2, 2025
77816c8
Merge pull request #26 from k8snetworkplumbingwg/dependabot/github_ac…
SchSeba Dec 2, 2025
a14970a
Merge pull request #25 from k8snetworkplumbingwg/dependabot/go_module…
SchSeba Dec 2, 2025
aac7f54
Bump k8s.io/api from 0.34.0 to 0.34.2
dependabot[bot] Dec 2, 2025
b458677
Merge pull request #21 from k8snetworkplumbingwg/dependabot/go_module…
zeeke Dec 2, 2025
9c9a55e
Bump sigs.k8s.io/controller-runtime from 0.22.0 to 0.22.4
dependabot[bot] Dec 2, 2025
6f93706
Merge pull request #19 from k8snetworkplumbingwg/dependabot/go_module…
SchSeba Dec 2, 2025
3a7d0fa
Bump k8s.io/client-go from 0.34.0 to 0.34.2
dependabot[bot] Dec 3, 2025
6d2035f
Merge pull request #22 from k8snetworkplumbingwg/dependabot/go_module…
SchSeba Dec 3, 2025
576b90f
Bump github.com/onsi/gomega from 1.38.2 to 1.38.3
dependabot[bot] Dec 9, 2025
06faba2
Merge pull request #28 from k8snetworkplumbingwg/dependabot/go_module…
zeeke Dec 9, 2025
48b0e91
Bump github.com/onsi/ginkgo/v2 from 2.27.2 to 2.27.3
dependabot[bot] Dec 9, 2025
d5cb49b
Merge pull request #27 from k8snetworkplumbingwg/dependabot/go_module…
zeeke Dec 9, 2025
b2c54e6
Bump actions/upload-artifact from 5 to 6
dependabot[bot] Dec 15, 2025
df25a79
Merge pull request #33 from k8snetworkplumbingwg/dependabot/github_ac…
zeeke Dec 19, 2025
bdc8024
Bump github.com/containernetworking/plugins from 1.8.0 to 1.9.0
dependabot[bot] Dec 10, 2025
f2a9690
Bump google.golang.org/grpc from 1.77.0 to 1.78.0
dependabot[bot] Dec 24, 2025
bb91079
ds: remove iptables codebase
zeeke Jan 5, 2026
4302850
Merge remote-tracking branch 'upstream/main' into ds/transition-nftables
zeeke Jan 5, 2026
28e5ee4
ds: Update Dockerfile
zeeke Nov 10, 2025
d7d3d96
ds: restore OWNERS file
zeeke Nov 10, 2025
43b8071
ds: run `go mod vendor`
zeeke Nov 10, 2025
1e4d7e4
snyk: ignore vendor folder
zeeke Nov 11, 2025
211ff66
ds: compatibility with the iptables implementation
zeeke Nov 13, 2025
b95fd32
ds: force accept ICMPv6 ND packets
zeeke Dec 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: /
schedule:
interval: daily
- package-ecosystem: docker
directory: /
schedule:
interval: daily
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily
103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- uses: golangci/golangci-lint-action@v7
with:
version: v2.0.2
args: -v

build:
needs: lint
strategy:
matrix:
os: [ ubuntu-latest ]
goos: [ linux ]
goarch: [amd64, arm64, ppc64le]
runs-on: ${{ matrix.os }}
env:
GO111MODULE: on

steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Build test for ${{ matrix.goarch }}
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
run: GOARCH="${TARGET}" go build ./cmd/main.go

test-unit:
name: Run tests on Linux amd64
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run tests
run: sudo make test

test-e2e:
name: Run e2e tests
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install bats
run: sudo apt install bats
- name: Setup registry
run: docker run -d --restart=always -p "5000:5000" --name "kind-registry" registry:2

- name: Get tools
working-directory: ./e2e
run: ./get_tools.sh

- name: Setup cluster
working-directory: ./e2e
run: ./setup_cluster.sh

- name: "Test: simple"
working-directory: ./e2e
run: |
export TERM=dumb
# enable ip6_tables
sudo modprobe ip6_tables

./run_all_tests.sh

- name: Upload logs
uses: actions/upload-artifact@v6
if: ${{ failure() }}
with:
name: kind-logs-e2e
path: ./e2e/artifacts/
38 changes: 24 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
# Binary output dir
bin/
e2e/bin/
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin/*
Dockerfile.cross

# binary at the top
/multi-networkpolicy-iptables
# Test binary, built with `go test -c`
*.test

# GOPATH created by the build script
gopath/
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.html

# Editor paths
.swp*
.swo*
.idea*
# Go workspace file
go.work

# Test outputs
*.out
*.test
# Kubernetes Generated files - skip generated files, except for vendored files
!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
63 changes: 63 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

version: "2"
linters:
enable:
- contextcheck
- durationcheck
- forbidigo
- ginkgolinter
- gocritic
- misspell
- nonamedreturns
- predeclared
- revive
- unconvert
- unparam
- wastedassign
disable:
- errcheck
settings:
staticcheck:
checks:
- all
- '-QF1008' # nested struct reference
- '-ST1005' # capitalized error strings
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- revive
- staticcheck
text: use ALL_CAPS in Go names; use CamelCase
- linters:
- revive
text: ' and that stutters;'
- path: (.+)_test\.go
text: 'dot-imports: should not use dot imports'
- path: (.+)_test\.go
text: "ginkgo-linter: wrong comparison assertion. Consider using (.+)BeZero(.+)"
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci
- gofumpt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/k8snetworkplumbingwg/multi-network-policy-nftables)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
8 changes: 1 addition & 7 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@
exclude:
global:
- "**/*_test.go"
- vendor/github.com/google/uuid
- vendor/github.com/Microsoft/go-winio/pkg/guid
- vendor/golang.org/x/tools/cmd/stringer
- vendor/golang.org/x/tools/internal/pkgbits
- vendor/k8s.io/client-go/util/cert
- vendor/k8s.io/klog
- vendor/k8s.io/klog/v2
- vendor/**
30 changes: 17 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
# This Dockerfile is used to build the image available on DockerHub
FROM golang:1.24 as build
FROM golang:1.24 as builder
ARG TARGETOS
ARG TARGETARCH

# Add everything
ADD . /usr/src/multi-networkpolicy-iptables
WORKDIR /workspace

RUN cd /usr/src/multi-networkpolicy-iptables && \
CGO_ENABLED=0 go build ./cmd/multi-networkpolicy-iptables/
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download

FROM fedora:38
LABEL org.opencontainers.image.source https://github.com/k8snetworkplumbingwg/multi-networkpolicy-iptables
RUN dnf install -y iptables-utils iptables-legacy iptables-nft
RUN alternatives --set iptables /usr/sbin/iptables-nft
COPY --from=build /usr/src/multi-networkpolicy-iptables/multi-networkpolicy-iptables /usr/bin
WORKDIR /usr/bin
COPY cmd/main.go cmd/main.go
COPY pkg/ pkg/

ENTRYPOINT ["multi-networkpolicy-iptables"]
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o multi-networkpolicy-nftables cmd/main.go

FROM fedora:42
WORKDIR /

RUN dnf install -y nftables
COPY --from=builder /workspace/multi-networkpolicy-nftables .
ENTRYPOINT ["/multi-networkpolicy-nftables"]
17 changes: 10 additions & 7 deletions Dockerfile.openshift
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.24-openshift-4.22 AS build

# Add everything
ADD . /usr/src/multi-networkpolicy-iptables
WORKDIR /usr/src/multi-networkpolicy-iptables
RUN CGO_ENABLED=0 go build ./cmd/multi-networkpolicy-iptables/
ADD . /usr/src/multus-networkpolicy
WORKDIR /usr/src/multus-networkpolicy
RUN CGO_ENABLED=0 go build -a -o multi-networkpolicy-nftables ./cmd/

FROM registry.ci.openshift.org/ocp/4.22:base-rhel9
LABEL org.opencontainers.image.source https://github.com/k8snetworkplumbingwg/multi-networkpolicy-iptables
RUN dnf install -y iptables
COPY --from=build /usr/src/multi-networkpolicy-iptables/multi-networkpolicy-iptables /usr/bin
LABEL org.opencontainers.image.source https://github.com/openshift/multus-networkpolicy
RUN dnf install -y nftables && dnf clean all
COPY --from=build /usr/src/multus-networkpolicy/multi-networkpolicy-nftables /usr/bin
WORKDIR /usr/bin

LABEL io.k8s.display-name="Multus NetworkPolicy" \
io.k8s.description="This is a component of OpenShift Container Platform and provides NetworkPolicy objects for secondary interfaces created with Multus CNI" \
io.openshift.tags="openshift" \
maintainer="Doug Smith <[email protected]>"

ENTRYPOINT ["multi-networkpolicy-iptables"]
# TODO: compatibility layer with the original multus-networkpolicy-iptables image. Remove this once the ClsuterNetworkOperator is updated to use the nftables implementation.
RUN ln -s /usr/bin/multi-networkpolicy-nftables /usr/bin/multi-networkpolicy-iptables

ENTRYPOINT ["multi-networkpolicy-nftables"]
Loading