Skip to content

Conversation

rlakhtakia
Copy link
Contributor

Copy link

netlify bot commented Jul 8, 2025

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

Name Link
🔨 Latest commit 331180d
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/68817a7747b2f40007008397
😎 Deploy Preview https://deploy-preview-1122--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 Jul 8, 2025
@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 Jul 8, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @rlakhtakia. 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/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 8, 2025
@rlakhtakia rlakhtakia marked this pull request as draft July 8, 2025 17:56
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 8, 2025
@nirrozenbaum
Copy link
Contributor

mostly already implemented in #1059

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 9, 2025
@ahg-g
Copy link
Contributor

ahg-g commented Jul 10, 2025

I think there is still some work to be done to actually return multiple endpoints, can we please rebase and address what is left?

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 14, 2025
@rlakhtakia
Copy link
Contributor Author

/ok-to-test

@k8s-ci-robot
Copy link
Contributor

@rlakhtakia: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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.

@rlakhtakia rlakhtakia marked this pull request as ready for review July 15, 2025 18:15
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2025
@rlakhtakia
Copy link
Contributor Author

@ahg-g @nirrozenbaum updated conflicts to remove duplicated logic from #1059

The main change incorporated now is to add the multiple endpoints to the header response.

@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 Jul 15, 2025

endpoint := net.JoinHostPort(targetPod.Address, strconv.Itoa(targetPort))
logger.V(logutil.DEFAULT).Info("Request handled", "model", reqCtx.Model, "targetModel", reqCtx.ResolvedTargetModel, "endpoint", targetPod)
combinedEndpointsString := strings.Join(targetEndpoints, ",")

reqCtx.TargetPod = targetPod
Copy link
Contributor

@nirrozenbaum nirrozenbaum Jul 16, 2025

Choose a reason for hiding this comment

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

This is a bit problematic.

reqCtx.TargetPod is used later to call PostResponse plugins and we should call the plugins with the pod that served the request (the first pod did not necessarily serve it, if the request failed and used fallback to next endpoint).

up until today we used a single endpoint, so that assumption was safe (either the request succeeded and then this is the pod, or it failed). but this assumption is no longer true and reqCtx.TargetPod should be updated correctly to reflect the pod that served the request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some functionality to have multiple target pods. If we don't want to disrupt the current flow, I can add an extra field labelled 'FallbackPods' which will be the remaining list of pods

Copy link
Contributor

@nirrozenbaum nirrozenbaum Jul 22, 2025

Choose a reason for hiding this comment

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

last change is making changes to the scheduler interfaces.. that wasn't the intention :)
the interfaces shouldn't change (I'm referring to PostResponse interface).

in the last change the problem just moved from the director to PostResponse. in PostResponse we need to know which pod actually SERVED the request. there is only one such pod.
not the first one out of the candidate list (cause the first one didn't necessarily served the request, this is the whole point of supporting multiple endpoints).

Copy link
Contributor

Choose a reason for hiding this comment

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

last change is making changes to the scheduler interfaces.. that wasn't the intention :)
the interfaces shouldn't change (I'm referring to PostResponse interface).

They can change if we need to change them, this is not an object api, but I understand that in this case we want to maintain the semantics in that we want to communicate the endpoint that the request was actually sent to.

in the last change the problem just moved from the director to PostResponse. in PostResponse we need to know which pod actually SERVED the request. there is only one such pod.

That is a good point. @AndresGuedez do we have the endpoint that the LB selected in the ext-proc response?

Copy link
Contributor

Choose a reason for hiding this comment

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

adding also @kfswain to the thread

Copy link
Contributor

Choose a reason for hiding this comment

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

So returning the exact endpoint that the LB actually sent the request to is not part of the fallback protocol, we should add that, I opened an issue to track alignment on this #1224; we will need to get agreement on this protocol with Gateway providers, and so this will take time.

However, I don't think we should block this PR on that, fallbacks is for resiliency, avoiding dropping the requests is a better outcome than suboptimal routing. We can keep the PostResponse interface as is and pass the first item in the mean time until we align on the protocol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR has been updated to maintain the PostResponse interface as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

However, I don't think we should block this PR on that, fallbacks is for resiliency, avoiding dropping the requests is a better outcome than suboptimal routing. We can keep the PostResponse interface as is and pass the first item in the mean time until we align on the protocol.

sounds fair enough.
I do like us to try and push the finalization of this feature cause currently it feels incomplete.
I'll do another review cycle.

@rlakhtakia thanks for your patience

Copy link
Collaborator

Choose a reason for hiding this comment

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

Agreed on all accounts.

  • We probably shouldnt knowingly break the interface contract (i.e. the endpoint we pass to PostResponse extension points should be the endpoint served)
  • Fallback is opt-in and actually needing to fall back should have a low occurrence rate, so for the short term we can probably document this limitation.

I do agree we need to see this resolved rather quickly so we dont forget about this limitation and let it bite us later.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 21, 2025
@rlakhtakia
Copy link
Contributor Author

/retest

@ahg-g
Copy link
Contributor

ahg-g commented Jul 23, 2025

one nit, just remove the TODO comment, otherwise this looks good to me.

@nirrozenbaum
Copy link
Contributor

nirrozenbaum commented Jul 23, 2025

current PR actually is not addressing the issue. it changes PostResponse interface (which we should not) and does not give the required information about the selected endpoint which successfully served the request.
current code handles multiple endpoints in the request path (in the form of ip:port,ip:port,...) but doesn't handle the response path.

This point has to be addressed before the PR can be merged (wrote also #1122 (comment))

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2025
@nirrozenbaum
Copy link
Contributor

left few minor comments. overall LGTM!

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 23, 2025
@nirrozenbaum
Copy link
Contributor

/unhold
/lgtm
/approve

Thanks @rlakhtakia!

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 24, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 24, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jul 24, 2025
@k8s-ci-robot k8s-ci-robot merged commit eb7dc7c into kubernetes-sigs:main Jul 24, 2025
9 checks passed
kfswain pushed a commit to kfswain/llm-instance-gateway that referenced this pull request Jul 31, 2025
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/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