-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Pr/tp/refactor kpr init #32275
Draft
tommyp1ckles
wants to merge
4
commits into
cilium:main
Choose a base branch
from
tommyp1ckles:pr/tp/refactor-kpr-init
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Pr/tp/refactor kpr init #32275
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maintainer-s-little-helper
bot
added
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Apr 30, 2024
tommyp1ckles
commented
Apr 30, 2024
@@ -104,6 +106,25 @@ func newConfig(in newConfigIn) (Config, error) { | |||
} | |||
} | |||
|
|||
if in.Config.EnableNodePort { | |||
if in.Config.TunnelingEnabled() && cfg.Protocol() == VXLAN && |
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.
todo: ensure that none of these configs are change elsewhere during init phase.
/test |
This will allow creating a dependency on the initKubeProxyReplacement performed prior to runtime. Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
When creating a new daemon with newDaemon, we perform various procedures to detect kpr config and subsequently override various config options, if necessary. Unlike most provided dependencies, newDaemon is created inside hive lifecycle and exposed as a dependeny inside a promise. This presents a problem when trying to write new modules that use the global *option.DaemonConfig. Although this type is exposed to hive via a Provide(...) call, some fields may change after the daemon has started so attempting to use the config during the populate phase can cause incorrect configuration to be used. Notably fields such as option.Config.EnableNodePort may change at runtime. Trying to solve this by forcing a dependency on the daemon promise fails in two ways: i. Modules that require a finalized *DaemonConfig while being initialized cannot wait for promise.Promise[*Daemon] to resolve as this would cause a deadlock waiting for a runtime dependency. ii. The map group provided using bpf.MapOut[T](...) has dependency on daemonPromise (these are synced before the loader dependency). So trying to depend on this would cause a Hive dependency cycle. Most of the kpr config init can be done prior to runtime, as finalizing configuration and probing seem like possibly reasonable things to do in the Hive init (i.e. Populate(...)) phase. This moves all such work out of newDaemon and outside of hives lifecycle. As well, the old hive *DaemonConfig provider is replaced with a new one that does all possible kpr init tasks and only then exports the config. This means that any module depending on *option.DaemonConfig will now be sure that any config values in the config that where overridden by kpr init will now be finalized at the time of construction - avoiding races where config is overwritten at runtime later. Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
The MTU cell relies on option.Config.NodePortEnabled which as described in commit c2d65fe61a9231ee961097f894466727a2438768 is prone to a race where the daemon changes this configuration at runtime. This uses the newly introduced option.(*FinalDaemonConfig) type as a parameter dependency to prevent such issues with MTU. Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
tommyp1ckles
force-pushed
the
pr/tp/refactor-kpr-init
branch
from
April 30, 2024 23:52
a3b7e84
to
59c0a98
Compare
This pull request has been automatically marked as stale because it |
github-actions
bot
added
the
stale
The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
label
May 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
stale
The stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.
Fixes: <commit-id>
tag, thenplease add the commit author[s] as reviewer[s] to this issue.
Fixes: #issue-number