Skip to content

Add BackendTLSPolicy support to Gateway API#43045

Merged
youngnick merged 5 commits intomainfrom
pr/youngnick/backendtlspolicy
Jan 23, 2026
Merged

Add BackendTLSPolicy support to Gateway API#43045
youngnick merged 5 commits intomainfrom
pr/youngnick/backendtlspolicy

Conversation

@youngnick
Copy link
Copy Markdown
Contributor

This commit adds BackendTLSPolicy reconciliation (only) to the Gateway API reconciler.

This commit adds:

  • watch BackendTLSPolicy resources
  • Calculate their correct status and update it.

In order to get the BackendTLSPolicy status calculations correct, it turns out we need to pre-process all the BackendTLSPolicy objects, and build maps keyed via their targetRefs (the Services that they target). This is because of the upstream conflict resolution requirements for Policy objects, where conflicts need to be resolved based on what Service (and port name) the Policy targets, and reported based on the Gateway that they are used in.

The calculation for this is added in
operator/pkg/gateway-api/helpers/backendtlspolicies.go, and has both tests and documentation.

The actual status updating is performed in
operator/pkg/gateway-api/gateway_reconcile.go, in the setBackendTLSPolicyStatuses method.

This commit also changes the Gateway reconciliation test framework slightly so that all Gateways are reconciled for each test before Routes and other objects are checked.

This allows multiparent status checks to work.

This also removes the filtering of Routes, so all Routes in the input for the reconciler test must be present in the output to be checked. This change forces us to ensure that things that should have no status updates don't get changed.

As part of making this change, I also found some tests (httproute-hostname-intersection, httproute-listener-hostname-matching, and httproute-listener-port-matching) that were not checking the correct Gateway status, that we all missed. I fixed those as well.

Gateway API support now includes BackendTLSPolicy features

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Dec 1, 2025
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch from 30d6de2 to 6fb1b22 Compare December 1, 2025 04:07
@sathieu
Copy link
Copy Markdown
Contributor

sathieu commented Dec 3, 2025

xref #20960 (should it be fixed by this PR?)

@youngnick
Copy link
Copy Markdown
Contributor Author

Part of it will be fixed, yes. But This one has proven way more difficult than I thought, still working on it.

@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch 4 times, most recently from 3a65e83 to dde950e Compare December 18, 2025 04:26
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch from 8f75822 to 1be6c8c Compare December 23, 2025 10:47
@joestringer joestringer added the dont-merge/wait-until-release Freeze window for current release is blocking non-bugfix PRs label Jan 8, 2026
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch 2 times, most recently from ca17f44 to 99247bb Compare January 9, 2026 06:50
@youngnick youngnick added the release-note/major This PR introduces major new functionality to Cilium. label Jan 9, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Jan 9, 2026
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch 4 times, most recently from e9880d9 to 64f1ee2 Compare January 9, 2026 09:30
@youngnick youngnick marked this pull request as ready for review January 9, 2026 09:31
@youngnick youngnick requested review from a team as code owners January 9, 2026 09:31
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch 2 times, most recently from f0c9b1e to 6d0005a Compare January 21, 2026 04:02
@youngnick youngnick requested a review from a team as a code owner January 21, 2026 04:05
@youngnick youngnick requested a review from qmonnet January 21, 2026 04:05
@youngnick
Copy link
Copy Markdown
Contributor Author

/test

@youngnick youngnick requested a review from mhofstetter January 21, 2026 04:40
Copy link
Copy Markdown
Member

@qmonnet qmonnet left a comment

Choose a reason for hiding this comment

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

Docs update looks OK

@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch 2 times, most recently from 0e40786 to f905e25 Compare January 22, 2026 04:14
@youngnick
Copy link
Copy Markdown
Contributor Author

/test

Copy link
Copy Markdown
Member

@mhofstetter mhofstetter left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! 🎉

This commit adds BackendTLSPolicy reconciliation (only)
to the Gateway API reconciler.

This commit adds:
* watch BackendTLSPolicy objects
* watch ConfigMap objects used in BackendTLSPolicy objects
* Calculate their correct status and update it.

