Skip to content

Conversation

@alexbakker-quandago
Copy link

What does it do ?

This enables support for SRV and NAPTR in the TXT registry.

Motivation

We'd like to have external-dns clean up old SRV and NAPTR records.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

This enables support for SRV and NAPTR in the TXT registry.
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ivankatliarchuk for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the registry Issues or PRs related to a registry label Dec 12, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 12, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @alexbakker-quandago. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 12, 2025

func getSupportedTypes() []string {
return []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS, endpoint.RecordTypeMX}
return []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME, endpoint.RecordTypeNS, endpoint.RecordTypeMX, endpoint.RecordTypeSRV, endpoint.RecordTypeNAPTR}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to share more information why this constants added here. TXT registry does supports SRV records. So not too sure what is reason of updating the method.

Maybe worth to rename a method and add a description what is for. Hard to say

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this change, SRV and NAPTR records are not cleaned up when using sync mode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have NAPTR records in my environment, but quite few SRV records. Not come across this problem. Could you share manifests so I could try to reproduce the problem?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, no problem. Steps to reproduce:

  • Start external-dns with the following arguments:
    --log-level=debug
    --log-format=text
    --interval=1m
    --source=service
    --source=ingress
    --source=crd
    --policy=sync
    --registry=txt
    --txt-owner-id=some-owner
    --txt-prefix=extdns-%{record_type}-
    --domain-filter=your-zone.example.com
    --provider=aws
    --zone-id-filter=REDACTED
    --managed-record-types=A
    --managed-record-types=AAAA
    --managed-record-types=CNAME
    --managed-record-types=NAPTR
    --managed-record-types=SRV
    --aws-zone-match-parent
    --aws-assume-role=arn:aws:iam::REDACTED:role/REDACTED
    
  • Create a DNSEndpoint with an SRV record. For example:
    apiVersion: externaldns.k8s.io/v1alpha1
    kind: DNSEndpoint
    metadata:
      name: test-srv
      namespace: default
    spec:
      endpoints:
      - dnsName: _sip._udp.your-zone.example.com
        recordTTL: 180
        recordType: SRV
        targets:
        - 1 50 5060 sip1-n1.your-zone.example.com
        - 1 50 5060 sip1-n2.your-zone.example.com
  • Watch external-dns create the record
  • Delete the DNSEndpoint
  • Notice that the SRV and related TXT record are not deleted from Route53

@ivankatliarchuk
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 13, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 20176576968

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 78.688%

Totals Coverage Status
Change from base Build 20163464704: 0.0%
Covered Lines: 16013
Relevant Lines: 20350

💛 - Coveralls

@ivankatliarchuk
Copy link
Member

So I tested with following arguments

go run main.go \
    --provider=aws \
    --registry=txt \
    --source=service \
    --log-level=debug \
    --managed-record-types=A \
    --managed-record-types=AAAA \
    --managed-record-types=SRV \
    --txt-owner-id=default \
    --fqdn-template='{{ if eq .Spec.Type "NodePort" }}{{ range .Spec.Ports }}{{ .Name }}local.tld{{printf "," }}{{end}}{{ end }}'

And manifest

apiVersion: v1
kind: Service
metadata:
  name: test-nodeport
spec:
  type: NodePort
  selector:
    app: my-app
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30394

Records created
Screenshot 2025-12-14 at 17 27 32

When I changed manifest slightly to modify the SRV record

```yml
apiVersion: v1
kind: Service
metadata:
  name: test-nodeport
spec:
  type: NodePort
  selector:
    app: my-app
  ports:
  - port: 80
    targetPort: 80
    nodePort: 30398

Following error appear

DEBU[0000] Couldn't parse 0 50 30398 local.tld. as an IP address: ParseAddr("0 50 30394 local.tld."): unexpected character (at " 50 30394 local.tld.") comparisonTargets="0 50 30394 local.tld." targets="0 50 30398 local.tld."

Screenshot 2025-12-14 at 17 32 10

With the fix, the problem dissapear and SRV records modified
Screenshot 2025-12-14 at 17 33 47

@ivankatliarchuk
Copy link
Member

ivankatliarchuk commented Dec 14, 2025

Tested with CRD #6023 (comment). Works as well

created
Screenshot 2025-12-14 at 17 53 53
modified
Screenshot 2025-12-14 at 17 57 07

@ivankatliarchuk
Copy link
Member

Coul you update tutorial https://github.com/kubernetes-sigs/external-dns/blob/master/docs/tutorials/crd.md with SRV and NAPTR example please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. registry Issues or PRs related to a registry size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants