Skip to content

Commit

Permalink
update flannel v0.24.2 (#5071)
Browse files Browse the repository at this point in the history
* update flannel v0.24.2

* fix logic for detecting flannel ifs

* fix logic for detecting flannel ifs

* fix the detect vmware nic script again

* log a note about why this is being disabled

---------

Co-authored-by: ada mancini <[email protected]>
  • Loading branch information
laverya and adamancini authored Mar 12, 2024
1 parent 0ad23e5 commit 82513b3
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
12 changes: 12 additions & 0 deletions addons/flannel/0.24.2/flannel-ethtool.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Disable vxlan checksum offloading for flannel.1
After=sys-devices-virtual-net-flannel.1.device
Requires=sys-devices-virtual-net-flannel.1.device

[Service]
Type=oneshot
ExecStart=/sbin/ethtool -K flannel.1 tx-checksum-ip-generic off
RemainAfterExit=yes

[Install]
WantedBy=sys-devices-virtual-net-flannel.1.device
33 changes: 33 additions & 0 deletions addons/flannel/0.24.2/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,43 @@ function flannel() {
kubectl rollout restart --namespace=kube-flannel daemonset/kube-flannel-ds
fi

if flannel_detect_vmware_nic; then
flannel_install_ethtool_service "$src"
fi

flannel_ready_spinner
check_network
}

function flannel_detect_vmware_nic() {
if lspci -v | grep Ethernet | grep -q "VMware VMXNET3"; then
return 0
fi
return 1
}


function flannel_install_ethtool_service() {
# this disables the tcp checksum offloading on flannel interface - this is a workaround for
# certain VMWare NICs that use NSX and have a conflict with the way the checksum is handled by
# the kernel.
local src="$1"

logStep "Installing flannel ethtool service"
logStep "Disabling TCP checksum offloading on flannel interface for VMWare VMXNET3 NICs"

cp "$src/flannel-ethtool.service" /etc/systemd/system/flannel-ethtool.service

systemctl daemon-reload
systemctl enable flannel-ethtool.service
if ! timeout 30s systemctl start flannel-ethtool.service; then
log "Failed to start flannel-ethtool.service within 30s, restarting it"
systemctl restart flannel-ethtool.service
fi

logSuccess "Flannel ethtool service installed"
}

function flannel_init_pod_subnet() {
POD_CIDR="$FLANNEL_POD_CIDR"
POD_CIDR_RANGE="$FLANNEL_POD_CIDR_RANGE"
Expand Down
9 changes: 3 additions & 6 deletions addons/flannel/template/base/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,23 +160,20 @@ function flannel() {
}

function flannel_detect_vmware_nic() {
local vmxnet3=false

if lspci -v | grep Ethernet | grep -q "VMware VMXNET3"; then
vmxnet3=true
return 0
fi

return $vmxnet3
return 1
}


function flannel_install_ethtool_service() {
# this disables the tcp checksum offloading on flannel interface - this is a workaround for
# certain VMWare NICs that use NSX and have a conflict with the way the checksum is handled by
# the kernel.
local src="$1"

logStep "Installing flannel ethtool service"
logStep "Disabling TCP checksum offloading on flannel interface for VMWare VMXNET3 NICs"

cp "$src/flannel-ethtool.service" /etc/systemd/system/flannel-ethtool.service

Expand Down

0 comments on commit 82513b3

Please sign in to comment.