Skip to content

Datalayer refactoring: HTTP datasource and client#2120

Merged
k8s-ci-robot merged 4 commits intokubernetes-sigs:mainfrom
irar2:datalayer
Jan 12, 2026
Merged

Datalayer refactoring: HTTP datasource and client#2120
k8s-ci-robot merged 4 commits intokubernetes-sigs:mainfrom
irar2:datalayer

Conversation

@irar2
Copy link
Copy Markdown
Contributor

@irar2 irar2 commented Jan 11, 2026

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR refactors metrics datasource and client into a general HTTP datasource and client, allowing code reuse in similar scenarios, e.g., gathering of models info.

Which issue(s) this PR fixes:

Does this PR introduce a user-facing change?:

NONE

Signed-off-by: irar2 <irar@il.ibm.com>
@k8s-ci-robot k8s-ci-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jan 11, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 11, 2026

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

Name Link
🔨 Latest commit e997623
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6963a92d9c3f23000842bc5d
😎 Deploy Preview https://deploy-preview-2120--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 requested a review from elevran January 11, 2026 08:42
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 11, 2026
@k8s-ci-robot k8s-ci-robot requested a review from shmuelk January 11, 2026 08:42
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 11, 2026
@k8s-ci-robot
Copy link
Copy Markdown
Contributor

Hi @irar2. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 11, 2026
@elevran
Copy link
Copy Markdown
Contributor

elevran commented Jan 11, 2026

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 11, 2026
Signed-off-by: irar2 <irar@il.ibm.com>
@@ -1,5 +1,5 @@
/*
Copyright 2025 The Kubernetes Authors.
Copyright 2026 The Kubernetes Authors.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: the copyright is realy 2025-... I don't think we need to change copyright statements in files modified in a specific year,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reverted to 2025


client Client // client (e.g. a wrapped http.Client) used to get metrics
client Client // client (e.g. a wrapped http.Client) used to get data
parser func(io.Reader) (any, error)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Q: I think there are two high level ways to refactor this:

  • keep a shared implementation and configure it from the outside with implementation specific details (the typed-name, parse callback, output type, etc); or
  • create specific instances (e.g., metrics, v1/models) that build a data source from lower level building blocks (e.g., they would have their own TypedName, call client.Get() and then pass the result to an internal parse method, instead of adding parse to the Get parameters).

To clarify, you could still have an HTTPDataSource under pkg/epp/datalayer/http, but add MetricsSource and ModelsSource Go files next to it or in their own directories. By embedding an HTTPDataSource the specific sources could reuse the shared implementation.

Out of curiosuity, any thoughts on preferring one over the other? Either approach works, they can be thought of as composition vs inheritance.
I would lean towards the second approach (e.g., there is no HTTPDataSource registered factory in the system, only ones for metrics and v1/models so the HTTP bits seem like an implemntation detail to me and can be modeled as function "building blocks" and not reuse the full struct, esp. since v1/models would be in a different repo altogether).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that the second approach allows less code reuse comparing to the first one

@elevran
Copy link
Copy Markdown
Contributor

elevran commented Jan 11, 2026

/ok-to-test
/lgtm
left a comment regarding reuse approach, just for thought - no need to change implementation if you prefer it the current way.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2026
Signed-off-by: irar2 <irar@il.ibm.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2026
Signed-off-by: irar2 <irar@il.ibm.com>
@shmuelk
Copy link
Copy Markdown
Contributor

shmuelk commented Jan 11, 2026

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 11, 2026
Copy link
Copy Markdown
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.

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: irar2, nirrozenbaum

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

The pull request process is described here

Details 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 Jan 12, 2026
@k8s-ci-robot k8s-ci-robot merged commit c49f264 into kubernetes-sigs:main Jan 12, 2026
11 checks passed
@irar2 irar2 deleted the datalayer branch January 12, 2026 08:40
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

5 participants