Repository navigation
Conversation
4bae724 to
40c70d3
Compare
The runtime named the network plugin and its variants itself, so adding either meant editing the runtime. A network plugin now declares in its config.toml the strategy each interface variant needs, and the runtime builds its table from the network plugins present, so the supported set is the one installed. The macOS 26 strategy type is still instantiated behind an availability guard, since the type requires it, but a plugin offers that variant only where it is available, so the runtime no longer repeats the list of which variants exist. The plugin tests build each service with the new field, and a manifest that declares interfaces decodes to the table while one that declares none decodes to nil.
40c70d3 to
4d0b15a
Compare
resker
left a comment
There was a problem hiding this comment.
Tested at 4d0b15a on macOS 27 (Apple silicon): make all and make test pass. A container on the default network and one on a new container network create network both got addresses and reached the internet, so both variants still resolve to the right strategy.
One suggestion: strategy names are only checked at runtime. A typo in a manifest is logged and skipped, and the real failure shows up later when a container can't attach. Decoding interfaces into an enum in PluginConfig would reject it when the manifest loads. It would also let the table builder move out of the executable into a library and get a unit test, like #2477 did for HostStoreServer. Right now the test covers decoding but not the table.
…n ContainerRuntimeLinuxServer A misspelled strategy name in a network plugin's manifest was logged and skipped, and failed later when a container attached. Decoding into PluginConfig.InterfaceStrategyType rejects the manifest when the plugin loads. The table builder moves beside the strategies it constructs, into ContainerRuntimeLinuxServer, with a unit test of the table, as apple#2477 moved HostStoreServer out of its executable.
|
Both are in 2bf641a:
|
…ializer RuntimeService takes the plugin loader and derives its table from the network plugins itself, as ContainersService and NetworksService take the loader and filter its plugins in their initializers. The runtime helper only creates the loader, the way the API server's initializePluginLoader does.
|
One more change: |
resker
left a comment
There was a problem hiding this comment.
Thanks for picking up both suggestions. Re-tested at 9029f72 on macOS 27: build, tests and format check pass, and containers on the default and a new network both get addresses and reach the internet. I also plugged a deliberate misspelling into the vmnet manifest's strategy, and it now fails at load, with the path in the error.
Two minor things to consider (neither blocking):
- On macOS 15, vmnet's manifest still declares
reserved = "nonisolated", so every container start will log the unavailable-strategy error. Debug level seems right, since that's expected there. (From reading, not tested on 15.) - The runtime helper's
initializePluginLoaderduplicates the API server's. Could be a sharedPluginLoaderhelper later.
Type of Change
Motivation and Context
Fixes #2279.
RuntimeLinuxHelper+Starthardcoded theNetworkInterfaceKey -> InterfaceStrategytable forcontainer-network-vmnetand gated the macOS 26 variant with#available, with a FIXME that supported plugins should be configurable elsewhere.A network plugin now declares the strategy for each interface variant in its
config.toml(PluginConfig.Service.interfaces), decoded intoPluginConfig.InterfaceStrategyType, so a misspelled strategy fails the manifest's load and the plugin is not installed.RuntimeService.interfaceStrategies(plugins:log:)inContainerRuntimeLinuxServerbuilds the table from the pluginsPluginLoader.findPlugins()returns, beside the strategies it constructs. The#availableguard stays where the macOS 26 type is instantiated, and the plugins and variants come from the manifests installed.Testing
PluginConfigTestdecodes a manifest declaring interfaces into the enum, a manifest naming an unknown strategy throws aDecodingError, and a manifest declaring none decodes to nil. The newContainerRuntimeLinuxServerTeststarget checks the table: each declared variant maps to its strategy (the nonisolated one on macOS 26), and only network services contribute.make testpasses on macOS 26.5.1, andmake swift-fmt-checkis clean.