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

DNS SRV returnning wrong hostnames #2218

Closed
janisz opened this issue Jul 28, 2016 · 2 comments · Fixed by #2271
Closed

DNS SRV returnning wrong hostnames #2218

janisz opened this issue Jul 28, 2016 · 2 comments · Fixed by #2271

Comments

@janisz
Copy link
Contributor

janisz commented Jul 28, 2016

Client: 0.6.4
Server: 0.6.4

Description of the Issue (and unexpected/desired result)

When obtaining services with DNS SVR backed with prepared query. Returned hostnames could not be resolved by Consul.

Reproduction steps

  1. Create prepared query
{
  "ID":"01e751dd-3386-5e9c-f2d1-160799d7c8da",
  "Name":"",
  "Session":"",
  "Token":"",
  "Template":{
    "Type":"name_prefix_match",
    "Regexp":""
  },
  "Service":{
    "Service":"${name.full}",
    "Failover":{
      "NearestN":2,
      "Datacenters":[
        "dc1",
        "dc2"
      ]
    },
    "OnlyPassing":false,
    "Tags":null
  },
  "DNS":{
    "TTL":""
  },
  "CreateIndex":5143303,
  "ModifyIndex":7721140
}
 dig @agent.dc1.consul -p 8600 my-service.query.consul. SRV

;; ANSWER SECTION:
my-service.query.consul. 0  IN  SRV 1 1 31529 my-hostname-from-dc2.node.dc1.consul.

 dig @agent.dc1.consul -p 8600 my-hostname-from-dc2.node.dc1.consul. A

returns no results.

Problem lies in consul adding <dc>.consul from agent performing query not the agent service is located.

@janisz
Copy link
Contributor Author

janisz commented Jul 28, 2016

I see 2 possible hotfixes

  1. Falback to other DC if not found service in local DC: command/agent/dns.go#L394
  2. Somehow return proper DC suffix for node: command/agent/dns.go#L747

@maxvt
Copy link

maxvt commented Jul 28, 2016

Looks like you have the same issue as me. Please take a look at #2219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants