Skip to content

Conversation

@bogdankrasko
Copy link

@bogdankrasko bogdankrasko commented Nov 14, 2025

What does it do ?

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

Motivation

#5391

More

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

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 14, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@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 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
Copy link
Contributor

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. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 14, 2025
@k8s-ci-robot
Copy link
Contributor

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 k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Nov 14, 2025
@bogdankrasko
Copy link
Author

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     

@mloiseleur mloiseleur changed the title feat(source): Add gateway api hostname source annotation feat(source): gateway api hostname source annotation Nov 15, 2025
@mloiseleur
Copy link
Collaborator

/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 Nov 15, 2025
@coveralls
Copy link

coveralls commented Nov 15, 2025

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%
Totals Coverage Status
Change from base Build 19361247212: -0.04%
Covered Lines: 15973
Relevant Lines: 20305

💛 - Coveralls

Comment on lines 436 to 440
if strings.ToLower(hostNameAnnotation) == gatewayHostnameSourceAnnotationOnlyValue {
return annotationHostnames, nil
}

return hostnames, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

You're not checking for gatewayHostnameSourceDefinedHostsOnlyValue, so any invalid value will return only the defined hostnames.
In this case, the ingress implementation returns an empty list.
It might be worth logging a warning too.

You also build hostnames from both sources and eventually discard them.
Wouldn’t it be better to only add hostnames when they’re actually needed?

Copy link
Author

Choose a reason for hiding this comment

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

Updated logic

endpoints: []*endpoint.Endpoint{
newTestEndpoint("test.org.internal", "A", "1.2.3.4"),
},
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a test case with an invalid annotation value?

Copy link
Author

Choose a reason for hiding this comment

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

Added a test case with an invalid annotation value

@bogdankrasko bogdankrasko requested a review from vflaux November 19, 2025 07:56
@ivankatliarchuk
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 2, 2025
@mloiseleur
Copy link
Collaborator

@vflaux Anything left on your side ?

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. docs lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants