switchboard icon indicating copy to clipboard operation
switchboard copied to clipboard

Override default ExternalDNS target

Open Elegant996 opened this issue 2 years ago β€’ 8 comments

For our environment, we are always using a CNAME on the base domain instead of the status.loadbalancer.IP from the traefik service. Would it be possible to add an override for all ExternalDNS targets similar to how we must pick an Issuer for cert-manager when deploying switchboard?

Elegant996 avatar Oct 19 '22 17:10 Elegant996

Could you provide a more tangible example and maybe a sample of the resource that is currently created and how you want it to look like? :smile:

borchero avatar Oct 20 '22 10:10 borchero

Sure, see the ingress below:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test
  annotations:
    external-dns.alpha.kubernetes.io/target: example.com
spec:
  rules:
  - host: test.example.com
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: test
            port:
              name: https
  tls:
  - hosts:
    - test.example.net
    secretName: test-example-tls

ExternalDNS would generate a CNAME entry for test.example.com that points to example.com.

In our use case, all ingresses would use example.com as the target and never the loadbalancer IP since it is an internal address. Ideally, we would be able to define a default target similar to the certificate template but for DNS:

certificateTemplate:
  spec:
    issuerRef:
      name: letsencrypt-prod
      kind: ClusterIssuer

Thanks!

Elegant996 avatar Oct 24 '22 00:10 Elegant996

Would this use case be covered if integrations.externalDNS.targetIPs (or a similarly named option) would allow setting hostnames?

borchero avatar Oct 28 '22 22:10 borchero

Yes! That would do perfectly. Perhaps it may be more prudent to just call it integrations.externalDNS.target similar to ExternalDNS and just have that list support IP or hostnames?

Elegant996 avatar Oct 29 '22 10:10 Elegant996

@Elegant996 do you want to take a stab at that? :smile: might take me some time to find time for this otherwise πŸ‘€

borchero avatar Oct 31 '22 09:10 borchero

@borchero Actually, this might not be an issue if https://github.com/kubernetes-sigs/external-dns/pull/3055 is accepted. I'll leave this here for now but the PR may affect half of this project.

Elegant996 avatar Nov 03 '22 04:11 Elegant996

Oh nice, that would be cool πŸ˜„ historically, external-dns was rather reluctant to include support for anything ither than the native ingress but let’s see how it turns out this time πŸ˜„

borchero avatar Nov 03 '22 08:11 borchero

Giving this a bump as being able to use our NLBs hostname for TargetIP would be an ideal solution for our environment.

beezel avatar Apr 21 '23 01:04 beezel