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

feat: add support for passing resolv.conf in dns discovery #9770

Merged
merged 14 commits into from
Sep 26, 2023

Conversation

Revolyssup
Copy link
Contributor

Description

Fixes #9565

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
@Revolyssup
Copy link
Contributor Author

@monkeyDluffy6017 Is this feature desirable?

Comment on lines 123 to 130
--- grep_error_log eval
qr/connect to 127.0.0.1:1053/
--- grep_error_log_out
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you delete this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Must have been done by mistake while testing something. Pushed the latest commit

Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
@@ -24,6 +24,9 @@ return {
type = "string",
},
},
resolvconf = {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should add this to config-default.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

config-default already has servers

# servers:

and only one of servers or resolvconf is needed. Should I add it anyways?

Copy link
Contributor

@monkeyDluffy6017 monkeyDluffy6017 Aug 14, 2023

Choose a reason for hiding this comment

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

You should add the resolv_conf to the config-default.yaml, or nobody will find this attribute, add comments to clarify that servers or resolvconf is mutual exclusive

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay sounds good. Adding it..

local default_order = {"last", "SRV", "A", "AAAA", "CNAME"}
local order = core.table.try_read_attr(local_conf, "discovery", "dns", "order")
order = order or default_order

local opts = {
hosts = {},
resolvConf = {},
resolvConf = resolvconf,
Copy link
Contributor

Choose a reason for hiding this comment

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

Use resolv_conf to replace all variables

Copy link
Contributor Author

@Revolyssup Revolyssup Aug 14, 2023

Choose a reason for hiding this comment

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

okay except for the resolveConf key inside opts because that field is in the lua-resty-dns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: revolyssup <ashishjaitiwari15112000@gmail.com>
# See the License for the specific language governing permissions and
# limitations under the License.
#
nameserver 127.0.0.1:1053
Copy link
Contributor

@monkeyDluffy6017 monkeyDluffy6017 Aug 14, 2023

Choose a reason for hiding this comment

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

Maybe you could create the file in build-cache dynamically like the function set_coredns

@monkeyDluffy6017 monkeyDluffy6017 added wait for update wait for the author's response in this issue/PR and removed discuss feature-request labels Aug 14, 2023
Signed-off-by: Ashish Tiwari <ashishjaitiwari15112000@gmail.com>
Signed-off-by: Ashish Tiwari <ashishjaitiwari15112000@gmail.com>
@monkeyDluffy6017
Copy link
Contributor

Please make the ci pass

@Revolyssup
Copy link
Contributor Author

@monkeyDluffy6017 Tests passing now

@Revolyssup Revolyssup removed the wait for update wait for the author's response in this issue/PR label Sep 25, 2023
ci/common.sh Outdated
@@ -140,6 +140,10 @@ set_coredns() {
pushd t/coredns || exit 1
../../build-cache/coredns -dns.port=1053 &
popd || exit 1


Copy link
Contributor

Choose a reason for hiding this comment

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

Remove redundant blank

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -128,3 +128,4 @@ connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
connect to 127.0.0.1:1053
Copy link
Contributor

@monkeyDluffy6017 monkeyDluffy6017 Sep 25, 2023

Choose a reason for hiding this comment

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

Why do you add this? it doesn't look like it has anything to do with your modifications

Copy link
Contributor Author

@Revolyssup Revolyssup Sep 25, 2023

Choose a reason for hiding this comment

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

earlier it was trying 4 times but when resolv.conf is used it tries one more times(5 times)

Signed-off-by: Ashish Tiwari <ashishjaitiwari15112000@gmail.com>
@monkeyDluffy6017 monkeyDluffy6017 merged commit ddac444 into apache:master Sep 26, 2023
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

help request: in discovery.dns.servers config, how to use local DNS resolver ?
3 participants