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

CLI: increase body size on template render. #1240

Merged
merged 1 commit into from
Nov 16, 2020
Merged

Conversation

eloycoto
Copy link
Contributor

A user reported that when a lot of services in K8s environment started
with apicast name, APICast cannot started because of the body size of
the template.

Because the body limit is set to nil, but liquid template set to 100000
[0] and started to fail in there.

The main reason to print all ENV variables on the nginx.conf, is because
the following code [1]

[0] https://github.com/3scale/liquid-lua/blob/a7f4119e96054f08df1fb8dce2be3469eb7ffb5f/lib/liquid.lua#L2675-L2686
[1]

local resty_env = require('resty.env')
-- WARNING, WARNING, WARNING: this is insane hack and should not be touched
-- This file is not templated by Liquid, because it is used by not blackbox integration tests (Search for TEST_NGINX_HTTP_CONFIG).
-- So it cannot be templated by liquid, to lift env variables and persist them in the configuration.
-- This is a workaround so we can store environment at the time of building the config into the config itself.
-- {% raw %} {{ ENV }} {% endraw %} is both valid Liquid template and Lua code.
-- In Lua it is a table with another empty table inside. In Liquid it prints variable ENV.
-- This ENV variable is defined in the main nginx.conf.liquid and injected when including this partial.
-- The content of the ENV variable is a Lua table, so when rendered it actually can run ipairs on it.
for k,v in pairs({{ ENV }}) do
if type(k) == 'string' and not resty_env.value(k) then
resty_env.set(k,v)
end

Fix THREESCALE-6315

Signed-off-by: Eloy Coto [email protected]

@eloycoto eloycoto requested a review from a team as a code owner November 11, 2020 21:35
@@ -94,7 +94,7 @@ function _M:interpret(str)
local context = self.context
local filesystem = self.filesystem
local filter_set = FilterSet:new()
local resource_limit = ResourceLimit:new(nil, 1000, nil)
local resource_limit = ResourceLimit:new(1000000, 1000, nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have a link to the issue here so we remember why this value is not the default one.

A user reported that when a lot of services in K8s environment started
with apicast name, APICast cannot started because of the body size of
the template.

Because the body limit is set to nil, but liquid template set to 100000
[0] and started to fail in there.

The main reason to print all ENV variables on the nginx.conf, is because
the following code [1]

[0] https://github.com/3scale/liquid-lua/blob/a7f4119e96054f08df1fb8dce2be3469eb7ffb5f/lib/liquid.lua#L2675-L2686
[1] https://github.com/3scale/APIcast/blob/fba67b02200a4df231546145296927dea816c33f/gateway/http.d/init.conf#L46-L58

Fix THREESCALE-6315

Signed-off-by: Eloy Coto <[email protected]>
@eloycoto eloycoto merged commit 3eac127 into master Nov 16, 2020
@eguzki eguzki deleted the THREESCALE-6315 branch August 17, 2022 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants