-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add kpr.Cell for KPRConfig #40026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add kpr.Cell for KPRConfig #40026
Conversation
/test |
d4fd9c9
to
b6f3069
Compare
/test |
/test |
/ci-runtime |
This commit introduces kpr.Cell which provides kpr.KPRConfig. The latter is derived from KPR flags such as --kube-proxy-replacement, --enable-node-port and so on. The new cell allows pkg/loadbalancer to *not* depend on the DaemonConfigPromise when implementing the flags support (will be done in a separate PR). The promise dependence comes from the fact that previously initKubeProxyReplacement() could modify some of the flags (for example, if --kpr=true, then --enable-node-port will be set to true). The invocation of the helper function happened after the DaemonConfig has been constructed. Thus, any pkg must consume the DaemonConfig in a form of the promise to avoid the races. For now the cell contains only a few flags (required for #39767). In v1.19 we will move the rest of the flags. Afterwards, we can re-consider whether having the dedicated cell for the KPR config makes sense (for example, we could move it to pkg/loadbalancer). Signed-off-by: Martynas Pumputis <martynas@isovalent.com>
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loader changes LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces the kpr.KPRConfig
struct throughout the datapath, configuration, and daemon code to replace individual option.Config
flags for kube-proxy replacement. It updates cell modules, writers, node handlers, and initialization routines to accept and use the central KPRConfig
, and revises tests and CLI modules accordingly.
- Propagate
kpr.KPRConfig
through loader, node handler, config writer, and daemon startup - Replace deprecated
option.Config
flags (e.g.EnableNodePort
,EnableSocketLB
) withkprCfg
fields - Add
kpr.Cell
to hive modules and update tests to passKPRConfig
Reviewed Changes
Copilot reviewed 47 out of 47 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
pkg/datapath/loader/base.go | Pass lnc.KPRConfig into IPSec device checks and socket LB calls |
pkg/datapath/linux/{node.go,*.go} | Add kprCfg field to handler and use it in rebuild/path logic |
pkg/datapath/linux/config/{config.go,cell.go} | Inject KPRConfig into header writer and cell params |
daemon/cmd/{daemon.go,daemon_main.go,...} | Wire KPRConfig into daemon init, kube-proxy replacement logic, and CLI cells |
tests | Update numerous tests to construct and verify via kpr.KPRConfig |
Comments suppressed due to low confidence (3)
daemon/cmd/daemon_main.go:38
- The alias import for
linuxdatapath
was removed butlinuxdatapath.NodeDeviceNameWithDefaultRoute
is still called later, causing a compile error. Re-add the import or adjust the call.
linuxdatapath "github.com/cilium/cilium/pkg/datapath/linux"
daemon/cmd/daemon.go:45
- Calls to
linuxdatapath.NodeDeviceNameWithDefaultRoute
appear in this file but thelinuxdatapath
import is missing. Add the import alias forgithub.com/cilium/cilium/pkg/datapath/linux
.
github.com/cilium/cilium/pkg/kpr
daemon/healthz/kube_proxy_healthz.go:72
- The
KPRConfig
field is referenced here but it must be set when buildingkubeProxyHealthParams
. Ensure the provider/invocation that constructsparams
injects the actualkpr.KPRConfig
from the daemon parameters, otherwise this check will always see a zero-value config.
if params.Config.KubeProxyReplacementHealthzBindAddress == "" || params.KPRConfig.KubeProxyReplacement == option.KubeProxyReplacementFalse {
Changing the release note here to misc, since this doesn't appear to have any user-facing impact. |
See commit msgs.
Needed for #39767.
Blocked by #40022Fixes: #40028