Skip to content

Use DNSEndpoint for all records #4859

@lucasfcnunes

Description

@lucasfcnunes

What would you like to be added:

Use the kind DNSEndpoint for all generated DNS records.

  • When a service, ingress, etc needs to have their records created, it should always trigger the creation of a respective DNSEndpoint with a metadata.ownerReferences[0] self-reference in it.
  • The real resource referenced in metadata.ownerReferences[0] shouldn't be used for anything but to generate and refresh their respective DNSEndpoint content.
  • Only the DNSEndpoint should be used as the source of truth for the syncing of all records.

Example (merely illustrative):

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: airflow-ingress
  namespace: airflow
  annotations:
    external-dns.alpha.kubernetes.io/cloudflare-proxied: "false"
spec:
  ingressClassName: nginx
  rules:
    - host: airflow.example.com
      http:
        paths:
          - backend:
              service:
                name: airflow-webserver
                port:
                  name: airflow-ui
            path: /
            pathType: ImplementationSpecific
    - # ...
status:
  loadBalancer:
    ingress:
      - ip: 123.4.5.6
---
apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
  name: airflow-ingress
  namespace: airflow
  ownerReferences:
    - apiVersion: networking.k8s.io/v1
      blockOwnerDeletion: true
      controller: true
      kind: Ingress
      name: airflow-ingress
spec:
  endpoints:
    - dnsName: airflow.example.com
      recordType: A
      targets:
        - 123.4.5.6
      providerSpecific:
        - name: external-dns.alpha.kubernetes.io/cloudflare-proxied
          value: "false"
    - # ...
status:
  conditions:
    - lastTransitionTime: "2024-10-14T10:24:24Z"
      message: DNSEndpoint is up to date
      observedGeneration: 1
      reason: Ready
      status: "True"
      type: Ready
  notAfter: "2025-01-12T09:25:51Z"
  notBefore: "2024-10-14T09:25:52Z"
  renewalTime: "2024-12-13T09:25:51Z"
  revision: 1

Why is this needed:

  • Transparency on what external-dns is doing or trying to do with the domains
  • Keep track of all DNS records
  • Possibility of a detailed status for all records being synced
  • ownerReferences is used in multiple systems e.g. Argo CD to link related k8s resources
  • Possibility to kubectl get DNSEndpoint -A -o yaml and have the actual state of all managed records
  • Make external-dns flow more like what we see in cert-manager (DNSEnpoint <=> Certificate)

PS

There are architectural difficulties to be considered. Some are:

  • DNSEnpoint name collision.
    • solutions:
      • prefix/suffix it with the kind of the owner)
  • Same record (dnsName, recordType, target) in distinct DNSEnpoint resources.
    • solutions:
      • same as always has been when it happens
  • txtOwnerId
  • txtPrefix, txtSuffix
  • ?

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions