WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@lexfrei
Copy link
Contributor

@lexfrei lexfrei commented Dec 7, 2025

Summary

Implements Solution 2 from proposal #5919: annotation inheritance from Gateway to Route resources.

  • Gateway annotations serve as defaults for all attached Routes
  • Route annotations override Gateway defaults when the same key is specified
  • Supports all annotation types: target, ttl, hostname, controller, and provider-specific

This enables centralized configuration (e.g., default TTL, Cloudflare proxy settings) on Gateway while allowing per-Route customization when needed.

Use Case

Gateway:
  annotations:
    target: "172.16.6.6"  # intranet default
    ttl: "300"

Route1 (internal):
  # No annotations → inherits 172.16.6.6, TTL 300

Route2 (external):
  annotations:
    target: "1.2.3.4"     # override for external access
    ttl: "60"

Changes

  • source/gateway.go: Added mergeAnnotations() helper and resolveResult struct
  • source/gateway_test.go: Unit tests for mergeAnnotations() including mutation safety
  • source/gateway_httproute_test.go: 9 integration tests covering inheritance, override, A→CNAME, multi-gateway scenarios
  • docs/sources/gateway-api.md: Updated documentation with examples
  • docs/annotations/annotations.md: Updated Gateway API section

Test Plan

  • All existing Gateway tests pass
  • New unit tests for mergeAnnotations() (9 cases + mutation test)
  • New integration tests for annotation inheritance (9 cases)
  • Linter passes

Gateway annotations now serve as defaults for all attached Routes.
Route annotations override Gateway defaults when the same key is specified.

This enables centralized configuration on Gateway while maintaining
flexibility for per-Route customization. Supports all annotation types
including target, ttl, and provider-specific annotations.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@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 Dec 7, 2025
@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 szuecs 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 requested a review from szuecs December 7, 2025 15:23
@k8s-ci-robot k8s-ci-robot added source needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 7, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @lexfrei. 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 size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 7, 2025
@lexfrei lexfrei marked this pull request as ready for review December 7, 2025 15:26
@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 Dec 7, 2025
lexfrei added a commit to lexfrei/external-dns that referenced this pull request Dec 7, 2025
- Change status from draft to provisional
- Add reference to PR kubernetes-sigs#5998
- Update pseudocode: target annotation is now inheritable and overridable
- Update example to show intranet/public target override use case
- Add benefit: solves User Story 2 (per-Route target overrides)
- Update recommendation to include near-term merging of Solution 2

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@szuecs
Copy link
Contributor

szuecs commented Dec 9, 2025

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

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 9, 2025
@lexfrei lexfrei marked this pull request as draft December 9, 2025 15:36
@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 Dec 9, 2025
@lexfrei
Copy link
Contributor Author

lexfrei commented Dec 9, 2025

@szuecs re-marked this as a draft, just a reference for #5919. We can hold this as long as you need and merge/drop at any time

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. docs needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants