external-dns icon indicating copy to clipboard operation
external-dns copied to clipboard

feat(source): gateway api hostname source annotation

Open bogdankrasko opened this issue 1 month ago • 12 comments

What does it do ?

Adds external-dns.alpha.kubernetes.io/gateway-hostname-source annotation to the GatewayAPI source.

Motivation

Fixes https://github.com/kubernetes-sigs/external-dns/issues/5391

More

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

bogdankrasko avatar Nov 14 '25 13:11 bogdankrasko

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: bogdankrasko / name: bkrasko (477f48058872bdf11002acb358d46bc26ccc375c, 73df5d0d0d30b8f65fef725387913ac3322e28d1, 7825cf1067d8ea27645f0de1bf28211c37e5a945, ebeb38466bbe9bd8ad491edbbd26742b57f74f00)
  • :white_check_mark: login: bogdankrasko / name: bogdankrasko (03795213f4a3f9b1036055bfb60eeb216fb933da)

[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 mloiseleur 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 avatar Nov 14 '25 13:11 k8s-ci-robot

Welcome @bogdankrasko!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Nov 14 '25 13:11 k8s-ci-robot

Hi @bogdankrasko. 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 avatar Nov 14 '25 13:11 k8s-ci-robot

Smoke tests

Setup

args:
--log-level=info \
--log-format=text \
--interval=1m \
--source=service \
--source=ingress \
--source=gateway-httproute \
--source=gateway-grpcroute \
--source=gateway-tlsroute \
--source=gateway-tcproute \
--source=gateway-udproute \
--policy=upsert-only \
--registry=txt \
--txt-owner-id=check-external-dns \
--provider=aws \
--zone-id-filter=/hostedzone/Z00103822***** \
--domain-filter=external-dns-check.engineering

manifest:

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: check-external-dns
  namespace: check
  annotations:
    external-dns.alpha.kubernetes.io/gateway-hostname-source: annotation-only
    external-dns.alpha.kubernetes.io/hostname:  >-
      api.us-west-2.external-dns-check.engineering
spec:
  hostnames:
    - api.external-dns-check.engineering
    - api.us-west-2.external-dns-check.engineering
  parentRefs:
    - group: gateway.networking.k8s.io
      kind: Gateway
      name: external-dns-check
      namespace: kube-system
  rules:
    - backendRefs:
        - group: ''
          kind: Service
          name: check-service
          port: 8080

Master

INFO[0000] Instantiating new Kubernetes client          
INFO[0000] Using kubeConfig                             
INFO[0000] Created Kubernetes client https://*****.gr7.us-west-2.eks.amazonaws.com 
INFO[0002] Using kubeConfig                             
INFO[0002] Created GatewayAPI client https://*****.gr7.us-west-2.eks.amazonaws.com 
INFO[0006] Applying provider record filter for domains: [external-dns-check.engineering. .external-dns-check.engineering.] 
INFO[0006] All records are already up to date           
INFO[0066] Applying provider record filter for domains: [external-dns-check.engineering. .external-dns-check.engineering.] 
INFO[0067] Desired change: CREATE aaaa-api.us-west-2.external-dns-check.engineering TXT  profile=default zoneID=/hostedzone/Z00103822***** zoneName=external-dns-check.engineering.
INFO[0067] Desired change: CREATE api.us-west-2.external-dns-check.engineering A  profile=default zoneID=/hostedzone/Z00103822***** zoneName=external-dns-check.engineering.
INFO[0067] Desired change: CREATE api.us-west-2.external-dns-check.engineering AAAA  profile=default zoneID=/hostedzone/Z00103822***** zoneName=external-dns-check.engineering.
INFO[0067] Desired change: CREATE cname-api.us-west-2.external-dns-check.engineering TXT  profile=default zoneID=/hostedzone/Z00103822***** zoneName=external-dns-check.engineering.
INFO[0067] 4 record(s) were successfully updated         profile=default zoneID=/hostedzone/Z00103822***** zoneName=external-dns-check.engineering.
INFO[0126] Applying provider record filter for domains: [external-dns-check.engineering. .external-dns-check.engineering.] 
INFO[0126] All records are already up to date     

bogdankrasko avatar Nov 14 '25 13:11 bogdankrasko

/ok-to-test

mloiseleur avatar Nov 15 '25 16:11 mloiseleur

Pull Request Test Coverage Report for Build 19441565668

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 101 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.04%) to 78.665%

Files with Coverage Reduction New Missed Lines %
gloo_proxy.go 47 74.18%
gateway.go 54 85.93%
<!-- Total: 101
Totals Coverage Status
Change from base Build 19361247212: -0.04%
Covered Lines: 15973
Relevant Lines: 20305

💛 - Coveralls

coveralls avatar Nov 15 '25 16:11 coveralls

/lgtm

ivankatliarchuk avatar Dec 02 '25 08:12 ivankatliarchuk

@vflaux Anything left on your side ?

mloiseleur avatar Dec 07 '25 13:12 mloiseleur

/hold likely we will not integrate HTTPRoute in the future , but ListenerSet as told by gateway-api. We should wait until they finalized the API and what external-dns should do to integrate.

szuecs avatar Dec 09 '25 15:12 szuecs

Even if we will follow GatewayAPI and move to ListenerSet, it does not mean we should not consider some use cases with current resources.

=> as discussed on slack with other maintainers /unhold

mloiseleur avatar Dec 09 '25 16:12 mloiseleur

As external-dns supports HTTPRoute, GRPCRoute, ... I would expect that the functionality related to hostname annotation is supported as well.

bogdankrasko avatar Dec 11 '25 07:12 bogdankrasko

@szuecs @mloiseleur @ivankatliarchuk Can we proceed on merging the following changes?

bogdankrasko avatar Dec 22 '25 08:12 bogdankrasko