Skip to content

Commit

Permalink
Disable TX Checksum Offload
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Jan 7, 2025
1 parent cb09476 commit 770edd0
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
55 changes: 55 additions & 0 deletions nodeup/pkg/model/networking/flannel.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package networking

import (
"k8s.io/kops/nodeup/pkg/model"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/upup/pkg/fi/nodeup/nodetasks"
"k8s.io/kops/util/pkg/distributions"
)

// FlannelBuilder writes the Amazon VPC CNI configuration
type FlannelBuilder struct {
*model.NodeupModelContext
}

var _ fi.NodeupModelBuilder = &FlannelBuilder{}

// Build is responsible for configuring the network cni
func (b *FlannelBuilder) Build(c *fi.NodeupModelBuilderContext) error {
if b.NodeupConfig.Networking.Flannel == nil {
return nil
}

if b.Distribution == distributions.DistributionUbuntu2404 {
// https://github.com/flannel-io/flannel/blob/master/Documentation/troubleshooting.md#nat
c.AddTask(&nodetasks.File{
Path: "/etc/udev/rules.d/90-flannel.rules",
Contents: fi.NewStringResource(
`SUBSYSTEM=="net", ACTION=="add|change|move", ENV{INTERFACE}=="flannel.1", RUN+="/usr/sbin/ethtool -K flannel.1 tx-checksum-ip-generic off"`,
),
Type: nodetasks.FileType_File,
OnChangeExecute: [][]string{
{"udevadm", "control", "--reload-rules"},
{"udevadm", "trigger"},
},
})
}

return nil
}
1 change: 1 addition & 0 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
loader.Builders = append(loader.Builders, &networking.CalicoBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.CiliumBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.AmazonVPCRoutedENIBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.FlannelBuilder{NodeupModelContext: modelContext})
loader.Builders = append(loader.Builders, &networking.KuberouterBuilder{NodeupModelContext: modelContext})

loader.Builders = append(loader.Builders, &model.BootstrapClientBuilder{NodeupModelContext: modelContext})
Expand Down

0 comments on commit 770edd0

Please sign in to comment.