mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Merge pull request #54219 from m1093782566/ipset
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Using ipset doing SNAT and packet filter in IPVS kube-proxy **What this PR does / why we need it**: Try ipset in ipvs proxy mode. **Which issue this PR fixes**: fixes #54203 xref: #53393, #53775 **Special notes for your reviewer**: **Release note**: ```release-note Using ipset doing SNAT and packet filtering in IPVS kube-proxy ``` /sig network /area kube-proxy
This commit is contained in:
@@ -19,6 +19,7 @@ package util
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"github.com/golang/glog"
|
||||
)
|
||||
@@ -46,6 +47,21 @@ func IPPart(s string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func PortPart(s string) (int, error) {
|
||||
// Must be IP:port
|
||||
_, port, err := net.SplitHostPort(s)
|
||||
if err != nil {
|
||||
glog.Errorf("Error parsing '%s': %v", s, err)
|
||||
return -1, err
|
||||
}
|
||||
portNumber, err := strconv.Atoi(port)
|
||||
if err != nil {
|
||||
glog.Errorf("Error parsing '%s': %v", port, err)
|
||||
return -1, err
|
||||
}
|
||||
return portNumber, nil
|
||||
}
|
||||
|
||||
// ToCIDR returns a host address of the form <ip-address>/32 for
|
||||
// IPv4 and <ip-address>/128 for IPv6
|
||||
func ToCIDR(ip net.IP) string {
|
||||
|
||||
Reference in New Issue
Block a user