| $ORIGIN consul. | |
| ; Generated at {{timestamp}} | |
| ; Known differences from the built-in consul interface: | |
| ; - No support for PTR records | |
| ; - Does not return A records for RFC 2782-style names | |
| ; - May be some issues with case-sensitivity | |
| ; - Looks like agent might support "tag.tag.name.service.consul"? | |
| ; - TTLs | |
| ; - CNAME records for alias nodes | |
| ; - AAAA and generally support for IPv6 | |
| ; - Un-datacenter-qualified SRV lookups of services do not qualify the | |
| ; result with a DC | |
| $TTL 0 | |
| @ IN SOA localhost. localhost. ( | |
| {{timestamp "01021504"}} ; serial | |
| 86400 ; refresh | |
| 7200 ; retry | |
| 604800 ; expire | |
| 0 ; negcache | |
| ) | |
| _test IN TXT "ok" | |
| ;;;;;;;;;;;;;;;;;; | |
| ; Local datacenter | |
| ;;;;;;;;;;;;;;;;;; | |
| ; Services | |
| $TTL 5 | |
| {{range $service := services}} | |
| ; {{$service.Name}} | |
| {{range service $service.Name}} | |
| {{$service.Name}}.service.consul. IN A {{.Address}} | |
| {{$service.Name}}.service.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.consul. | |
| _{{$service.Name}}._tcp.service.consul. IN A {{.Address}} | |
| _{{$service.Name}}._tcp.service.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.consul. | |
| {{end}} | |
| {{range $tag, $nodes := service $service.Name | byTag}} | |
| {{range $nodes}} | |
| {{$tag}}.{{$service.Name}}.service.consul. IN A {{.Address}} | |
| {{$tag}}.{{$service.Name}}.service.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.consul. | |
| _{{$service.Name}}._{{$tag}}.service.consul. IN A {{.Address}} | |
| _{{$service.Name}}._{{$tag}}.service.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.consul. | |
| {{end}} | |
| {{end}} | |
| {{end}}{{/* services */}} | |
| ; Nodes | |
| $TTL 30 | |
| {{range nodes}} | |
| {{.Node}}.node.consul. IN A {{.Address}} | |
| {{end}}{{/* nodes */}} | |
| {{range $dc := datacenters}} | |
| ;;;;;;;;;;;;;;;;;;;;;;; | |
| ; Datacenter: {{$dc}} | |
| ;;;;;;;;;;;;;;;;;;;;;;; | |
| ; Services | |
| $TTL 5 | |
| {{range $service := printf "@%s" $dc | services}} | |
| ; {{$service.Name}} | |
| {{range printf "%s@%s" $service.Name $dc | service}} | |
| {{$service.Name}}.service.{{$dc}}.consul. IN A {{.Address}} | |
| {{$service.Name}}.service.{{$dc}}.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.{{$dc}}.consul. | |
| _{{$service.Name}}._tcp.service.{{$dc}}.consul. IN A {{.Address}} | |
| _{{$service.Name}}._tcp.service.{{$dc}}.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.{{$dc}}.consul. | |
| {{end}} | |
| {{range $tag, $nodes := printf "%s@%s" $service.Name $dc | service | byTag}} | |
| {{range $nodes}} | |
| {{$tag}}.{{$service.Name}}.service.{{$dc}}.consul. IN A {{.Address}} | |
| {{$tag}}.{{$service.Name}}.service.{{$dc}}.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.{{$dc}}.consul. | |
| _{{$service.Name}}._{{$tag}}.service.{{$dc}}.consul. IN A {{.Address}} | |
| _{{$service.Name}}._{{$tag}}.service.{{$dc}}.consul. IN SRV 1 1 {{.Port}} {{.Node}}.node.{{$dc}}.consul. | |
| {{end}} | |
| {{end}} | |
| {{end}}{{/* services */}} | |
| ; Nodes | |
| $TTL 30 | |
| {{range printf "@%s" $dc | nodes}} | |
| {{.Node}}.node.{{$dc}}.consul. IN A {{.Address}} | |
| {{end}}{{/* nodes */}} | |
| {{end}}{{/* datacenters */}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment