Commit 6c220ba
authored
fix: accept Opaque secrets for mTLS auth (#276)
## 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 #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.1 parent f66cc80 commit 6c220ba
3 files changed
Lines changed: 19 additions & 16 deletions
File tree
- api/v1alpha1
- internal/controller/clientpool
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | | - | |
253 | | - | |
| 252 | + | |
| 253 | + | |
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | 280 | | |
281 | | - | |
| 281 | + | |
282 | 282 | | |
283 | | - | |
| 283 | + | |
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
0 commit comments