Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Kube OVN
Commits
2d750cbf
Commit
2d750cbf
authored
3 years ago
by
范日明
Browse files
Options
Download
Email Patches
Plain Diff
enable hw-offload
parent
f7cdfd2c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
dist/images/install-pre-1.16.sh
+1
-0
dist/images/install-pre-1.16.sh
dist/images/install.sh
+1
-0
dist/images/install.sh
pkg/daemon/config.go
+5
-1
pkg/daemon/config.go
pkg/daemon/controller.go
+3
-2
pkg/daemon/controller.go
pkg/daemon/init.go
+1
-1
pkg/daemon/init.go
pkg/daemon/ovs.go
+11
-8
pkg/daemon/ovs.go
yamls/kube-ovn.yaml
+1
-0
yamls/kube-ovn.yaml
with
23 additions
and
12 deletions
+23
-12
dist/images/install-pre-1.16.sh
+
1
-
0
View file @
2d750cbf
...
...
@@ -1638,6 +1638,7 @@ spec:
- --iface=
${
IFACE
}
- --network-type=
$NETWORK_TYPE
- --default-interface-name=
$VLAN_INTERFACE_NAME
- --hw-offload=
$HW_OFFLOAD
securityContext:
runAsUser: 0
privileged: true
...
...
This diff is collapsed.
Click to expand it.
dist/images/install.sh
+
1
-
0
View file @
2d750cbf
...
...
@@ -1691,6 +1691,7 @@ spec:
- --iface=
${
IFACE
}
- --network-type=
$NETWORK_TYPE
- --default-interface-name=
$VLAN_INTERFACE_NAME
- --hw-offload=
$HW_OFFLOAD
securityContext:
runAsUser: 0
privileged: true
...
...
This diff is collapsed.
Click to expand it.
pkg/daemon/config.go
+
5
-
1
View file @
2d750cbf
...
...
@@ -5,13 +5,14 @@ import (
"errors"
"flag"
"fmt"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"net"
"os"
"os/exec"
"regexp"
"strings"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
clientset
"github.com/kubeovn/kube-ovn/pkg/client/clientset/versioned"
"github.com/kubeovn/kube-ovn/pkg/util"
"github.com/sirupsen/logrus"
...
...
@@ -43,6 +44,7 @@ type Configuration struct {
NetworkType
string
DefaultProviderName
string
DefaultInterfaceName
string
HwOffload
bool
}
// ParseFlags will parse cmd args then init kubeClient and configuration
...
...
@@ -60,6 +62,7 @@ func ParseFlags() (*Configuration, error) {
argNodeLocalDnsIP
=
pflag
.
String
(
"node-local-dns-ip"
,
""
,
"If use nodelocaldns the local dns server ip should be set here, default empty."
)
argEncapChecksum
=
pflag
.
Bool
(
"encap-checksum"
,
true
,
"Enable checksum, default: true"
)
argPprofPort
=
pflag
.
Int
(
"pprof-port"
,
10665
,
"The port to get profiling data, default: 10665"
)
argHwOffload
=
pflag
.
Bool
(
"hw-offload"
,
false
,
"Enable hw offload, default: false"
)
argsNetworkType
=
pflag
.
String
(
"network-type"
,
"geneve"
,
"The ovn network type, default: geneve"
)
argsDefaultProviderName
=
pflag
.
String
(
"default-provider-name"
,
"provider"
,
"The vlan or vxlan type default provider interface name, default: provider"
)
...
...
@@ -108,6 +111,7 @@ func ParseFlags() (*Configuration, error) {
NetworkType
:
*
argsNetworkType
,
DefaultProviderName
:
*
argsDefaultProviderName
,
DefaultInterfaceName
:
*
argsDefaultInterfaceName
,
HwOffload
:
*
argHwOffload
,
}
if
err
:=
config
.
initKubeClient
();
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
pkg/daemon/controller.go
+
3
-
2
View file @
2d750cbf
...
...
@@ -610,8 +610,9 @@ func (c *Controller) Run(stopCh <-chan struct{}) {
klog
.
Info
(
"Started workers"
)
go
wait
.
Until
(
c
.
loopOvn0Check
,
5
*
time
.
Second
,
stopCh
)
go
wait
.
Until
(
c
.
disableTunnelOffload
,
5
*
time
.
Second
,
stopCh
)
if
!
c
.
config
.
HwOffload
{
go
wait
.
Until
(
c
.
disableTunnelOffload
,
5
*
time
.
Second
,
stopCh
)
}
go
wait
.
Until
(
c
.
runSubnetWorker
,
time
.
Second
,
stopCh
)
go
wait
.
Until
(
c
.
runPodWorker
,
time
.
Second
,
stopCh
)
go
wait
.
Until
(
c
.
runGateway
,
3
*
time
.
Second
,
stopCh
)
...
...
This diff is collapsed.
Click to expand it.
pkg/daemon/init.go
+
1
-
1
View file @
2d750cbf
...
...
@@ -46,7 +46,7 @@ func InitNodeGateway(config *Configuration) error {
}
ipAddr
=
util
.
GetIpAddrWithMask
(
ip
,
cidr
)
return
configureNodeNic
(
portName
,
ipAddr
,
gw
,
mac
,
config
.
MTU
)
return
configureNodeNic
(
portName
,
ipAddr
,
gw
,
mac
,
config
.
MTU
,
config
.
HwOffload
)
}
func
InitMirror
(
config
*
Configuration
)
error
{
...
...
This diff is collapsed.
Click to expand it.
pkg/daemon/ovs.go
+
11
-
8
View file @
2d750cbf
...
...
@@ -271,7 +271,7 @@ func waitNetworkReady(gateway string) error {
return
nil
}
func
configureNodeNic
(
portName
,
ip
,
gw
string
,
macAddr
net
.
HardwareAddr
,
mtu
int
)
error
{
func
configureNodeNic
(
portName
,
ip
,
gw
string
,
macAddr
net
.
HardwareAddr
,
mtu
int
,
enableOffload
bool
)
error
{
ipStr
:=
util
.
GetIpWithoutMask
(
ip
)
raw
,
err
:=
ovs
.
Exec
(
ovs
.
MayExist
,
"add-port"
,
"br-int"
,
util
.
NodeNic
,
"--"
,
"set"
,
"interface"
,
util
.
NodeNic
,
"type=internal"
,
"--"
,
...
...
@@ -294,16 +294,19 @@ func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int
if
err
=
netlink
.
LinkSetTxQLen
(
hostLink
,
1000
);
err
!=
nil
{
return
fmt
.
Errorf
(
"can not set host nic %s qlen %v"
,
util
.
NodeNic
,
err
)
}
// Double nat may lead kernel udp checksum error, disable offload to prevent this issue
// https://github.com/kubernetes/kubernetes/pull/92035
output
,
err
:=
exec
.
Command
(
"ethtool"
,
"-K"
,
"ovn0"
,
"tx"
,
"off"
)
.
CombinedOutput
()
if
err
!=
nil
{
klog
.
Errorf
(
"failed to disable checksum offload on ovn0, %v %q"
,
err
,
output
)
return
err
if
!
enableOffload
{
// Double nat may lead kernel udp checksum error, disable offload to prevent this issue
// https://github.com/kubernetes/kubernetes/pull/92035
output
,
err
:=
exec
.
Command
(
"ethtool"
,
"-K"
,
"ovn0"
,
"tx"
,
"off"
)
.
CombinedOutput
()
if
err
!=
nil
{
klog
.
Errorf
(
"failed to disable checksum offload on ovn0, %v %q"
,
err
,
output
)
return
err
}
}
// ping ovn0 gw to activate the flow
output
,
err
=
ovn0Check
(
gw
)
output
,
err
:
=
ovn0Check
(
gw
)
if
err
!=
nil
{
klog
.
Errorf
(
"failed to init ovn0 check, %v, %q"
,
err
,
output
)
return
err
...
...
This diff is collapsed.
Click to expand it.
yamls/kube-ovn.yaml
+
1
-
0
View file @
2d750cbf
...
...
@@ -157,6 +157,7 @@ spec:
-
--iface=
-
--network-type=geneve
-
--default-interface-name=
-
--hw-offload=false
securityContext
:
runAsUser
:
0
privileged
:
true
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment