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

chore(deps) Update dns dependency and options #2625

Merged
merged 1 commit into from
Jun 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kong-0.10.3-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies = {
"luacrypto == 0.3.2",
"luasyslog == 1.0.0",
"lua_pack == 1.0.4",
"lua-resty-dns-client == 0.5.0",
"lua-resty-dns-client == 0.6.0",
"lua-resty-worker-events == 0.3.0",
"lua-resty-mediador == 0.1.2",
}
Expand Down
21 changes: 18 additions & 3 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -425,16 +425,31 @@
# To read the file again after modifying it,
# Kong must be reloaded.

#dns_order = LAST,SRV,A,CNAME # the order in which to resolve different
#dns_order = LAST,SRV,A,CNAME # The order in which to resolve different
# record types. The `LAST` type means the
# type of the last successful lookup (for the
# specified name). The format is a (case
# insensitive) comma separated list.

#dns_not_found_ttl = 30.0 # ttl in seconds for empty DNS responses and
#dns_stale_ttl = 4 # Defines, in seconds, how long a record will
# remain in cache past its TTL. This value
# will be used while the new DNS record is
# fetched in the background.
# Stale data will be used from expiry of a
# record until either the refresh query
# completes, or the `dns_stale_ttl` number of
# seconds have passed.

#dns_not_found_ttl = 30 # TTL in seconds for empty DNS responses and
# "(3) name error" responses.

#dns_error_ttl = 1.0 # ttl in seconds for error responses.
#dns_error_ttl = 1 # TTL in seconds for error responses.

#dns_no_sync = off # If enabled, then upon a cache-miss every
# request will trigger its own dns query.
# When disabled multiple requests for the
# same name/type will be synchronised to a
# single query.
Copy link
Member

Choose a reason for hiding this comment

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

As a user, what's the benefit I get from tweaking that setting? What's the trade-off between one or multiple queries?

Or, is this new behavior not yet production tested and this value is to ensure that if something goes wrong, the user can revert back to the original behavior?

Copy link
Member Author

Choose a reason for hiding this comment

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

This setting I'd love to get rid of, but it is the one that enables a query per request. (if combined with dns_stale_ttl = 0 and record ttl being 0 as well). I left the description intentionally like this, to motivate people to not use it unless instructed to.

Copy link
Member

Choose a reason for hiding this comment

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

What I am curious about is, why would I be instructed to change this default - as in, under which circumstances? Since it seems to be the default is the most sane value and I see little (no) value in the old behavior compared to this new one (except, as mentioned, reverting to stability if something goes wrong).


#------------------------------------------------------------------------------
# DEVELOPMENT & MISCELLANEOUS
Expand Down
2 changes: 2 additions & 0 deletions kong/conf_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ local CONF_INFERENCES = {
dns_resolver = {typ = "array"},
dns_hostsfile = {typ = "string"},
dns_order = {typ = "array"},
dns_stale_ttl = {typ = "number"},
dns_not_found_ttl = {typ = "number"},
dns_error_ttl = {typ = "number"},
dns_no_sync = {typ = "boolean"},

ssl = {typ = "boolean"},
client_ssl = {typ = "boolean"},
Expand Down
6 changes: 4 additions & 2 deletions kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ db_cache_ttl = 3600
dns_resolver = NONE
dns_hostsfile = /etc/hosts
dns_order = LAST,SRV,A,CNAME
dns_not_found_ttl = 30.0
dns_error_ttl = 1.0
dns_stale_ttl = 4
dns_not_found_ttl = 30
dns_error_ttl = 1
dns_no_sync = off

lua_code_cache = on
lua_socket_pool_size = 30
Expand Down
2 changes: 2 additions & 0 deletions kong/tools/dns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ local setup_client = function(conf)
timeout = nil, -- taken from system resolv.conf; timeout
badTtl = conf.dns_not_found_ttl, -- ttl in seconds for dns error responses (except 3 - name error)
emptyTtl = conf.dns_error_ttl, -- ttl in seconds for empty and "(3) name error" dns responses
staleTtl = conf.dns_stale_ttl, -- ttl in seconds for records once they become stale
order = conf.dns_order, -- order of trying record types
noSynchronisation = conf.dns_no_sync,
}

assert(dns_client.init(opts))
Expand Down