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

fix(conf): remove CNAME from default dns_order option #13107

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: Removed `CNAME` from default `dns_order` option
type: breaking_change
scope: Configuration
5 changes: 2 additions & 3 deletions kong.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,7 @@
# overridden by the environment variables `LOCALDOMAIN` and `RES_OPTIONS` if
# they have been set.
#
# Kong will resolve hostnames as either `SRV` or `A` records (in that order, and
# `CNAME` records will be dereferenced in the process).
# Kong will resolve hostnames as either `SRV` or `A` records.
# In case a name was resolved as an `SRV` record it will also override any given
# port number by the `port` field contents received from the DNS server.
#
Expand All @@ -1523,7 +1522,7 @@
# 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 # 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
Expand Down
2 changes: 1 addition & 1 deletion kong/templates/kong_defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ db_cache_warmup_entities = services

dns_resolver = NONE
dns_hostsfile = /etc/hosts
dns_order = LAST,SRV,A,CNAME
dns_order = LAST,SRV,A
dns_valid_ttl = NONE
dns_stale_ttl = 3600
dns_cache_size = 10000
Expand Down
2 changes: 1 addition & 1 deletion spec/01-unit/03-conf_loader_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ describe("Configuration loader", function()
it("infer arrays (comma-separated strings)", function()
local conf = assert(conf_loader())
assert.same({"bundled"}, conf.plugins)
assert.same({"LAST", "SRV", "A", "CNAME"}, conf.dns_order)
assert.same({"LAST", "SRV", "A"}, conf.dns_order)
assert.is_nil(getmetatable(conf.plugins))
assert.is_nil(getmetatable(conf.dns_order))
end)
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/05-proxy/05-dns_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ for _, strategy in helpers.each_strategy() do

local service = bp.services:insert {
name = "tests-retries",
host = "nowthisdoesnotexistatall",
host = "nowthisdoesnotexistatall.test",
Copy link
Contributor Author

@chobits chobits Jun 3, 2024

Choose a reason for hiding this comment

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

NOTE: The AWS route 53 DNS server will reply "(2) server failure" for an A-type domain without dot, like "nowthisdoesnotexistatall".
Because we have removed CNAME from LAST_ORDER, the final attempt is now changed from CNAME to A.

path = "/exist",
port = 80,
protocol = "http"
Expand Down
4 changes: 2 additions & 2 deletions spec/02-integration/14-tracing/01-instrumentations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ for _, strategy in helpers.each_strategy() do
-- intentionally trigger a DNS query error
local service = bp.services:insert({
name = "inexist-host-service",
host = "really-inexist-host",
host = "really-inexist-host.test",
port = 80,
})

Expand Down Expand Up @@ -558,7 +558,7 @@ for _, strategy in helpers.each_strategy() do
local dns_spans = assert_has_spans("kong.dns", spans)
local upstream_dns
for _, dns_span in ipairs(dns_spans) do
if dns_span.attributes["dns.record.domain"] == "really-inexist-host" then
if dns_span.attributes["dns.record.domain"] == "really-inexist-host.test" then
upstream_dns = dns_span
break
end
Expand Down
Loading