Skip to content

Conversation

shmuelk
Copy link
Contributor

@shmuelk shmuelk commented Jun 29, 2025

This PR adds a handle function that retrieves an instantiated plugin and verifies it's type. An error is returned if either the referenced plugin doesn't exist or it is of the wrong type.

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
Copy link

netlify bot commented Jun 29, 2025

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

Name Link
🔨 Latest commit c884ab7
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6861559fa61fcd0008bdecf8
😎 Deploy Preview https://deploy-preview-1091--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 the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 29, 2025
@k8s-ci-robot k8s-ci-robot requested review from ahg-g and liu-cong June 29, 2025 13:35
@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 Jun 29, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @shmuelk. 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.

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/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 29, 2025
Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
}

// PluginByType retrieves the specified plugin by name and verifies its type
func PluginByType[P Plugin](handle Handle, name string) (P, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

looks good, can we pass plugins instead of handle as arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@nirrozenbaum
Copy link
Contributor

/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 Jun 29, 2025
Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

rawPlugin := handlePlugins.Plugin(name)
if rawPlugin == nil {
return zero, fmt.Errorf("there was no plugin with the name '%s' defined", name)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit1:

Suggested change
return zero, fmt.Errorf("there was no plugin with the name '%s' defined", name)
return zero, fmt.Errorf("there is no plugin with the name '%s' defined", name)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
thePlugin, ok := rawPlugin.(P)
if !ok {
return zero, fmt.Errorf("the plugin with the name '%s' was not an instance of %T", name, zero)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit2:

Suggested change
return zero, fmt.Errorf("the plugin with the name '%s' was not an instance of %T", name, zero)
return zero, fmt.Errorf("the plugin with the name '%s' is not an instance of %T", name, zero)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
@nirrozenbaum
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 29, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 Jun 29, 2025
@k8s-ci-robot k8s-ci-robot merged commit 5c851eb into kubernetes-sigs:main Jun 29, 2025
9 checks passed
@shmuelk shmuelk deleted the epp-handle-3 branch June 29, 2025 15:34
EyalPazz pushed a commit to EyalPazz/gateway-api-inference-extension that referenced this pull request Jul 9, 2025
…-sigs#1091)

* Added a helper function to get referenced plugins by type

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Added a function comment

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Update from review comment

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Updates from review comments

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

---------

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
BenjaminBraunDev pushed a commit to BenjaminBraunDev/gateway-api-inference-extension that referenced this pull request Aug 12, 2025
…-sigs#1091)

* Added a helper function to get referenced plugins by type

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Added a function comment

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Update from review comment

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

* Updates from review comments

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>

---------

Signed-off-by: Shmuel Kallner <kallner@il.ibm.com>
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. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants