Skip to content

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

Merged
juststillthinking merged 14 commits into
apache:masterfrom
Revolyssup:revolyssup/fix9565
Sep 26, 2023
Merged

feat: add support for passing resolv.conf in dns discovery#9770
juststillthinking merged 14 commits into
apache:masterfrom
Revolyssup:revolyssup/fix9565

Conversation

@Revolyssup

Copy link
Copy Markdown
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)

@Revolyssup

Copy link
Copy Markdown
Contributor Author

@monkeyDluffy6017 Is this feature desirable?

Comment thread t/discovery/dns/mix.t
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
Copy Markdown
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
Copy Markdown
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 <[email protected]>
Comment thread apisix/discovery/dns/schema.lua Outdated
type = "string",
},
},
resolvconf = {

Copy link
Copy Markdown
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
Copy Markdown
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?

@juststillthinking juststillthinking Aug 14, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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..

Comment thread apisix/discovery/dns/init.lua Outdated
local opts = {
hosts = {},
resolvConf = {},
resolvConf = resolvconf,

Copy link
Copy Markdown
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

@Revolyssup Revolyssup Aug 14, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread t/discovery/dns/resolv.conf Outdated
# See the License for the specific language governing permissions and
# limitations under the License.
#
nameserver 127.0.0.1:1053

@juststillthinking juststillthinking Aug 14, 2023

Copy link
Copy Markdown
Contributor

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

@juststillthinking juststillthinking added wait for update wait for the author's response in this issue/PR and removed discuss feature-request labels Aug 14, 2023
@juststillthinking

Copy link
Copy Markdown
Contributor

Please make the ci pass

@Revolyssup

Copy link
Copy Markdown
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
Comment thread ci/common.sh Outdated
../../build-cache/coredns -dns.port=1053 &
popd || exit 1


Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread t/discovery/dns/mix.t
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

@juststillthinking juststillthinking Sep 25, 2023

Copy link
Copy Markdown
Contributor

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

@Revolyssup Revolyssup Sep 25, 2023

Copy link
Copy Markdown
Contributor Author

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 <[email protected]>
@juststillthinking
juststillthinking merged commit ddac444 into apache:master Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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