-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
docDocumentation thingsDocumentation things
Description
Improve Docs
Continue with #3184
I got an error of "local DNS is empty" when I try to deploy a APISIX pod.
I specified DNS resolver as IPv6 address.
Please describe which part of docs should be improved or typo fixed
Source code with the error:
https://github.com/apache/apisix/blob/924a30db36268ee1d7fab255ddebfc23a7110314/apisix/cli/ops.lua
local dns_resolver = sys_conf["dns_resolver"]
if not dns_resolver or #dns_resolver == 0 then
local dns_addrs, err = local_dns_resolver("/etc/resolv.conf")
if not dns_addrs then
util.die("failed to import local DNS: ", err, "\n")
end
if #dns_addrs == 0 then
util.die("local DNS is empty\n")
end
sys_conf["dns_resolver"] = dns_addrs
end
DNS address is not read because local_dns_resolver function doesn't parse IPv6 address.
We can see the regex.
https://github.com/apache/apisix/blob/924a30db36268ee1d7fab255ddebfc23a7110314/apisix/cli/ops.lua
local function local_dns_resolver(file_path)
local file, err = io_open(file_path, "rb")
if not file then
return false, "failed to open file: " .. file_path .. ", error info:" .. err
end
local dns_addrs = {}
for line in file:lines() do
local addr, n = line:gsub("^nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$", "%1")
if n == 1 then
table_insert(dns_addrs, addr)
end
end
file:close()
return dns_addrs
end
I hope this improvement could be applied, thanks.
Describe the solution you'd like
Add a regex for IPv6 DNS resolver.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
docDocumentation thingsDocumentation things