-
Notifications
You must be signed in to change notification settings - Fork 207
feat: Support Transient Plugin Lifecycle & Factory for Flow Control #1977
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
base: main
Are you sure you want to change the base?
feat: Support Transient Plugin Lifecycle & Factory for Flow Control #1977
Conversation
This commit introduces the foundational support for "Transient" plugins, plugins that are instantiated on-demand at runtime rather than as singletons at startup. - Adds `LifecycleTransient` to the `Registry`. - Adds `PluginFactory` interface and `EPPPluginFactory` implementation for creating instances from blueprints. - Adds `doc.go` to explain the new architecture. - Adds comprehensive unit tests for `Registry` and `Factory`.
Updates the `plugins.Handle` interface to serve as a repository for Plugin Blueprints (Specs). This is required for the Factory to look up configuration when instantiating transient plugins. - Adds `PluginSpec(name string)` to the `Handle` interface. - Updates `NewEppHandle` to accept a list of `PluginSpecs`. - Updates `test/utils/handle.go` (mock) to support specs. - Adds unit tests for `Handle` immutability and lookup.
Integrates the new plugin lifecycle into the application startup flow. - Updates `instantiatePlugins` in the config loader to skip instantiation of `Transient` plugins (leaving them as blueprints in the `Handle`). - Updates `parseConfigurationPhaseTwo` in the runner to pass the raw plugin specs into the `Handle` constructor.
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LukeAVanDrie The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @LukeAVanDrie. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
FYI @RyanRosario + those looking into #1797. This starts the process of making these policies easily injectable (and eventually configurable). |
|
FYI @kfswain as we have discussed approaches for this offline before. In subsequent PRs, I will pass the new |
|
I think a better way to handle the need for stateful plugins in the FlowControl layer, is to simply add a NewFlow() function to the FlowControl plugins. This call returns a struct/pointer to struct that to the FlowControl layer itself is completely hidden. The struct/pointer returned is passed to the plugin calls associated with the appropriate flow. The first thing the plugin does is cast it back to the appropriate type before doing what ever processing it needs. This makes these plugins more like the rest of the plugins in the system and keeps our code base smaller and easier to understand. |
This is rather handwaved and requires a strong argument imo, as we are making some pretty fundamental changes. I remember having an offline discussion where we found where one could use singleton plugins for Flow Control. We should explore how we can fit into the current ecosystem first and then, after strong justification, make changes. |
This is an interesting approach, thanks! We need to pick between two patterns:
Both should work. I will draft up a diagram of the Flow Control state model and provide an example implementation and call sites snippets for a stateful fairness policy, Round Robin under both models. I suspect your suggestion will be the best path forwards, but let's lay out the pros/cons concretely. |
|
I'm still looking into this. pkg/epp/flowcontrol/registry/... needs to undergo some changes for either proposal. Trying to find an efficient path to delivering @shmuelk's approach. Going to mark this as a draft PR until I have an update. Thanks for the feedback so far! |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR extends the Endpoint Picker (EPP) plugin system to support a Transient lifecycle, enabling the creation of stateful, per-flow plugin instances at runtime.
Context:
Previously, the EPP plugin system treated all plugins as Singletons instantiated once at startup. While this works well for the existing EPP extension points, it is insufficient for the Flow Control layer. Flow Control requires stateful components (e.g., Queues, Fairness/Ordering Policies) that must be instantiated uniquely for each Flow or Priority Band.
Changes:
LifecycleTransienttopkg/epp/plugins. Transient plugins are registered as "Blueprints" rather than active instances.PluginFactoryandEPPPluginFactoryto instantiate transient plugins on-demand using configuration from the Handle.instanceAliasto assign unique runtime identities (e.g., "tenant-a-queue") to instances created from the same blueprint.Handleto store configurationPluginSpecs(blueprints) alongside active plugin instances.config/loaderto skip the instantiation of Transient plugins during startup. They now remain as blueprints in the Handle, waiting to be hydrated by the Factory.pkg/epp/plugins/doc.goproviding a high-level architectural overview of the Registry, Factory, and the distinction between the Scheduling DAG (Singletons) and Flow Control (Transient).Which issue(s) this PR fixes:
Tracks #1715
Does this PR introduce a user-facing change?: