Repository navigation
Add custom CA certificate support for OTLP endpoints - #4676
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4676 +/- ##
==========================================
- Coverage 68.84% 68.83% -0.01%
==========================================
Files 509 507 -2
Lines 52668 52696 +28
==========================================
+ Hits 36259 36275 +16
- Misses 13606 13619 +13
+ Partials 2803 2802 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Large PR Detected
This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.
How to unblock this PR:
Add a section to your PR description with the following format:
## Large PR Justification
[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformationAlternative:
Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.
See our Contributing Guidelines for more details.
This review will be automatically dismissed once you add the justification section.
ChrisJBurns
left a comment
There was a problem hiding this comment.
Multi-Agent Consensus Review
Agents consulted: kubernetes-expert, security-advisor, code-reviewer, site-reliability-engineer
Consensus Summary
| # | Finding | Consensus | Severity | Action |
|---|---|---|---|---|
| 1 | Redundant API call + return nil on telemetry config fetch error |
8/10 | MEDIUM | Fix |
| 2 | Constant duplication between types.go and validation pkg | 8/10 | LOW | Fix |
| 3 | No runtime guard for Insecure + CACertPath at library level | 7/10 | LOW | Discuss |
Overall
This is a well-structured PR that cleanly follows the established OIDC CA bundle pattern across the CRD types, controller, volume helpers, and telemetry config threading. The TLS implementation is sound — appending to the system pool rather than replacing it, enforcing TLS 1.2 minimum, and handling missing system cert pools gracefully. Test coverage is thorough with 850+ lines of new tests.
The main concern is the error handling in deploymentForMCPServer (Finding 1). The new telemetry CA bundle block calls getTelemetryConfigForMCPServer() again (already called at line 1085) and returns nil on error — unlike the existing telemetry env var block (line 1085-1092) which logs a warning and proceeds, and the OIDC CA block (line 1202) which uses if err == nil. This introduces a behavioral regression where a transient API error that previously degraded gracefully now blocks deployment creation entirely. The constant duplication (Finding 2) is a minor DRY concern with a clear fix path.
Generated with Claude Code
…onfig When the OTLP collector uses TLS with certificates signed by an internal CA, there was no way to inject a custom CA bundle into the proxyrunner pod. Users had to resort to SSL_CERT_FILE which replaces the entire system CA pool. Add a caBundleRef field to MCPTelemetryOTelConfig that references a ConfigMap containing the CA bundle. The operator mounts it into the pod and threads the file path through the telemetry config layers so the OTLP HTTP exporters use WithTLSClientConfig() with the custom CA appended to the system pool. Closes #4672 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
89ada8e to
4fe97ba
Compare
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Large PR justification has been provided. Thank you!
|
✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review. |
Summary
When the OTLP collector uses TLS with certificates signed by an internal/private CA, there was no way to inject a custom CA bundle into the proxyrunner pod. The only workaround (
SSL_CERT_FILE) replaces the entire system CA pool, which is fragile and error-prone.caBundleReffield toMCPTelemetryOTelConfig(reuses existingCABundleSourcetype from OIDC)WithTLSClientConfig()on both trace and metric HTTP exporters, appending the custom CA to the system poolCloses #4672
Type of change
Test plan
task test)task lint-fix)Changes
cmd/thv-operator/api/v1alpha1/mcptelemetryconfig_types.goCABundleReffield toMCPTelemetryOTelConfig, addvalidateCABundle()cmd/thv-operator/pkg/validation/telemetry_validation.gocmd/thv-operator/pkg/controllerutil/telemetry_volumes.goAddTelemetryCABundleVolumes()andTelemetryCABundleFilePath()cmd/thv-operator/controllers/mcpserver_controller.godeploymentForMCPServer()cmd/thv-operator/controllers/mcpserver_runconfig.gocmd/thv-operator/pkg/runconfig/telemetry.gocaBundleFilePathon configpkg/telemetry/providers/otlp/tls.gonewTLSConfigFromCA()— loads CA, appends to system poolpkg/telemetry/providers/otlp/tracing.goWithTLSClientConfig()when CA path is setpkg/telemetry/providers/otlp/metrics.gopkg/telemetry/providers/otlp/config.goCACertPathfieldpkg/telemetry/config.goCACertPathfield, wire throughNewProvider()pkg/telemetry/providers/providers.goCACertPathto Config, addWithCACertPath()optionpkg/telemetry/providers/providers_strategy.goCACertPathto otlp.Config in both strategiesDoes this introduce a user-facing change?
Yes. Users can now configure a
caBundleRefin theirMCPTelemetryConfigto trust custom CAs for OTLP endpoints:Special notes for reviewers
MCPTelemetryConfig(the shared CRD path). The deprecated inlineOpenTelemetryConfigon MCPServer is intentionally not touched as it will be removed.SSL_CERT_FILEwhich replaces it), so both custom and public CAs are trusted.oidc_volumes.go,ValidateCABundleSource).Large PR Justification
Generated with Claude Code