Skip to content

[1st PR of Certificate Selector] Support parsing Kubernetes secrets containing intermediate certificates - #3058

Open
Xulei-NL wants to merge 9 commits into
dotnet:mainfrom
Xulei-NL:tlsterminate/certificate-selector-with-intermediates
Open

Xulei-NL wants to merge 9 commits into
dotnet:mainfrom
Xulei-NL:tlsterminate/certificate-selector-with-intermediates

Conversation

@Xulei-NL

@Xulei-NL Xulei-NL commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Background

I tried to create a PR for my new Certificate Selector logic. However the code without test cases exceeds 600 lines, which was too large for code review.

Plan

This is the plan to split up the whole Certificate Selector logic into 6 small PRS.

Order PR feature Changes Focused tests
1 Parse TLS Secrets and certificate chains TlsSecretCertificateParser and its interface Update TlsSecretCertificateParserTests to assert the returned leaf and intermediates individually. Cover PEM and DER input, missing data, and certificate chains. Avoid checking the tuple itself for null: assert its elements.
2 Manage certificate storage and safe rotation TlsSecretCertificateStore and its interface Test acquire, replace, remove, lease release, and deferred disposal. Depends on PR 1's parsed leaf and chain.
3 Resolve Ingress TLS hosts to Secrets TlsIngressBindingIndex and its interface Test host and wildcard matching, collisions, replacement/removal, and synchronization.
4 Feed Ingress and Secret events into TLS state TLS-related IngressCache changes and required DI wiring Test cache updates, deletes, invalid Secrets, and controller-class filtering. Depends on PRs 2 and 3.
5 Select a certificate from SNI Selector changes and the Kestrel TLS handshake callback, initially with a single HTTPS listener Test matching certificates, default-certificate fallback, and missing certificates. Depends on PR 4 and the TLS store/index wiring.
6 Support multiple HTTPS listen ports HttpsListenPorts and multi-port Kestrel configuration Test that each configured port is bound and uses the selector. Keep this separate from the initial SNI implementation.

This PR

This PR is the first one to support parsing k8s certificate secrets without breaking any existing code.

Feedback appreciated

I'm appreciated to all feedbacks.

@Xulei-NL
Xulei-NL marked this pull request as ready for review October 6, 2026 19:07
@Xulei-NL
Xulei-NL requested a review from MihaZupan as a code owner October 6, 2026 19:07
@Xulei-NL

Xulei-NL commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

Have no idea why the test pipeline for macOS failed almost every time. 😟 Couldn't see the test details.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant