--flannel-cni-conf is not propagated to the embedded Flannel configuration
Environmental Info:
K3s Version:
Source inspection of main at commit a305766d0b86afec304ebd94713223061a916b79 and the release tags listed below. No fresh runtime reproduction or k3s -v output is included.
Node(s) CPU architecture, OS, and Version: Not collected; this report is based on source inspection.
Cluster Configuration: The affected code path is the embedded Flannel configuration. No test cluster was started for this report.
Describe the bug:
--flannel-cni-conf is accepted by the CLI, but its value is not propagated to the embedded Flannel configuration.
The flag declaration stores the value in AgentConfig.FlannelCniConfFile. Embedded.Bootstrap copies the other Flannel settings from cfg, but does not assign nodeConfig.Flannel.CNIConfFile.
createCNIConf checks that field to decide whether to copy the supplied CNI configuration or write the built-in template.
Steps To Reproduce:
- Installed K3s: not performed for this report; the following is a source-level check.
- Inspect the three files at the pinned commit linked above.
- Trace
FlannelCniConfFilefrom the CLI configuration intoEmbedded.Bootstrap, andCNIConfFileintocreateCNIConf. - Observe that the embedded-Flannel configuration block does not copy the CLI value into the field consumed by
createCNIConf.
A runtime reproduction would start an isolated K3s node with embedded Flannel and --flannel-cni-conf pointing to a custom conflist, then compare that file with the generated 10-flannel.conflist. That runtime check has not been performed here.
Expected behavior:
The custom CNI configuration path reaches nodeConfig.Flannel.CNIConfFile, allowing createCNIConf to copy the supplied file.
Actual behavior:
In the inspected source, the field remains unset along this path, so createCNIConf selects the built-in template. This is a source-derived finding, not captured runtime output.
Additional context / logs:
Before configuration construction moved, pkg/agent/config/config.go contained:
nodeConfig.AgentConfig.FlannelCniConfFile = envInfo.FlannelCniConfFileSource comparisons found these release boundaries:
| Release line | Assignment present | Assignment absent in config.go and embed.go |
|---|---|---|
| 1.32 | v1.32.10+k3s1 | v1.32.11+k3s1 |
| 1.33 | v1.33.6+k3s1 | v1.33.7+k3s1 |
| 1.34 | v1.34.2+k3s1 | v1.34.3+k3s1 |
The assignment was also absent in v1.35.0+k3s1 and v1.36.4+k3s1. These are source comparisons, not runtime tests of each version.
The custom-file unit test initializes Flannel.CNIConfFile directly, so it does not cover propagation from the CLI configuration.
A proposed fix is to add this assignment inside the embedded-Flannel configuration block in Embedded.Bootstrap:
nodeConfig.Flannel.CNIConfFile = cfg.FlannelCniConfFileA regression test should cover propagation from cmds.Agent.FlannelCniConfFile to the configuration consumed by Flannel. This proposed fix has not been built or tested here. No runtime logs are attached.
Source: k3s-io/k3s