Skip to content

Commit ecb7d45

Browse files
committed
feat: enable Flannel nftables mode
Use native nftables (it uses `nft` CLI internally) instead of going via `iptables-nft` shim. Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent 9919ff7 commit ecb7d45

5 files changed

Lines changed: 16 additions & 5 deletions

File tree

hack/release.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ The DNS protocol can be configured on a per-name server basis in the `ResolverCo
115115
description = """\
116116
Talos now supports a new `ImageCacheConfig` document for configuring the Image Cache feature, replacing the old `machine.features.imageCache` field in the v1alpha1 config.
117117
Old configuration is still supported for backwards compatibility.
118+
"""
119+
120+
[notes.flannel]
121+
title = "Flannel CNI"
122+
description = """\
123+
Talos now configures Flannel with the `EnableNFTables` option enabled, which uses nftables native backend instead of `iptables-nft` compatibility layer.
118124
"""
119125

120126
[make_deps]

internal/app/machined/pkg/controllers/k8s/internal/k8stemplates/flannel.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,18 @@ func FlannelConfigMapTemplate(spec *k8s.BootstrapManifestsConfigSpec) runtime.Ob
139139
}
140140

141141
var netConf struct {
142-
Network string `json:"Network,omitempty"`
143-
IPv6Network string `json:"IPv6Network,omitempty"`
144-
EnableIPv6 *bool `json:"EnableIPv6,omitempty"`
145-
EnableIPv4 *bool `json:"EnableIPv4,omitempty"`
146-
Backend struct {
142+
Network string `json:"Network,omitempty"`
143+
IPv6Network string `json:"IPv6Network,omitempty"`
144+
EnableIPv6 *bool `json:"EnableIPv6,omitempty"`
145+
EnableIPv4 *bool `json:"EnableIPv4,omitempty"`
146+
EnableNFTables *bool `json:"EnableNFTables,omitempty"`
147+
Backend struct {
147148
Type string `json:"Type"`
148149
Port int `json:"Port"`
149150
} `json:"Backend"`
150151
}
151152

153+
netConf.EnableNFTables = new(true)
152154
netConf.Backend.Type = "vxlan"
153155
netConf.Backend.Port = 4789
154156

internal/app/machined/pkg/controllers/k8s/internal/k8stemplates/testdata/flannel-configmap-dual.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ data:
2525
"Network": "10.96.0.0/12",
2626
"IPv6Network": "fd00::/112",
2727
"EnableIPv6": true,
28+
"EnableNFTables": true,
2829
"Backend": {
2930
"Type": "vxlan",
3031
"Port": 4789

internal/app/machined/pkg/controllers/k8s/internal/k8stemplates/testdata/flannel-configmap-v4.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ data:
2323
net-conf.json: |-
2424
{
2525
"Network": "10.96.0.0/12",
26+
"EnableNFTables": true,
2627
"Backend": {
2728
"Type": "vxlan",
2829
"Port": 4789

internal/app/machined/pkg/controllers/k8s/internal/k8stemplates/testdata/flannel-configmap-v6.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ data:
2525
"IPv6Network": "fd00::/112",
2626
"EnableIPv6": true,
2727
"EnableIPv4": false,
28+
"EnableNFTables": true,
2829
"Backend": {
2930
"Type": "vxlan",
3031
"Port": 4789

0 commit comments

Comments
 (0)