add header-value annotation

add new annotation (header-value)
parse it and propogate to lua script
alter balancer rule to include it into the canary routing logic
add e2e test to validate fallback for canary-by-header-value
add description of canary-by-header-value to documentation
This commit is contained in:
minherz 2019-01-30 23:19:19 +02:00
parent e7e8d1a0f2
commit de2a1ece6d
7 changed files with 155 additions and 13 deletions

View file

@ -160,7 +160,11 @@ local function route_to_alternative_balancer(balancer)
local target_header = util.replace_special_char(traffic_shaping_policy.header, "-", "_")
local header = ngx.var["http_" .. target_header]
if header then
if header == "always" then
if traffic_shaping_policy.headerValue then
if traffic_shaping_policy.headerValue == header then
return true
end
elseif header == "always" then
return true
elseif header == "never" then
return false