Merge pull request #3619 from minherz/add-canary-header-by-value

add header-value annotation
This commit is contained in:
Kubernetes Prow Robot 2019-02-01 14:45:54 -08:00 committed by GitHub
commit d4d25f6fb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 and #traffic_shaping_policy.headerValue > 0 then
if traffic_shaping_policy.headerValue == header then
return true
end
elseif header == "always" then
return true
elseif header == "never" then
return false