Skip to content

Commit

Permalink
fix: support setting iptables mode
Browse files Browse the repository at this point in the history
Signed-off-by: OrangeBao <[email protected]>
  • Loading branch information
OrangeBao committed Dec 7, 2023
1 parent 03f7523 commit 0327bb0
Show file tree
Hide file tree
Showing 9 changed files with 1,260 additions and 245 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/bep/debounce v1.2.1
github.com/containerd/console v1.0.3
github.com/containerd/containerd v1.6.14
github.com/coreos/go-iptables v0.6.0
github.com/coreos/go-iptables v0.7.1-0.20231102141700-50d824baaa46
github.com/docker/docker v24.0.6+incompatible
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/go-logr/logr v1.2.3
Expand All @@ -19,6 +19,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/projectcalico/api v0.0.0-20230602153125-fb7148692637
github.com/projectcalico/calico v1.11.0-cni-plugin.0.20220623222645-a52cb86dbaad
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5
github.com/vishvananda/netlink v1.2.1-beta.2.0.20220630165224-c591ada0fb2b
Expand Down Expand Up @@ -135,7 +136,6 @@ require (
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect
github.com/xlab/treeprint v1.1.0 // indirect
Expand Down
1,013 changes: 980 additions & 33 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions hack/rune2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ util::wait_for_condition "mcs of member2 are ready" \
nginx_service_ip=$(kubectl -n kosmos-e2e get svc nginx-service -o=jsonpath='{.spec.clusterIP}')

# e2e test for access nginx service
#docker exec -it ${HOST_CLUSTER_NAME}-control-plane sh -c "curl -sSf -m 5 ${nginx_service_ip}:80" && echo "success" || { echo "fail"; exit 1; }
# docker exec -it ${HOST_CLUSTER_NAME}-control-plane sh -c "curl -sSf -m 5 ${nginx_service_ip}:80" && echo "success" || { echo "fail"; exit 1; }

# e2e for mysql-operator
kubectl --context="kind-cluster-host" apply -f "${ROOT}"/../test/e2e/deploy/mysql-operator
Expand All @@ -44,7 +44,7 @@ util::wait_for_condition "mysql operator are ready" \
#kubectl --context="kind-cluster-host" exec -it /bin/sh -c
kubectl --context="kind-${HOST_CLUSTER_NAME}" apply -f "${ROOT}"/../test/e2e/deploy/cr

#util::wait_for_condition "mysql cr are ready" \
# util::wait_for_condition "mysql cr are ready" \
# "[ \$(kubectl get pods -n kosmos-e2e --field-selector=status.phase=Running --no-headers | wc -l) -eq 2 ]" \
# 1200

Expand Down
5 changes: 4 additions & 1 deletion pkg/clusterlink/network/iptables/iptables.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ limitations under the License.
package iptables

import (
"os"

"github.com/coreos/go-iptables/iptables"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -60,7 +62,8 @@ func New(proto iptables.Protocol) (Interface, error) {
return NewFunc()
}

ipt, err := iptables.New(iptables.IPFamily(proto), iptables.Timeout(5))
// IPTABLES_PATH: the path decision the model of iptable, /sbin/xtables-nft-multi => nf_tables
ipt, err := iptables.New(iptables.IPFamily(proto), iptables.Timeout(5), iptables.Path(os.Getenv("IPTABLES_PATH")))
if err != nil {
return nil, errors.Wrap(err, "error creating IP tables")
}
Expand Down
85 changes: 75 additions & 10 deletions vendor/github.com/coreos/go-iptables/iptables/iptables.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

156 changes: 78 additions & 78 deletions vendor/github.com/klauspost/compress/fse/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0327bb0

Please sign in to comment.