Skip to content

cmd/k8s-operator: support custom TLS Secrets on Ingress#2

Draft
ryantm wants to merge 9 commits intomainfrom
zerg/operator-wildcard-cert
Draft

cmd/k8s-operator: support custom TLS Secrets on Ingress#2
ryantm wants to merge 9 commits intomainfrom
zerg/operator-wildcard-cert

Conversation

@ryantm
Copy link

@ryantm ryantm commented Mar 25, 2026

Why

We want the Kubernetes operator to serve custom HTTPS hostnames like zerg.zergrush.dev while preserving the existing MagicDNS/Tailscale hostname path and the Tailscale-* identity model for ingress backends. That lets zergrush move web traffic onto operator-managed custom TLS without keeping a long-lived custom gateway in zergrush itself.

What changed

  • cherry-pick upstream PR tailscale/tailscale#18636 so tailscale.com/accept-app-caps works on both standard and ProxyGroup-backed Ingress resources
  • add support for using Ingress.spec.tls[0].secretName as a custom TLS certificate source for operator-managed ingress, copying the custom cert into proxy state secrets so the proxy can terminate that hostname directly
  • preserve the existing MagicDNS hostname alongside the custom TLS hostname by adding both HTTPS hosts to the serve config, so zerg.tail0a469.ts.net keeps working while zerg.zergrush.dev is introduced
  • teach ipnlocal VIP service routing to match exact custom HTTPS hostnames before falling back to the service's MagicDNS FQDN
  • add TLS Secret watch/index plumbing plus unit tests for standard ingress, ProxyGroup ingress, and custom service-host routing

Test plan

  • ./tool/go fmt ./cmd/k8s-operator ./ipn/ipnlocal
  • ./tool/go test ./cmd/k8s-operator ./ipn/ipnlocal
  • ./tool/go test ./cmd/k8s-operator/...

Revertibility

Safe to revert. The changes are limited to operator/runtime ingress behavior and tests; reverting restores the previous Tailscale-managed certificate behavior for ingress resources.

~ written by Zerg 👾

matthalp and others added 3 commits March 25, 2026 12:06
Add support for the tailscale.com/accept-app-caps annotation on Ingress
resources. This populates the AcceptAppCaps field on HTTPHandler entries
in the serve config, which causes the serve proxy to forward matching
peer capabilities in the Tailscale-App-Capabilities header to backends.

The annotation accepts a comma-separated list of capability names
(e.g. "example.com/cap/monitoring,example.com/cap/admin"). Each
capability is validated against the standard app capability regex.
Invalid capabilities are skipped with a warning event, consistent
with the operator's soft-validation pattern.

Both the standard Ingress reconciler and the HA (ProxyGroup) Ingress
reconciler benefit from this change since they share the same
handlersForIngress() function.

Updates #tailscale/corp#28049

Signed-off-by: matthalp <mhalpern@column.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ryantm ryantm force-pushed the zerg/operator-wildcard-cert branch from e8dd7a2 to 0cdbe23 Compare March 25, 2026 22:06
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.

3 participants