openshift / external-dns-operator

The ExternalDNS Operator provides simplified ExternalDNS controller management.
Apache License 2.0
26 stars 33 forks source link

Override defaultTXTRecordPrefix in ExternalDNS #164

Closed Aldjinn closed 2 years ago

Aldjinn commented 2 years ago

Hi, is it possible to override defaultTXTRecordPrefix in the yaml file?

My current yaml is looking this way:

apiVersion: externaldns.olm.openshift.io/v1alpha1
kind: ExternalDNS
metadata:
  name: my-internal-domain
  namespace: external-dns
spec:
  provider:
    type: AWS
    aws:
      credentials:
        name: aws-access-key
  source:
    openshiftRouteOptions:
      routerName: default
    type: OpenShiftRoute
  zones:
    - MY_ZONE_ID

After having a quick look into the sourcecode, I've found

defaultTXTRecordPrefix   = "external-dns-"

but no possibility to provide this value via the ExternalDNSProvider struct.

Any ideas?

Thx.

alebedev87 commented 2 years ago

Hello @Aldjinn,

No, it's not possible to provide TXT prefix via the API. The prefix is added to avoid the conflict of TXT and CNAME records. The whole existence of the TXT records and their prefix is more of a technical detail for how to find out which records belong to this instance of ExtDNS.

Any concrete use case why you would like the prefix to be different?

FlorianHoehner commented 2 years ago

Hello @alebedev87,

we have different OpenShift Clusters running and want to use the External DNS Operator on all of them using the same Hosted Zone in AWS. The problem we're facing is, that the operator from the frist cluster is deleting the records created by the second operator because we can't customize the defaultTXTRecordPrefix` = "external-dns-" configuration.

alebedev87 commented 2 years ago

@FlorianHoehner: Indeed, there can be the ownership conflict if there are 2 external-dns managed by this operator which use the same hosted zone. But only in case these 2 ExternalDNS CRs (no matter the cluster) have the same name. The name of the CR is used as the owner ID for the TXT records. So, if I understand the problem correctly, it would be enough to just prefix/suffix the CR names with the corresponding cluster IDs. This will result in TXT records with different owner IDs and the external-dns instance won't be touching the other cluster's TXT records anymore.

Aldjinn commented 2 years ago

We will give it a try. Thx. 👍🏻

Aldjinn commented 2 years ago

Using different names for ExternalDNS on all clusters works great. Thx @alebedev87 for the quick help.

🐱‍👓