Skip to content

fix: accept Opaque secrets for mTLS auth#276

Merged
carlydf merged 3 commits into
temporalio:mainfrom
ConnorGraham:fix/opaque-tls-secret
Apr 23, 2026
Merged

fix: accept Opaque secrets for mTLS auth#276
carlydf merged 3 commits into
temporalio:mainfrom
ConnorGraham:fix/opaque-tls-secret

Conversation

@ConnorGraham
Copy link
Copy Markdown
Contributor

What was changed

Relax the secret type check in ParseClientSecret to accept both kubernetes.io/tls and Opaque secret types for AuthModeTLS. Update the MutualTLSSecretRef field comment in the CRD types to reflect the expanded accepted types.

Why?

Previously, the controller enforced type: kubernetes.io/tls for mTLS secrets. This blocked organizations that store TLS credentials in Opaque secrets — a common pattern when bundling tls.crt, tls.key, and ca.crt into a single secret (e.g. multi-file cert-manager outputs, or any tooling that produces a keypair alongside a custom CA).

The kubernetes.io/tls secret type natively supports only two keys (tls.crt and tls.key), so teams needing to include a CA cert alongside the keypair must use Opaque. The downstream handler fetchClientUsingMTLSSecret already accesses secret data by key name and works correctly with either type — only the type guard was blocking it.

Checklist

  1. Closes [Bug] ParseClientSecret rejects Opaque secrets for AuthModeTLS #275

  2. How was this tested:

Unit test TestParseClientSecret_OpaqueSecretType (renamed from TestParseClientSecret_WrongSecretType) now asserts that an Opaque secret containing tls.crt and tls.key is accepted and produces a valid ClientAuth with AuthModeTLS. All 316 existing tests continue to pass.

  1. Any docs updates needed?

MutualTLSSecretRef field comment in api/v1alpha1/temporalconnection_types.go updated to document both accepted secret types.

@ConnorGraham ConnorGraham requested review from a team and jlegrone as code owners April 14, 2026 19:01
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 14, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Collaborator

@carlydf carlydf left a comment

Choose a reason for hiding this comment

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

thanks!

@carlydf carlydf merged commit 6c220ba into temporalio:main Apr 23, 2026
16 checks passed
shashwatsuri pushed a commit to shashwatsuri/temporal-worker-controller that referenced this pull request Apr 28, 2026
## What was changed

Relax the secret type check in `ParseClientSecret` to accept both
`kubernetes.io/tls` and `Opaque` secret types for `AuthModeTLS`. Update
the `MutualTLSSecretRef` field comment in the CRD types to reflect the
expanded accepted types.

## Why?

Previously, the controller enforced `type: kubernetes.io/tls` for mTLS
secrets. This blocked organizations that store TLS credentials in
`Opaque` secrets — a common pattern when bundling `tls.crt`, `tls.key`,
and `ca.crt` into a single secret (e.g. multi-file cert-manager outputs,
or any tooling that produces a keypair alongside a custom CA).

The `kubernetes.io/tls` secret type natively supports only two keys
(`tls.crt` and `tls.key`), so teams needing to include a CA cert
alongside the keypair must use `Opaque`. The downstream handler
`fetchClientUsingMTLSSecret` already accesses secret data by key name
and works correctly with either type — only the type guard was blocking
it.

## Checklist

1. Closes temporalio#275

2. How was this tested:

Unit test `TestParseClientSecret_OpaqueSecretType` (renamed from
`TestParseClientSecret_WrongSecretType`) now asserts that an `Opaque`
secret containing `tls.crt` and `tls.key` is accepted and produces a
valid `ClientAuth` with `AuthModeTLS`. All 316 existing tests continue
to pass.

3. Any docs updates needed?

`MutualTLSSecretRef` field comment in
`api/v1alpha1/temporalconnection_types.go` updated to document both
accepted secret types.
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.

[Bug] ParseClientSecret rejects Opaque secrets for AuthModeTLS

3 participants