Skip to content

Conversation

@elevran
Copy link
Contributor

@elevran elevran commented Nov 25, 2025

What type of PR is this?
/kind feature

What this PR does / why we need it:
Implement Plugin interface by data layer objects (DataSources and Extractors) to enable configuration from file.

  • Refactor EPP's plugins.Handle object PodList method to avoid circular import dependency (datalayer imports plugins.TypedName and at the same time plugins.Handle.ListPod imports datalayer.Endpoint/backendmetrics.PodMetrics). Replaced with a "narrower" function that only returns the pod names so prefix scorer (the only current user) can evict entries for terminated Pods.
  • Add TypedName() (replacing Name()) to datalayer objects so they're "proper" plugins and can be instantiated by the configuration loader in a future PR. Note that we expect a unique type for each DataSource/Extractor so Name is effectively ignore and left empty.
  • Rmove unused datalayer.metrics.Client from NewDataSource (nil was passed in all cases)
  • Define the data layer conifguration struct

Which issue(s) this PR fixes:
Ref #1883

Does this PR introduce a user-facing change?:
Not yet. This lays the ground work for enabling data layer section in the config file but does not implement it yet.

NONE

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 25, 2025
@netlify
Copy link

netlify bot commented Nov 25, 2025

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

Name Link
🔨 Latest commit 2f704b9
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/69274e142c73c6000813bf4d
😎 Deploy Preview https://deploy-preview-1901--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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 25, 2025
@elevran
Copy link
Contributor Author

elevran commented Nov 25, 2025

/cc
@nirrozenbaum @kfswain
@shmuelk (please review config object)

@k8s-ci-robot
Copy link
Contributor

@elevran: GitHub didn't allow me to request PR reviews from the following users: elevran.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc
@nirrozenbaum @kfswain
@shmuelk (please review config object)

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.

@shmuelk
Copy link
Contributor

shmuelk commented Nov 25, 2025

Please change DataSource and Extractor to be more like the other plugins. They all have a field TypedName, that gets set in the factory function. The TypedNAme function, should simply return that field.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 25, 2025
@elevran elevran force-pushed the datalayer_std_plugins branch from e8d4564 to c05299a Compare November 26, 2025 11:44
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 26, 2025
@elevran
Copy link
Contributor Author

elevran commented Nov 26, 2025

@shmuelk all comments have been address and changes integrated. PTAL.

- use Name as the unique key to allow future extension to support multiple instances of the same type.
- remove GetSourceByName/Type.

Signed-off-by: Etai Lev Ran <[email protected]>
@shmuelk
Copy link
Contributor

shmuelk commented Nov 27, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 27, 2025
// DataSource is a Model Server Protocol (MSP) compliant metrics data source,
// returning Prometheus formatted metrics for an endpoint.
type DataSource struct {
tn plugins.TypedName
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: consistency with other plugins?

Suggested change
tn plugins.TypedName
typedName plugins.TypedName

Copy link
Contributor Author

Choose a reason for hiding this comment

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

current plugins use both typedName (most) and tn (e.g., lora affinity, slo scorer, some mocks in test files).
The scope (i.e., distance between where defined and used) is small enough to use tn here.
If you think it's important, can open another PR to standardize on on typedName across the entire code base.

}
if _, loaded := dsr.sources.LoadOrStore(src.Name(), src); loaded {
return fmt.Errorf("unable to register duplicate data source: %s", src.Name())
if _, loaded := dsr.sources.LoadOrStore(src.TypedName().Name, src); loaded {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit confusing.
generally in the codebase, plugins have TypeName, where Type is mandatory and Name is optional.
when using ConfigFile Name defaults to Type is not mentioned otherwise, but that is not the case if configured through code (e.g., in unit tests name remains empty).
Additionally, in other plugins - Type is guaranteed to be unique, while Name is not.

maybe we can use TypedName.String() as the key of the map?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was originally using Type as the key, went back and forth on this given @shmuelk feedback on usage for configuration file. You can see some of the discussion context in resolved conversations.

The plugin references in the configuration file use the plugin name as the reference key, hence the same is applied here.
At least in theory, you could have multiple sources or extractors of the same type registered (same as plugins).
If we want to change to use TypedName.String() should probaly do so across the entire config handling code.
@shmuelk ^^


type mockDataSource struct {
name string
tn plugins.TypedName
Copy link
Contributor

Choose a reason for hiding this comment

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

typedName?


// Config defines the configuration of EPP data layer, as the set of DataSources and
// Extractors defined on them.
type Config struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this struct a prep for next PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct!
Mainly to confirm the interface between the datalayer and the configuration setting code so they can proceed in parallel.

Copy link
Contributor

@nirrozenbaum nirrozenbaum left a comment

Choose a reason for hiding this comment

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

left few minor non blocking comments.

I think it would be good if we standardize all plugins are keyed by TypedName in all places (in current PR, most of the places use Name but in other plugins TypedName as a whole is the unique identifier).

let's proceed with a "fix it forward" approach.

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: elevran, nirrozenbaum, shmuelk

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 27, 2025
@elevran
Copy link
Contributor Author

elevran commented Nov 27, 2025

I think it would be good if we standardize all plugins are keyed by TypedName in all places (in current PR, most of the places use Name but in other plugins TypedName as a whole is the unique identifier).

let's proceed with a "fix it forward" approach.

#1910 created for tracking.

@k8s-ci-robot k8s-ci-robot merged commit acd7103 into kubernetes-sigs:main Nov 27, 2025
12 checks passed
@elevran elevran deleted the datalayer_std_plugins branch November 27, 2025 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants