ori-edge / k8s_gateway

A CoreDNS plugin to resolve all types of external Kubernetes resources
Apache License 2.0
295 stars 63 forks source link

Added support for External-DNS Annotations for Services #170

Closed nerdynick closed 1 year ago

nerdynick commented 1 year ago

This adds support for the Annotation currently used by External-DNS, external-dns.alpha.kubernetes.io/hostname, for Service types. Since a lot of software out there has adopted external-dns as it's default supported means of external DNS resolution. This simplifies those integrations.

Of note the support for TTL annotations, external-dns.alpha.kubernetes.io/ttl, was not added as k8s_gateway doesn't have support for Controller resolved TTLs overriding the default.

networkop commented 1 year ago

sorry, I don't see a point in adopting an annotation from a different project. Why not use coredns.io/hostname ?

nerdynick commented 1 year ago

[External-DNS] (https://github.com/kubernetes-sigs/external-dns) has been embraced as the official route, and is a Kube SIG project, for exposing DNS entries outside of the cluster. It's the pre-configured route for many Cloud Providers for their external DNS integrations as well. As such, most applications are beginning to pre-ship with external-dns Annotations pre-defined. With all this acceptance of external-dns everywhere. Those annotations are also starting to be seen as the common annotation for external dns entries regardless of ExternalDNS adoption or not. Similar in part to the common App name, Prometheus, Etc annotations/labels that are used today. The annotation itself, while yes referencing the project name, it is actually a pretty broad naming that doesn't outright imply specifically only the external-dns project. So it's a pretty good common annotation for all External DNS servicing.

Given all that, this patch's goal was to make integrations more seamless/simple with CoreDNS. Rather than hoping some app, somewhere, decided to allow for support in changing or adding to those annotations. Yet alone bake in support for a such a specific usage pattern as CoreDNS+k8s_gateway.

Right now this plugin appears to be the only working route for External DNS exposure with CoreDNS. The documented external-dns route right now is external-dns+etcd+CoreDNS and making use of SkyDNS's nonsensical approach with etcd records. In the work I did to get to this point. I attempted that route and it appears to be just broken and doesn't work. I also found many people just leaving CoreDNS all together because of it and moving to something like PowerDNS. So my feeling is adding this support would also see further adoption of this plugin for people trying to address that same challenges I was running into. A simple integration, that didn't require a lot of extra services, and didn't require me breaking from the norm or changing deployment scripts between different ENVs (ie local dev K8 vs AWS EKS).

networkop commented 1 year ago

yep, this makes sense. thanks for the explanation

larssb commented 1 year ago

@nerdynick this is really awesome! Thank you for providing this!