add: Support Istio getaway to filter VirtualService retries fields & Delete match with traffic judgment.
Signed-off-by: 赵禹 <12424564+craincn@user.noreply.gitee.com>
This commit is contained in:
parent
678d4d2b34
commit
88671c8417
|
|
@ -19,6 +19,10 @@ function GetRulesToPatch(spec, stableService, protocol)
|
||||||
local matchedRoutes = {}
|
local matchedRoutes = {}
|
||||||
if (spec[protocol] ~= nil) then
|
if (spec[protocol] ~= nil) then
|
||||||
for _, rule in ipairs(spec[protocol]) do
|
for _, rule in ipairs(spec[protocol]) do
|
||||||
|
local retries = rule.retries or {}
|
||||||
|
if #retries == 0 then
|
||||||
|
rule.retries = nil
|
||||||
|
end
|
||||||
-- skip routes contain matches
|
-- skip routes contain matches
|
||||||
if (rule.match == nil) then
|
if (rule.match == nil) then
|
||||||
for _, route in ipairs(rule.route) do
|
for _, route in ipairs(rule.route) do
|
||||||
|
|
@ -44,6 +48,14 @@ end
|
||||||
|
|
||||||
-- generate routes with matches, insert a rule before other rules, only support http headers, cookies etc.
|
-- generate routes with matches, insert a rule before other rules, only support http headers, cookies etc.
|
||||||
function GenerateRoutesWithMatches(spec, matches, stableService, canaryService)
|
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
|
for _, match in ipairs(matches) do
|
||||||
local route = {}
|
local route = {}
|
||||||
route["match"] = {}
|
route["match"] = {}
|
||||||
|
|
@ -79,7 +91,7 @@ function GenerateRoutesWithMatches(spec, matches, stableService, canaryService)
|
||||||
else
|
else
|
||||||
route.route[1].destination.host = canaryService
|
route.route[1].destination.host = canaryService
|
||||||
end
|
end
|
||||||
table.insert(spec.http, 1, route)
|
table.insert(http, 1, route)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue