Skip to content

Commit 111f549

Browse files
authored
Merge pull request kosmos-io#315 from OrangeBao/fix_iptablesmode
feat: support setting iptables mode
2 parents 2e22100 + f3ab136 commit 111f549

File tree

5 files changed

+83
-15
lines changed

5 files changed

+83
-15
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/bep/debounce v1.2.1
77
github.com/containerd/console v1.0.3
88
github.com/containerd/containerd v1.6.14
9-
github.com/coreos/go-iptables v0.6.0
9+
github.com/coreos/go-iptables v0.7.1-0.20231102141700-50d824baaa46
1010
github.com/docker/docker v24.0.6+incompatible
1111
github.com/evanphx/json-patch v4.12.0+incompatible
1212
github.com/go-logr/logr v1.2.3

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,8 @@ github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc
643643
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
644644
github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
645645
github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
646-
github.com/coreos/go-iptables v0.6.0 h1:is9qnZMPYjLd8LYqmm/qlE+wwEgJIkTYdhV3rfZo4jk=
647-
github.com/coreos/go-iptables v0.6.0/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
646+
github.com/coreos/go-iptables v0.7.1-0.20231102141700-50d824baaa46 h1:AVVvARdGRuTtYO/DetrN9Z1G0kMbrqV7KLOH/J4byiM=
647+
github.com/coreos/go-iptables v0.7.1-0.20231102141700-50d824baaa46/go.mod h1:Qe8Bv2Xik5FyTXwgIbLAnv2sWSBmvWdFETJConOQ//Q=
648648
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
649649
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
650650
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=

pkg/clusterlink/network/iptables/iptables.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ limitations under the License.
2222
package iptables
2323

2424
import (
25+
"os"
26+
2527
"github.com/coreos/go-iptables/iptables"
2628
"github.com/pkg/errors"
2729
)
@@ -60,7 +62,8 @@ func New(proto iptables.Protocol) (Interface, error) {
6062
return NewFunc()
6163
}
6264

63-
ipt, err := iptables.New(iptables.IPFamily(proto), iptables.Timeout(5))
65+
// IPTABLES_PATH: the path decision the model of iptable, /sbin/xtables-nft-multi => nf_tables
66+
ipt, err := iptables.New(iptables.IPFamily(proto), iptables.Timeout(5), iptables.Path(os.Getenv("IPTABLES_PATH")))
6467
if err != nil {
6568
return nil, errors.Wrap(err, "error creating IP tables")
6669
}

vendor/github.com/coreos/go-iptables/iptables/iptables.go

+75-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/modules.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ github.com/containerd/ttrpc
145145
# github.com/containerd/typeurl v1.0.2
146146
## explicit; go 1.13
147147
github.com/containerd/typeurl
148-
# github.com/coreos/go-iptables v0.6.0
148+
# github.com/coreos/go-iptables v0.7.1-0.20231102141700-50d824baaa46
149149
## explicit; go 1.16
150150
github.com/coreos/go-iptables/iptables
151151
# github.com/coreos/go-semver v0.3.1

0 commit comments

Comments
 (0)