Skip to content

feat(connection): add tlsServerName for TLS SNI override#378

Open
jclinford wants to merge 2 commits into
temporalio:mainfrom
jclinford:add-connection-tls-server-name
Open

feat(connection): add tlsServerName for TLS SNI override#378
jclinford wants to merge 2 commits into
temporalio:mainfrom
jclinford:add-connection-tls-server-name

Conversation

@jclinford

@jclinford jclinford commented Jun 16, 2026

Copy link
Copy Markdown

What

Adds an optional tlsServerName field to ConnectionSpec (and the Connection CRD) that overrides the server name used for TLS certificate verification.

When set, the controller:

  • sets tls.Config.ServerName on its own Temporal client connections across all auth paths (mTLS, API key, and no-credential), and
  • injects TEMPORAL_TLS_SERVER_NAME into worker pods so SDK envconfig-based workers verify against the same name.

The field participates in the connection-spec hash and the client-pool cache key, so clients are re-established when it changes.

Why

When a Connection's hostPort resolves to an address whose name differs from the hostname on the server's TLS certificate, verification fails. The concrete case: reaching Temporal Cloud through an internal AWS NLB (TCP passthrough) — the NLB's DNS name differs from the certificate SANs (*.aws.api.temporal.io). tlsServerName lets the controller (and workers) verify against the correct name while still dialing the load balancer address.

Testing

  • make manifests generate (CRD + deepcopy regenerated)
  • go build ./..., go vet ./...
  • Added unit tests:
    • clientpool: ServerName override on the mTLS, API-key, and no-credential dial paths
    • deployments: TEMPORAL_TLS_SERVER_NAME env injection + connection-spec hash sensitivity
  • go test ./... passes

@jclinford jclinford requested review from a team and jlegrone as code owners June 16, 2026 20:26
@CLAassistant

CLAassistant commented Jun 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jaypipes

Copy link
Copy Markdown
Contributor

@jclinford hey, thank you very much for this contribution! please do see the comment above about signing the contributor license agreement.

Comment thread api/v1alpha1/connection_types.go Outdated
Add an optional `tlsServerName` field to ConnectionSpec that overrides the
server name used for TLS certificate verification. When set, the controller
sets tls.Config.ServerName on its own Temporal client connections (mTLS,
API-key, and no-credential paths) and injects TEMPORAL_TLS_SERVER_NAME into
worker pods so SDK envconfig-based workers verify against the same name.

This is needed when the Connection's hostPort points at an address that
differs from the hostname on the server certificate -- for example, when
reaching Temporal Cloud through an internal load balancer (TCP passthrough)
whose DNS name differs from the certificate SANs.

The field participates in the connection-spec hash and the client-pool cache
key so connections are re-established when it changes.
@jclinford jclinford force-pushed the add-connection-tls-server-name branch from f79747c to fffdbf1 Compare June 22, 2026 22:12

@jaypipes jaypipes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @jclinford, lgtm!

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