Skip to content
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

Support rolling publishing in AI scenarios #195

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function GetRulesToPatch(spec, stableService, protocol)
local matchedRoutes = {}
if (spec[protocol] ~= nil) then
for _, rule in ipairs(spec[protocol]) do
local retries = rule.retries or {}
if #retries == 0 then
rule.retries = nil
end
-- skip routes contain matches
if (rule.match == nil) then
for _, route in ipairs(rule.route) do
Expand All @@ -44,6 +48,14 @@ end

-- generate routes with matches, insert a rule before other rules, only support http headers, cookies etc.
function GenerateRoutesWithMatches(spec, matches, stableService, canaryService)
local http = spec.http
for _, rule in ipairs(http) do
local retries = rule.retries or {}
if #retries == 0 then
rule.retries = nil
end
end

for _, match in ipairs(matches) do
local route = {}
route["match"] = {}
Expand Down Expand Up @@ -79,7 +91,7 @@ function GenerateRoutesWithMatches(spec, matches, stableService, canaryService)
else
route.route[1].destination.host = canaryService
end
table.insert(spec.http, 1, route)
table.insert(http, 1, route)
end
end

Expand Down
Loading