In order to get the BackendTLSPolicy status calculations
correct, it turns out we need to pre-process all the
BackendTLSPolicy objects, and build maps keyed via their
targetRefs (the Services that they target). This is because
of the upstream conflict resolution requirements for Policy
objects, where conflicts need to be _resolved_ based on
what Service (and port name) the Policy targets, and
_reported_ based on the Gateway that they are used in.

The calculation for this is added in
`operator/pkg/gateway-api/helpers/backendtlspolicies.go`,
and has both tests and documentation.

The actual status updating is performed in
`operator/pkg/gateway-api/gateway_reconcile.go`, in the
`setBackendTLSPolicyStatuses` method.

This commit also changes the Gateway reconciliation test framework
slightly so that all Gateways are reconciled for each test
before Routes and other objects are checked.

This allows multiparent status checks to work.

This also removes the filtering of Routes, so all Routes in
the input for the reconciler test must be present in the output
to be checked. This change forces us to ensure that things that
should have _no_ status updates don't get changed.

As part of making this change, I also found some tests
(httproute-hostname-intersection, httproute-listener-hostname-matching,
and httproute-listener-port-matching) that were not checking the
correct Gateway status, that we all missed. I fixed those as
well.

Further commits will add support for the ingestion
and translation steps.

Signed-off-by: Nick Young <nick@isovalent.com>
This commit adds ingestion support for BackendTLSPolicy objects.

The Gateway API model now stores TLS config for relevant backends
when there is a valid BackendTLSPolicy present.

Signed-off-by: Nick Young <nick@isovalent.com>
This commit gives the secret-sync Cell the ability to
synchronize ConfigMaps into Secrets in the configured
secrets namespace.

This is then used by the Gateway API reconciler to synchronize relevant
ConfigMaps from BackendTLSPolicy objects into Secrets
in the configured Secrets namespace.

Includes a small refactor to move the names of indexes into
the `indexers` module (they probably should always have been there
anyway).

Signed-off-by: Nick Young <nick@isovalent.com>
This commit completes the implementation of translation for
BackendTLSPolicy support.

Cilium passes the conformance tests for BackendTLSPolicy
support, although we do not currently implement the additional
BackendTLSPolicySANValidation feature. That is left for
future work, as it is a much smaller change.

It needed a few additional changes along the way:
* one of the conformance tests found a bug with the ingestion
  implementation to do with handling, so in fixing that I also wired logging down
  into the Gateway ingestion (GAMMA already had it).
* In order for our conformance report to reflect BackendTLSPolicy support
  correctly, I needed to update the Gateway API version to v1.4.1
  (which was released to correct that specific error, along with some
  other minor fixes).

Signed-off-by: Nick Young <nick@isovalent.com>
Signed-off-by: Nick Young <nick@isovalent.com>
@youngnick youngnick force-pushed the pr/youngnick/backendtlspolicy branch from f905e25 to e56810c Compare January 23, 2026 00:14
@youngnick
Copy link
Copy Markdown
Contributor Author

/test

@youngnick youngnick enabled auto-merge January 23, 2026 00:30
@youngnick youngnick added this pull request to the merge queue Jan 23, 2026
Merged via the queue into main with commit 5eaf5b2 Jan 23, 2026
452 checks passed
@youngnick youngnick deleted the pr/youngnick/backendtlspolicy branch January 23, 2026 01:22
sayboras added a commit to cilium/proxy that referenced this pull request Feb 2, 2026
Relates: cilium/cilium#43045

Signed-off-by: Tam Mach <tam.mach@cilium.io>
sayboras added a commit to cilium/proxy that referenced this pull request Feb 2, 2026
Relates: cilium/cilium#43045

Signed-off-by: Tam Mach <tam.mach@cilium.io>
sayboras added a commit to cilium/proxy that referenced this pull request Feb 2, 2026
Relates: cilium/cilium#43045

Signed-off-by: Tam Mach <tam.mach@cilium.io>
@s-jairl
Copy link
Copy Markdown

s-jairl commented Feb 6, 2026

Thanks for your work on this, @youngnick !

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

Labels

release-note/major This PR introduces major new functionality to Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.