Skip to content

[WIP] general pluggability proposal/discussion #940

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nirrozenbaum
Copy link
Contributor

No description provided.

Signed-off-by: Nir Rozenbaum <nirro@il.ibm.com>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nirrozenbaum
Once this PR has been reviewed and has the lgtm label, please assign sergeykanzhelev for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested review from Jeffwan and liu-cong June 9, 2025 10:01
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 9, 2025
Copy link

netlify bot commented Jun 9, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 6242a97
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6846b0f35dde120008bf926d
😎 Deploy Preview https://deploy-preview-940--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nirrozenbaum
Copy link
Contributor Author

started an initial doc to discuss general pluggability management and structuring.
the proposal doesn't get into specifics of each of the layers or the extension points of each. we have an open issue or design doc for each of the layers and it doesn't seem like we need to repeat this information here.

will add more information as we make progress with the proposal.

cc: @ahg-g @elevran @kfswain @liu-cong

@@ -0,0 +1,46 @@
# Pluggability
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder: rename the dir to 0940- now that you have a PR number assigned


## Proposal

This proposal aims to define how to structure and setup plugins for different layers of the system. For the sake of the discussion, the proposal focuses on extension points from the scheduling layer, which is the most stable one in terms of pluggability, and from the RequestControl layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I correct in understanding that there are two topics here?

  • how to structure plugins' code within the GIE repository
  • how to define what plugins are available in the system

If so, can you dedicate a proposal section to each?


### Plugins maintainace
Since plugins may implement multiple extension points from different layers of EPP, it makes sense to group plugin implementations in under one directory.
For example, instead of keeping plugins under `/pkg/epp/scheduling/framework/plugins`, this proposal suggests to define a shared package to be used for all plugins of the system - `pkg/epp/plugins`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that moving all system plugins under a single epp/plugins directory would be helpful.
Can you please also add a concrete suggestion on how to structure plugin code underneath?
For example, should they still be grouped by layer and function whenever possible (e.g., scheduling/filter, scheduling/scorer, ...) or not?
Making a concrete suggestion would make it easier to discuss and converge.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

The language here is pretty "soft" - it just suggests an example. Can you just rephrase this to a concrete proposal instead of just a suggestion? I think we are mostly on the same page and we can agree on something and move forward with that


### Plugins by code

