-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
hotfix(conf) convert custom nginx conf dns_resolver to string #2386
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,14 @@ describe("NGINX conf compiler", function() | |
assert.matches("worker_connections %d+;", nginx_conf) | ||
assert.matches("multi_accept on;", nginx_conf) | ||
end) | ||
it("converts dns_resolver to string", function() | ||
local nginx_conf = prefix_handler.compile_nginx_conf({ | ||
dns_resolver = { "8.8.8.8", "8.8.4.4" } | ||
}, [[ | ||
"resolver ${{DNS_RESOLVER}} ipv6=off;" | ||
]]) | ||
assert.matches("resolver 8.8.8.8 8.8.4.4 ipv6=off;", nginx_conf, nil, true) | ||
end) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a regression test where dns_resolver is a string as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean something else than this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Such a test exists here for all array properties and not just |
||
end) | ||
|
||
describe("prepare_prefix()", function() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:O This is a bit concerning. Apparently this is not in the template anymore, and maybe the user who reported it is using an old version of the template? We should check with him, and probably add it back... :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is not. Is it problem to have that in case user wants to add a resolver line in his template? This will not break anything in case there is no resolver line in a template (our dns resolver uses this). We could also suggest user adding
for
loop in his template, but it would be a bit ugly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean that if user wants the Nginx resolver use the same resolvers as Kong DNS resolver and configure it in one place, does it hurt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm at the same time, it is true we do not need it anymore since all of our DNS resolution is currently taken care of on the Lua-land...
I feel like this is a completely valid point, and to sum up the concerns, I would say they are:
:connect()
call with our own Lua-land resolver. While it is nice to be able to use the same DNS resolver everywhere and feed it with better features than the Nginx one, I am curious about the performance impact of that, and wonder if we should not instead invest time and energy in the Nginx resolver itself (a long-time thought of mine)Because of 2. and 4. (probably most of the use-cases), I think it's fine to merge this patch as-is, without adding it back to the template are I suggested to maybe do.
Do you agree with this reasoning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, no need to add anything back to our templates. This is just to serve current custom template users (maybe just one).