gardener / external-dns-management

Environment to manage external DNS entries for a kubernetes cluster
Apache License 2.0
81 stars 67 forks source link

Merge `dnsnames` from multiple `DNSAnnotation` objects #351

Closed jastBytes closed 8 months ago

jastBytes commented 8 months ago

What would you like to be added:

The current behavior is is that the dns.gardener.cloud/dnsnames annotation from multiple DNSAnnotation objects which reference t he same service are not merged. It wins always the newest DNSAnnotation object or the last reconciled one.

Why is this needed:

This can lead to unexpected behavior since only one DNSEntry is created for the last applied object even though multiple DNSAnnotation objects exist for the same service.

This has been discussed on Slack, see https://kubernetes.slack.com/archives/CB57N0BFG/p1706179077150459. The following example currently leads to having only one DNSEntry existing for the referenced service.

apiVersion: dns.gardener.cloud/v1alpha1
kind: DNSAnnotation
metadata:
  name: my-service-annotation-a
spec:
  resourceRef:
    apiVersion: v1
    kind: Service
    name: emissary-ingress
    namespace: emissary
  annotations:
    dns.gardener.cloud/dnsnames: atest.example.com
    dns.gardener.cloud/ttl: "500"
---
apiVersion: dns.gardener.cloud/v1alpha1
kind: DNSAnnotation
metadata:
  name: my-service-annotation-b
spec:
  resourceRef:
    apiVersion: v1
    kind: Service
    name: emissary-ingress
    namespace: emissary
  annotations:
    dns.gardener.cloud/dnsnames: btest.example.com
    dns.gardener.cloud/ttl: "500"
jastBytes commented 8 months ago

Thanks for the fast implementation! 🙏