Skip to content

feat(gateway): express mutual TLS in both directions - #313

Merged
edenreich merged 1 commit into
mainfrom
feat/issue-311-20261101-1306
Nov 1, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/issue-311-20261101-1306

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Summary

A Gateway CR can now express mutual TLS in both directions, so the mTLS example in inference-gateway/inference-gateway#818 no longer needs a hand-written Deployment.

Inbound - spec.server.tls.clientCARef (a SecretKeySelector, like the existing certificateRef/keyRef) is mounted at /app/tls/client-ca/<key> and sets SERVER_TLS_CLIENT_CA_PATH. cert-manager writes ca.crt into the same Secret as the server keypair, so in practice this is one more key off one Secret.

Outbound - new spec.client.tls with caRef, certificateRef and keyRef, mounted under /app/tls/client/{ca,cert,key}/<key> and emitted as CLIENT_TLS_CA_PATH / CLIENT_TLS_CERT_PATH / CLIENT_TLS_KEY_PATH. Each reference is independent, so a private provider CA works without a client certificate and vice versa. spec.client is its own block (not spec.providers.tls, which is a list) and leaves room for CLIENT_TLS_MIN_VERSION later.

Probes (point 3 of the issue) - when clientCARef is set the liveness and readiness probes switch to tcpSocket on the server port. The kubelet cannot present a client certificate, so an httpGet probe fails the handshake whatever the scheme. This builds on #312, which picked scheme: HTTPS for plain server TLS - that path is unchanged.

Changes

  • api/v1alpha1/gateway_types.go: TLSConfig.ClientCARef, new ClientSpec / ClientTLSConfig, GatewaySpec.Client.
  • internal/controller/gateway_controller.go: secretKeyVolumes factored out of tlsVolumes and reused for the client block, serverMTLSEnabled, the TCP probe fallback, and the four env vars.
  • Regenerated deepcopy, CRDs and manifests/.
  • Tests: client CA mount + env + TCP probe, spec.client.tls mounts + env, and no CLIENT_TLS_ leakage when unset. task test, task lint, task vet all pass.

Not in this PR

  • No example manifest. The mTLS example lives in the gateway repo (examples/kubernetes/mtls) and moving it over to a Gateway CR belongs there.
  • No validation webhook rejecting a half-filled spec.client.tls (cert without key). The gateway already errors on that at startup.

Downstream

New CRD fields reach inference-gateway/docs (Gateway CRD reference) and the gateway repo's mTLS example. Docs ticket filed, see below.

Closes #311

Generated with Claude Code

Adds spec.server.tls.clientCARef (inbound client certificate
verification) and spec.client.tls with caRef/certificateRef/keyRef
(outbound provider mTLS). Each reference is mounted read-only and the
matching SERVER_TLS_CLIENT_CA_PATH / CLIENT_TLS_{CA,CERT,KEY}_PATH is
emitted. Health probes drop to tcpSocket when a client CA is set, since
the kubelet has no client certificate for the handshake.

Closes #311

Co-authored-by: Eden Reich <[email protected]>
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner November 1, 2026 13:12
@edenreich
edenreich merged commit 3cd4b24 into main Nov 1, 2026
1 check passed
@edenreich
edenreich deleted the feat/issue-311-20261101-1306 branch November 1, 2026 13:27
inference-gateway-releaser Bot added a commit that referenced this pull request Nov 1, 2026
## [0.31.0](v0.30.0...v0.31.0) (2026-11-01)

### ✨ Features

* **gateway:** express mutual TLS in both directions ([#313](#313)) ([3cd4b24](3cd4b24)), closes [#311](#311)
* **gateway:** validate mutual TLS field combinations ([#315](#315)) ([d43a7ea](d43a7ea))

### 🐛 Bug Fixes

* **gateway:** probe over HTTPS when spec.server.tls is on ([#312](#312)) ([2e3400c](2e3400c))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.31.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Gateway CRD: mutual TLS - server client CA and outbound client certificates

1 participant