Repository navigation
Enable TLS for operator-wide Redis defaults - #6838
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6838 +/- ##
=======================================
Coverage 80.13% 80.13%
=======================================
Files 845 845
Lines 85670 85715 +45
=======================================
+ Hits 68651 68691 +40
- Misses 17014 17019 +5
Partials 5 5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
reyortiz3
left a comment
There was a problem hiding this comment.
Thanks for this. I checked it against toolhive-core's redisconn and the existing pkg/redisconfig path. It reuses the existing flow (sessionRedisTLS → SessionRedisTLSConfig → redisconfig.TLSConfig → redisconn.BuildTLSConfig) and adds no TLS handling of its own, so I see no conflict with core. I also checked the other callers of the changed helpers, and none is affected by the new nil→default behavior.
Two suggestions, both on choices the description already calls deliberate:
-
sessionRedisTLS(nil)now reads the env and can panic. I understand the intent, and the startup validation makes it unreachable in the operator. A helper that was a pure function of its argument still gains a hidden env read, and eachpopulateScalingConfig*re-parses the env. Could the default be read and validated once at startup and passed in? -
The fallback policy is encoded twice.
SessionRedisTLSVolumesWithDefaultand thepopulateScalingConfig*functions each decide when the global default applies. If they drift, a pod gets a CA mount without Redis, or Redis TLS without the CA. Could a test pin the two together?
Minor: a missing CA Secret only appears as a pod FailedMount, and the global default affects every workload that falls back to it. A line in the docs about that symptom would help. A values.schema.json might also replace some of the Helm fail checks, if the chart uses one.
Separately, not for this PR: the shared TLSConfig from #6731 duplicates storage.RedisTLSRunConfig (same two fields, different JSON tag casing). I'd like a follow-up to either upstream the CA-file loading into redisconn or unify the two types.
|
Also, adding some of this to stacklok/toolhive-core#386 so we can re-use it later |
0d9a1e1 to
be386bf
Compare
|
Thanks @reyortiz3 — addressed both suggestions in be386bf.
I also rebased onto upstream main and resolved the generated chart README conflict while preserving upstream's current chart/image versions. Local verification passed: focused operator tests with race detection, operator lint with CI's pinned golangci-lint v2.15.0, license checks, and codespell. All 88 Helm tests passed on the rebased chart; the subsequent startup-injection changes do not modify the chart. The chart does not currently have a |
|
@Sanskarzz Is this a breaking change? vMCP Converter no longer falls back to the default Redis address from the environment unless |
Allow workloads using global Redis session defaults to request verified TLS with system roots or a namespace-local CA Secret. Reuse the session TLS wiring and CA projection paths while preserving explicit workload overrides and existing plaintext defaults. Signed-off-by: Sanskarzz <[email protected]>
Signed-off-by: Sanskarzz <[email protected]>
Read and validate global Redis settings once and inject the same snapshot into session configuration, password references, CA mounts, and drift checks. Keep TLS helpers independent of the environment and remove the panic path. Pin runtime configuration to the generated CA projection for all three workload kinds, including environment changes after startup. Document missing-CA mount failures and the operator restart requirement. Signed-off-by: Sanskarzz <[email protected]>
Exercise the reconciler-to-ConfigMap path with injected plaintext and TLS defaults so missing converter option forwarding cannot silently select in-memory storage. Preserve explicit Redis overrides in the same test. Document the changed default behavior for direct Go converter callers and their migration path, while distinguishing the preserved operator fallback. Signed-off-by: Sanskarzz <[email protected]>
be386bf to
993cdfc
Compare
Thanks, @ChrisJBurns, you’re right about direct Go callers. Removing the implicit environment fallback changes the converter’s default behavior. The operator’s fallback remains preserved because startup loads the defaults and the vMCP reconciler passes WithDefaultRedisConfig. This addresses @reyortiz3 request to avoid environment reads during conversion. I’ve documented the Go-level compatibility change and added regression coverage through the actual ConfigMap generation path. |
Covers operator.defaultRedis.tls (stacklok/toolhive#6838) and dcrConfig.registrationProbeInterval (stacklok/toolhive#6948) for v0.59.0. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* Update stacklok/toolhive to v0.59.0 Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Refresh reference assets for toolhive v0.59.0 * Document Redis TLS default and DCR re-check Covers operator.defaultRedis.tls (stacklok/toolhive#6838) and dcrConfig.registrationProbeInterval (stacklok/toolhive#6948) for v0.59.0. Co-Authored-By: Claude Opus 5.5 <[email protected]> * Clarify DCR registration re-check wording Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
The runtime and per-workload APIs support Redis TLS after #6731 and #6767, but workloads using the operator-wide
defaultRedisfallback still cannot enable it. This prevents that fallback from connecting to TLS-only Redis endpoints.Closes #6827
Type of change
Test plan
controllerutil,vmcpconfig,controllers,app), operator lint with golangci-lint v2.15.0, all 88 Helm tests, chart rendering, Helm lint, and Helm documentation generation passed. The ConfigMap cases exercise the real reconciler-to-converter path.controllerutil,vmcpconfig,controllers, andapp.task helm-unittestpassed 85 operator tests and 3 CRD-chart tests, andtask helm-docscompleted. The subsequent startup-injection revision does not change the chart.The paired regression test builds the actual runtime configuration and Deployment from the same workload specification, then checks that the runtime CA path resolves to the selected Secret mount. It covers all three workload types, global fallback, explicit overrides, disabled TLS, and existing memory-provider differences.
The ConfigMap test also exercises the real
ensureVmcpConfigConfigMappipeline with injected global plaintext and private-CA TLS defaults, plus an explicit plaintext Redis override. This pins the reconciler's forwarding of defaults to the converter.Original implementation verification — October 15, 2026
The original implementation passed focused operator race tests, operator lint with golangci-lint v2.14.0, all 88 Helm tests, chart-testing lint for both charts and their CI values, Helm documentation generation, the license check, and codespell v2.4.3 over tracked files. A manual check also verified that malformed TLS settings stop the actual operator binary before Kubernetes setup.
Live verification used an isolated Kind cluster, the locally built operator, published v0.54.0 workload runtimes, and TLS-only password-protected Redis with a projected private CA:
These live checks have not been repeated for the startup-injection revision.
The full repository unit suite,
task test-e2e, and all operator integration suites were not run.API Compatibility
v1beta1API.No CRD fields, schemas, or runtime TLS types change. Global TLS defaults to disabled; existing address/password precedence remains unchanged.
The Go converter's default behavior does change:
NewConverter(resolver, client)no longer reads global Redis settings from the environment during conversion. Direct Go callers relying on that fallback must load and validate defaults once at application startup withcontrollerutil.LoadDefaultRedisConfigFromEnv, handle its error, and passWithDefaultRedisConfig(defaults)to the constructor. The operator already forwards this snapshot throughVirtualMCPServerReconciler, so its Kubernetes Redis fallback remains wired without configuration migration.Changes
controllerutil/defaultredis.go,app/app.gocontrollerutil/session_redis_tls.goFailedMountdiagnostics, compatibility, and rotation behaviorDoes this introduce a user-facing change?
Yes. Previously, the global fallback could only connect to Redis without TLS. Workloads using it can now connect to TLS-only Redis endpoints with certificate verification:
Omit the CA reference to use system roots. Password and CA Secrets must exist in each workload's namespace; the operator projects references into workloads without copying Secrets between namespaces.
A missing CA Secret or key leaves affected pods in
ContainerCreatingwithFailedMountevents. Diagnose the missing reference withkubectl describe podin the workload namespace. Updating global defaults requires an operator restart; workloads apply the new snapshot as they reconcile.The environment bridge is
TOOLHIVE_DEFAULT_REDIS_TLS_ENABLED,TOOLHIVE_DEFAULT_REDIS_TLS_CA_SECRET_NAME, andTOOLHIVE_DEFAULT_REDIS_TLS_CA_SECRET_KEY. Global TLS always verifies certificates; it has noinsecureSkipVerifyoption.Implementation plan
Implementation plan
Special notes for reviewers
provider: memory. Existing password selection is unchanged. CA projection follows each runtime selection policy.subPath, and the runtime loads trust at startup.values.schema.json, so the existing Helm template validation remains in place.