Skip to content

Add fallback logic to support multiple endpoints #1122

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

rlakhtakia
Copy link
Contributor

Copy link

netlify bot commented Jul 8, 2025

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

Name Link
🔨 Latest commit 8bfdd35
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/687e6a74ad3d0100086bbbd9
😎 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
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: rlakhtakia
Once this PR has been reviewed and has the lgtm label, please assign ahg-g 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 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).

@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

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. 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.

4 participants