-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(*): port several PDK and shared llm module from ai-proxy-advanced feature #13347
Conversation
@@ -359,6 +359,16 @@ local function execute(balancer_data, ctx) | |||
balancer_data.balancer_handle = handle | |||
|
|||
else | |||
-- Note: balancer_data.retry_callback is only set by PDK once in access phase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the retry_callback
can be invoked only when balancer == nil
, is it expected to work like this?
In addition, should we wrap retry_callback with pcall?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the retry_callback can be invoked only when balancer == nil, is it expected to work like this?
Yes, if we skip the balancer lookup by doing kong.service.set_target
, i.e. currently request doesn't have a upstream, then balancer, upstream = balancers.get_balancer(balancer_data)
will return no balancer. Actually, this else branch is just made to support kong.service.set_target
.
This matches our expectation, retry_callback will not be called if Kong's balancer is not skipped.
In addition, should we wrap retry_callback with pcall?
yes, adding that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will address all comments in EE side of PR and port here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Reviewers: please review https://github.com/Kong/kong-ee/pull/9562 first for a whole picture, I will then address comments there and port here. |
Cherry-pick failed for Please cherry-pick the changes locally. git remote add upstream https://github.com/kong/kong-ee
git fetch upstream master
git worktree add -d .worktree/cherry-pick-13347-to-master-to-upstream upstream/master
cd .worktree/cherry-pick-13347-to-master-to-upstream
git checkout -b cherry-pick-13347-to-master-to-upstream
ancref=$(git merge-base 982143769aa5bd271307fa70840051da1ca32a08 360b4f0e7d8a7d2a7e1ca373fd4f7d43a76b37e1)
git cherry-pick -x $ancref..360b4f0e7d8a7d2a7e1ca373fd4f7d43a76b37e1 |
ce-ee cherrypick not needed, it's part of the ai-proxy-advanced PR and is merged |
Summary
This PR adds several PDK methods to allow ai-proxy-advanced plugin to do customized load balancing and failover.
It also moves the ai-proxy handler to a shared module so that both ai-proxy{,-advanced} plugins can reuse same codebase.
https://github.com/Kong/kong-ee/pull/9562
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
AG-12