mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Merge pull request #38155 from freehan/cleanup-txqueue
Automatic merge from submit-queue (batch tested with PRs 39218, 38155) clean up logic that configs TX queue length fix: #25143
This commit is contained in:
@@ -31,7 +31,6 @@ go_library(
|
|||||||
"//vendor:github.com/containernetworking/cni/pkg/types",
|
"//vendor:github.com/containernetworking/cni/pkg/types",
|
||||||
"//vendor:github.com/golang/glog",
|
"//vendor:github.com/golang/glog",
|
||||||
"//vendor:github.com/vishvananda/netlink",
|
"//vendor:github.com/vishvananda/netlink",
|
||||||
"//vendor:github.com/vishvananda/netlink/nl",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -33,7 +33,6 @@ import (
|
|||||||
cnitypes "github.com/containernetworking/cni/pkg/types"
|
cnitypes "github.com/containernetworking/cni/pkg/types"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/vishvananda/netlink"
|
"github.com/vishvananda/netlink"
|
||||||
"github.com/vishvananda/netlink/nl"
|
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
"k8s.io/kubernetes/pkg/apis/componentconfig"
|
||||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||||
@@ -296,37 +295,6 @@ func (plugin *kubenetNetworkPlugin) clearBridgeAddressesExcept(keep *net.IPNet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureBridgeTxQueueLen() ensures that the bridge interface's TX queue
|
|
||||||
// length is greater than zero. Due to a CNI <= 0.3.0 'bridge' plugin bug,
|
|
||||||
// the bridge is initially created with a TX queue length of 0, which gets
|
|
||||||
// used as the packet limit for FIFO traffic shapers, which drops packets.
|
|
||||||
// TODO: remove when we can depend on a fixed CNI
|
|
||||||
func (plugin *kubenetNetworkPlugin) ensureBridgeTxQueueLen() {
|
|
||||||
bridge, err := netlink.LinkByName(BridgeName)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if bridge.Attrs().TxQLen > 0 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
req := nl.NewNetlinkRequest(syscall.RTM_NEWLINK, syscall.NLM_F_ACK)
|
|
||||||
msg := nl.NewIfInfomsg(syscall.AF_UNSPEC)
|
|
||||||
req.AddData(msg)
|
|
||||||
|
|
||||||
nameData := nl.NewRtAttr(syscall.IFLA_IFNAME, nl.ZeroTerminated(BridgeName))
|
|
||||||
req.AddData(nameData)
|
|
||||||
|
|
||||||
qlen := nl.NewRtAttr(syscall.IFLA_TXQLEN, nl.Uint32Attr(1000))
|
|
||||||
req.AddData(qlen)
|
|
||||||
|
|
||||||
_, err = req.Execute(syscall.NETLINK_ROUTE, 0)
|
|
||||||
if err != nil {
|
|
||||||
glog.V(5).Infof("Failed to set bridge tx queue length: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (plugin *kubenetNetworkPlugin) Name() string {
|
func (plugin *kubenetNetworkPlugin) Name() string {
|
||||||
return KubenetPluginName
|
return KubenetPluginName
|
||||||
}
|
}
|
||||||
@@ -789,7 +757,6 @@ func (plugin *kubenetNetworkPlugin) delContainerFromNetwork(config *libcni.Netwo
|
|||||||
func (plugin *kubenetNetworkPlugin) shaper() bandwidth.BandwidthShaper {
|
func (plugin *kubenetNetworkPlugin) shaper() bandwidth.BandwidthShaper {
|
||||||
if plugin.bandwidthShaper == nil {
|
if plugin.bandwidthShaper == nil {
|
||||||
plugin.bandwidthShaper = bandwidth.NewTCShaper(BridgeName)
|
plugin.bandwidthShaper = bandwidth.NewTCShaper(BridgeName)
|
||||||
plugin.ensureBridgeTxQueueLen()
|
|
||||||
plugin.bandwidthShaper.ReconcileInterface()
|
plugin.bandwidthShaper.ReconcileInterface()
|
||||||
}
|
}
|
||||||
return plugin.bandwidthShaper
|
return plugin.bandwidthShaper
|
||||||
|
Reference in New Issue
Block a user