Skip to content

feat(source): add unstructured source#6172

Merged
k8s-ci-robot merged 30 commits intokubernetes-sigs:masterfrom
gofogo:issue-3437-unstructured
Mar 11, 2026
Merged

feat(source): add unstructured source#6172
k8s-ci-robot merged 30 commits intokubernetes-sigs:masterfrom
gofogo:issue-3437-unstructured

Conversation

@ivankatliarchuk
Copy link
Copy Markdown
Member

@ivankatliarchuk ivankatliarchuk commented Feb 7, 2026

What does it do ?

A new unstructured source that creates DNS records from any Kubernetes custom resource using Go templates.

Supporting every possible ingress or product isn’t practical. For example, it’s fairly common to have custom products, and ExternalDNS doesn’t really fit that model today, as it doesn’t provide even basic support for custom sources.

Added flags

  • --unstructured-resource=
  • --target-template=
  • --fqd-target-template=

Motivation

We shouldn't have to wait for external-dns to add built-in support for some specific CRDs. With this source, they can point external-dns at any resource (KubeVirt VMs, Crossplane resources, MetalLB pools, etc.) and use templates to extract hostnames and targets from .spec or .status fields.

Fixes #3437
Fixes #5104
Fixes #5922

First attempt #3490. That was abandoned

More

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

I could slice this PR, move tests to another PR and 400+ lines in docs

┌──────────┬───────┐
│ Category │ Lines │
├──────────┼───────┤
│ Non-test │ +462  │
├──────────┼───────┤
│ Test     │ +1613 │
├──────────┼───────┤
│ Docs     │ +435  │
├──────────┼───────┤
│ Ratio    │ 1:3.4 │
└──────────┴───────┘

Follow-up

  • add provider specific support

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@k8s-ci-robot k8s-ci-robot requested a review from szuecs February 7, 2026 08:11
@k8s-ci-robot k8s-ci-robot added the apis Issues or PRs related to API change label Feb 7, 2026
@k8s-ci-robot k8s-ci-robot requested a review from vflaux February 7, 2026 08:11
@k8s-ci-robot k8s-ci-robot added docs internal Issues or PRs related to internal code source cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 7, 2026
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 7, 2026

Pull Request Test Coverage Report for Build 22279424154

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 97 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.05%) to 79.221%

Files with Coverage Reduction New Missed Lines %
apis/externaldns/types.go 1 99.62%
testutils/endpoint.go 16 71.29%
store.go 80 50.0%
Totals Coverage Status
Change from base Build 22254373828: -0.05%
Covered Lines: 16249
Relevant Lines: 20511

💛 - Coveralls

Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@ivankatliarchuk ivankatliarchuk force-pushed the issue-3437-unstructured branch 4 times, most recently from 0489f54 to 995236f Compare February 7, 2026 11:33
@ivankatliarchuk ivankatliarchuk marked this pull request as draft February 7, 2026 13:56
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 7, 2026
@ivankatliarchuk ivankatliarchuk force-pushed the issue-3437-unstructured branch 2 times, most recently from c45dd7f to 78f2b7b Compare February 7, 2026 14:29
@ivankatliarchuk ivankatliarchuk marked this pull request as ready for review February 7, 2026 14:30
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 7, 2026
@ivankatliarchuk ivankatliarchuk force-pushed the issue-3437-unstructured branch from 78f2b7b to 77e5091 Compare February 7, 2026 14:31
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
Signed-off-by: ivan katliarchuk <ivan.katliarchuk@gmail.com>
@vflaux
Copy link
Copy Markdown
Contributor

vflaux commented Feb 22, 2026

That's a nice new feature.
I don't know if other maintainers want to review it too as it's quite big? 🤔

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 22, 2026
@ivankatliarchuk
Copy link
Copy Markdown
Member Author

I'll leave it for a week. Sure

@ivankatliarchuk
Copy link
Copy Markdown
Member Author

Hi @TomyLobo are you still using external-dns? How about to try this feature?

This is related to your comment 2+ years ago #3490 (comment)

@ivankatliarchuk
Copy link
Copy Markdown
Member Author

@ivankatliarchuk
Copy link
Copy Markdown
Member Author

Hi @nazarewk how about to try this feature?

@nazarewk
Copy link
Copy Markdown

Hi @nazarewk how about to try this feature?

Unfortunately I am not working at the original place anymore and won't have access to any external-dns deployment at least for a few weeks.

I had an idea that you could maybe try to use it for the built-in resources, but through the new custom resource interface?

@ivankatliarchuk
Copy link
Copy Markdown
Member Author

Not a problem. Technically this new source should work with all current and future kubernetes resources.

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 26, 2026
@Preisschild
Copy link
Copy Markdown

Preisschild commented Feb 27, 2026

I've tested it with cluster-api machines.v1beta2.cluster.x-k8s.io .status.addresses. Works great. Cool feature

      --unstructured-resource=machines.v1beta2.cluster.x-k8s.io
      --label-filter=cluster.x-k8s.io/control-plane=
      --fqdn-template=< cluster domain >
      --fqdn-target-template={{ range $address := .Status.addresses }}{{ if eq $address.type "ExternalIP"}}{{ $address.address }},{{ end }}{{ end }}

Similar to this discussion: #5922

@ivankatliarchuk
Copy link
Copy Markdown
Member Author

Nice one. Thank you

@vflaux
Copy link
Copy Markdown
Contributor

vflaux commented Mar 11, 2026

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 11, 2026
@ivankatliarchuk
Copy link
Copy Markdown
Member Author

/approve

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ivankatliarchuk

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

The pull request process is described here

Details 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2026
@k8s-ci-robot k8s-ci-robot merged commit c35ed0b into kubernetes-sigs:master Mar 11, 2026
16 checks passed
@ivankatliarchuk ivankatliarchuk deleted the issue-3437-unstructured branch March 12, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apis Issues or PRs related to API change approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. docs internal Issues or PRs related to internal code lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DNSEndpoint targets value from configmap Support ApisixRoute

6 participants