envoy: refactor controlplane xds to new envoyconfig package (#2086)

This commit is contained in:
Caleb Doxsey 2021-04-13 13:51:44 -06:00 committed by GitHub
parent 0e66619081
commit 1dcccf2b56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 421 additions and 378 deletions

View file

@ -0,0 +1,25 @@
local function starts_with(str, start)
return str:sub(1, #start) == start
end
function envoy_on_request(request_handle)
local headers = request_handle:headers()
local metadata = request_handle:metadata()
local remove_impersonate_headers = metadata:get("remove_impersonate_headers")
if remove_impersonate_headers then
local to_remove = {}
for k, v in pairs(headers) do
if starts_with(k, "impersonate-extra-") or k == "impersonate-group" or k == "impersonate-user" then
table.insert(to_remove, k)
end
end
for k, v in pairs(to_remove) do
headers:remove(v)
end
end
end
function envoy_on_response(response_handle)
end