BeryJu / gravity

Fully-replicated DNS and DHCP Server with ad-blocking powered by etcd
https://gravity.beryju.io
GNU General Public License v3.0
532 stars 12 forks source link

Add support for external-dns integration #915

Open CygnusHyoga opened 8 months ago

CygnusHyoga commented 8 months ago

It would be great to add gravity dns as an external-dns provider, to be able to automatically manage records for external kubernetes services.

External-dns project: https://github.com/kubernetes-sigs/external-dns

Thanks.

CygnusHyoga commented 8 months ago

External-dns project support coredns integration with etcd (similar implementation of gravity).

https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/coredns.md

It's posible this provider works with gravity? Thanks in advance.

CygnusHyoga commented 8 months ago

I tested without luck. I tried to add to external-dns helm chart:

env:
  - name: TZ
    value: Europe/Madrid
  - name: ETCD_URLS
    value: http://192.168.66.254:2380/gravity/
provider: coredns

extraArgs:
  - --source=service
  # - --source=ingress
  - --domain-filter=example.com

Error:

"level":"warn","ts":"2024-02-21T20:37:12.10568+0100","logger":"etcd-client","caller":"v3@v3.5.9/retry_interceptor.go:62","msg":"retrying of unary invoker failed","target":"etcd-endpoints://0xc000365880/192.168.66.254:2380/gravity/","attempt":0,"error":"rpc error: code = DeadlineExceeded desc = latest balancer error: last connection error: connection error: desc = \"error reading server preface: EOF\""}
time="2024-02-21T20:37:12+01:00" level=fatal msg="context deadline exceeded"

The etcd is working via http or https? The schema of coredns is standard or custom? Thanks.

BeryJu commented 8 months ago

While gravity uses etcd and can use CoreDNS as a handler for a zone, the way gravity uses etcd is not inspired by coredns and as such probably not compatible

CygnusHyoga commented 8 months ago

Thanks BeryJu for the response.

It would be great to add support for external-dns at some point, I think it is a factor that many people would be interested in.

CygnusHyoga commented 8 months ago

Maybe adding support for:

May fix problem for integration with third party tools like: acme certificates with dns01 validation like acme.sh, lego, certbot, etc, and tools like external-dns and others.

One benefits it's a standard and don't have to develop custom integration with this or other tools.

BeryJu commented 5 months ago

The easiest way to implement it would most likely be https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/webhook-provider.md