All extensible structures should be initialized with the plugins in main (under cmd package) and should support setting up extensions by code. Example can be found [here](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/cmd/epp/main.go#L208-L227).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're saying that we need functionality to

  1. declare which plugins are available to the system
  2. configure a specific (subset) of available plugins into the current schedule

While the second item (configuration) can be done by either code or configuration, the first is more easily done solely in code (unless we resort to Go Plugins and DSO which come with their own complexity).


All extensible structures should be initialized with the plugins in main (under cmd package) and should support setting up extensions by code. Example can be found [here](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/cmd/epp/main.go#L208-L227).

Additionally, most of the code in the current main file should move to a separate file (may be under separate package) to have a very minimal main.go file which only handles the initialization of plugins and calling a `runner` to run the EPP with the given extensions configuration. This will allow to configure plugins with no code duplication and with minimal code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... initialization of plugins

This refers to the set of available plugins - correct?

All extensible structures should be initialized with the plugins in main (under cmd package) and should support setting up extensions by code. Example can be found [here](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/cmd/epp/main.go#L208-L227).

Additionally, most of the code in the current main file should move to a separate file (may be under separate package) to have a very minimal main.go file which only handles the initialization of plugins and calling a `runner` to run the EPP with the given extensions configuration. This will allow to configure plugins with no code duplication and with minimal code.
By doing the above, we end up with a main file that looks very similar to [kube-scheduler main](https://github.com/kubernetes/kubernetes/blob/master/cmd/kube-scheduler/scheduler.go#L29-L33)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registration of available plugins should still be done in an EPP instance (e.g., GIE, llm-d) specific file, such as cmd/main to allow variability between implementations, and can not be done in a shared package


## Design Principles
- Plugins may implement more than one extension point.
More specifically, plugins may implement multiple extension points that are defined in different layers, e.g., a plugin may implement extension point from scheduling layer and another one from requestcontrol layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: link the docs for scheduling framework and requestcontrol framework


## Proposal

This proposal aims to define how to structure and setup plugins for different layers of the system. For the sake of the discussion, the proposal focuses on extension points from the scheduling layer, which is the most stable one in terms of pluggability, and from the RequestControl layer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This proposal aims to define how to structure and setup plugins for different layers of the system. For the sake of the discussion, the proposal focuses on extension points from the scheduling layer, which is the most stable one in terms of pluggability, and from the RequestControl layer.
This proposal aims to define how to structure and setup plugins for different layers of the system. For the sake of the discussion, the proposal focuses on extension points from the scheduling layer, which is the most stable one in terms of pluggability.

This proposal aims to define how to structure and setup plugins for different layers of the system. For the sake of the discussion, the proposal focuses on extension points from the scheduling layer, which is the most stable one in terms of pluggability, and from the RequestControl layer.
RequestControl might end up having multiple extension points, two of those are already agreed on all parties and will be used as a basis for the discussion:

- `PreRequest` a plugin that takes the scheduling result and use it to execute logic before the request is sent to the selected endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `PreRequest` a plugin that takes the scheduling result and use it to execute logic before the request is sent to the selected endpoint.
- `PreRequest` a plugin that takes the scheduling result and use it to execute logic before the request is sent to the selected endpoint.


Please note that there is no intention to cover all extension points of the system, but only to specify extension points from at least two different layers in order to discuss how to maintain and structure plugins in the repo.

### Plugins maintainace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Plugins maintainace
### Plugins maintenance


### Plugins maintainace
Since plugins may implement multiple extension points from different layers of EPP, it makes sense to group plugin implementations in under one directory.
For example, instead of keeping plugins under `/pkg/epp/scheduling/framework/plugins`, this proposal suggests to define a shared package to be used for all plugins of the system - `pkg/epp/plugins`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

The language here is pretty "soft" - it just suggests an example. Can you just rephrase this to a concrete proposal instead of just a suggestion? I think we are mostly on the same page and we can agree on something and move forward with that

Since plugins may implement multiple extension points from different layers of EPP, it makes sense to group plugin implementations in under one directory.
For example, instead of keeping plugins under `/pkg/epp/scheduling/framework/plugins`, this proposal suggests to define a shared package to be used for all plugins of the system - `pkg/epp/plugins`.

Additionally, from the same reason, this proposal suggests to have a single Plugin interface across the codebase and all specific plugins should embed this plugin inteface in the extension point. This will allow to register a general `Plugin` instance to EPP and auto-register the plugin in the right extension points (might be very useful when configuration via extrenal configuration file).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be specific and perhaps add the code snippet here? I think I get what you are seeing about the Plugin interface which perhaps only has a Name() method. But for someone new to this it can be quite confusing.


All extensible structures should be initialized with the plugins in main (under cmd package) and should support setting up extensions by code. Example can be found [here](https://github.com/kubernetes-sigs/gateway-api-inference-extension/blob/main/cmd/epp/main.go#L208-L227).

Additionally, most of the code in the current main file should move to a separate file (may be under separate package) to have a very minimal main.go file which only handles the initialization of plugins and calling a `runner` to run the EPP with the given extensions configuration. This will allow to configure plugins with no code duplication and with minimal code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a nice to have a not necessarily a requirement. I think what you want to see is that we should have some utilities to facilitate the plugin registration, and by doing so you end up with minimal code in main.go. But simplifying main.go isn't the goal of this proposal

So what I suggest is just describing that requirement for that utility package , and don't mention about how to simplify main.go (it's just a result of defining that utility package)/

@k8s-ci-robot
Copy link
Contributor

@nirrozenbaum: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gateway-api-inference-extension-test-e2e-main 6242a97 link true /test pull-gateway-api-inference-extension-test-e2e-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants