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 externalDNS in sdk #1473

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

denis-tingaikin
Copy link
Member

@denis-tingaikin denis-tingaikin commented Jun 25, 2023

Description

Issue link

networkservicemesh/deployments-k8s#5435

How Has This Been Tested?

  • Added unit testing to cover
  • Tested manually
  • Tested by integration testing
  • Have not tested

Types of changes

  • Bug fix
  • New functionality
  • Documentation
  • Refactoring
  • CI

@denis-tingaikin denis-tingaikin changed the title feat; add support for external dns in sdk feat: add support for external dns in sdk Jun 25, 2023
Signed-off-by: Denis Tingaikin <[email protected]>
@codecov
Copy link

codecov bot commented Jun 26, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@a8c394e). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1473   +/-   ##
=======================================
  Coverage        ?   70.43%           
=======================================
  Files           ?      248           
  Lines           ?    11185           
  Branches        ?        0           
=======================================
  Hits            ?     7878           
  Misses          ?     2806           
  Partials        ?      501           

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@denis-tingaikin denis-tingaikin marked this pull request as ready for review June 26, 2023 09:20
@denis-tingaikin denis-tingaikin changed the title feat: add support for external dns in sdk feat: add support for externalDNS in sdk Jun 26, 2023
func TestInterdomainNetworkServiceRegistryWithDifferentDNSScheme(t *testing.T) {
t.Cleanup(func() { goleak.VerifyNone(t) })

ctx, cancel := context.WithTimeout(context.Background(), time.Hour*10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we use 5s timeout?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks fixed

@@ -40,8 +49,7 @@ func NewFakeResolver() dnsresolve.Resolver {
// AddSRVEntry adds a DNS record to r using name and service as the
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: please fix func description

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks fixed

Signed-off-by: Denis Tingaikin <[email protected]>
@edwarnicke
Copy link
Member

Am I reading this correctly that this PR is making it possible to set the resolver options to be able to test in sandbox?

Do we anticipate these changes being used for non-testing cases?

@denis-tingaikin
Copy link
Member Author

@edwarnicke The resolver options will be used in registry-proxy-dns to work with externalDNS.

Currently, registry-proxy-dns could work only with k8s cluster DNS.

For example, we're supporting discovery in format cluster-name.k8s-service-name. Where service name is fixed and now its registry and nsmgr-proxy.

With those options we also will support discovery in format any-domain.any-service-name.

@edwarnicke
Copy link
Member

OK... I'm a little confused. registry-proxy-dns should be looking up an SRV record via DNS for whatever the domain is. If he network service registry domain is @finance.example.com, it should be looking up:

_nsm_registry._tcp.finance.example.com. 86400 IN SRV 10 5 5223 server.example.com.

(I've forgotten what the string we use for that last part is, but it should be something to indicate that our service is he nsm registry for that registry domain).

So long as the K8s DNS delegates to global DNS, we shouldn't need to point to any other DNS. We should be using the same SRV record pattern to find a registry server no matter where things are running.

@denis-tingaikin
Copy link
Member Author

@edwarnicke It could be diffecult for users whos use externalDNS to make the same scheme as we have with Coredns + k8s_external plugin

At this moment we're working fine with entries

_nsm_registry._tcp.finance.example.com. 86400 IN SRV 10 5 5223 server.example.com.

But what if registry service has another name?

_**my**_nsm_registry._tcp.finance.example.com. 86400 IN SRV 10 5 5223 server.example.com.

The patch in this PR allows to configure services that we're looking

@edwarnicke
Copy link
Member

That's the point of an SRV record, the

_nsm_registry._tcp is intended to be a common 'name' for the kind of service. For example, for the SIP protocol the SIP server for a domain is done by looking up the _sip._tcp subdomain of a given domain. So you can always find the SIP server for example.com by looking for:

_sip._tcp.example.com. 86400 IN SRV 0 5 5060 sipserver.example.com.

If you can set the SRV record in finance.example.com for

_**my**_nsm_registry._tcp.finance.example.com. 86400 IN SRV 10 5 5223 server.example.com.

I would expect you would be able to set the SRV record in finance.example.com for:

_nsm_registry._tcp.finance.example.com. 86400 IN SRV 10 5 5223 server.example.com.

If there's an existing _nsm_registry for the finance.example.com domain, and you want a different one, the right solution is to create a subdomain my.finance.example.com and create an SRV record for it:

_nsm_registry._tcp.my.finance.example.com. 86400 IN SRV 10 5 5223 otherserver.example.com.

All of that said... I don't understand what this has to do with external DNS... the "_nsm_registry" part should be the same whether we are running in the cluster or not.

Am I missing something?

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.

5 participants