Skip to content

feat: full TLS across all 5 transports#31

Merged
tgarciai merged 4 commits intomainfrom
feat/full-tls-all-transports
Mar 18, 2026
Merged

feat: full TLS across all 5 transports#31
tgarciai merged 4 commits intomainfrom
feat/full-tls-all-transports

Conversation

@tgarciai
Copy link
Member

Summary

  • New internal/tlsutil package: central TLS builder with disabled|server|mutual modes, TLS 1.3 minimum, kernel aliases (plaintext|tls|mtls), 15 unit tests with in-test cert generation
  • TLS on all 5 transports: HTTP server (ListenAndServeTLS), Valkey ×4 (redis.Options.TLSConfig), NATS (nats.Secure), S3/MinIO (custom http.Client with CA), OTLP (custom CA)
  • Helm chart: tls, natsTls, valkeyTls value blocks with existingSecret/mountPath/keys pattern (mirrors kernel), 15 fail-fast validation guards in _helpers.tpl, nil-safe accessors for --reuse-values upgrade compatibility
  • mTLS probe strategy: tcpSocket probes when tls.mode=mutual (kubelet cannot present client cert), httpGet with scheme: HTTPS for server mode
  • DuckDB/tool-learning CronJob: Valkey/NATS TLS volume mounts + SSL_CERT_FILE for DuckDB httpfs custom CA

Documented divergences from kernel

Aspect Decision
Valkey model Go runtime uses env vars (VALKEY_TLS_ENABLED + paths), not URI scheme (rediss://) — go-redis uses addr + TLSConfig, not URI parsing
NATS_TLS_FIRST Read and logged as warning — Go nats.go client has no TLS-first handshake support
S3/OTLP Server-auth TLS only (custom CA), not mTLS — v1 scope

Test plan

  • go build ./... — clean
  • go vet ./... — clean
  • go test ./... — 16 packages pass (including 15 new tlsutil tests + 5 new main_test TLS builder tests)
  • helm lint — clean
  • helm template with defaults (TLS disabled) — no TLS volumes/env vars
  • helm template --set tls.mode=server — HTTPS probes, TLS volume, correct env vars
  • helm template --set tls.mode=mutual — tcpSocket probes, TLS volume, CLIENT_CA_PATH
  • helm template --set tls.mode=server without existingSecret → fail-fast error
  • helm template --set natsTls.mode=mutual without secret → fail-fast error
  • helm upgrade --reuse-values from pre-TLS release — nil-safe, no breakage
  • Deployed to local cluster (rev 20, pod running)

🤖 Generated with Claude Code

tgarciai and others added 4 commits March 12, 2026 17:45
- README.md documenting architecture, Thompson Sampling, constraints,
  NATS event contract, Valkey key format, and deployment
- cmd/demo: self-contained demo binary using embedded DuckDB, miniredis,
  and NATS — zero infrastructure needed, run with `make demo`
- Makefile: add `demo` target

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add TLS/mTLS support to HTTP server, Valkey (×4), NATS, S3/MinIO,
and OTLP — with kernel-aligned modes (disabled|server|mutual) and
Helm fail-fast validation guards.

Go changes:
- New internal/tlsutil package: BuildServerTLSConfig, BuildClientTLSConfig,
  BuildClientTLSFromCA with TLS 1.3 minimum and kernel mode aliases
  (plaintext|tls|mtls)
- Valkey adapters: *tls.Config param on all 4 FromAddress constructors
- NATS publisher: nats.Secure(cfg) when TLS configured
- S3 artifacts: UseSSL + custom CA via http.Client TLS transport
- OTLP exporter: custom CA via WORKSPACE_OTEL_TLS_CA_PATH
- main.go: centralised buildServerTLS/buildValkeyTLS/buildNATSTLS,
  ListenAndServeTLS when server TLS enabled
- NATS_TLS_FIRST documented as Go client limitation (no-op with warning)
- Valkey env-var model documented as accepted divergence from kernel URI scheme

Helm changes:
- values.yaml: tls, natsTls, valkeyTls blocks + S3 useSSL/caPath + OTLP caPath
- _helpers.tpl: 15 fail-fast validation guards (mirrors kernel pattern),
  nil-safe accessors for --reuse-values upgrade compatibility
- deployment.yaml: conditional TLS volumes/mounts, tcpSocket probes for mTLS
  (kubelet cannot present client cert), scheme:HTTPS for server mode
- service.yaml: http/https port name conditional
- cronjob-tool-learning.yaml: Valkey/NATS TLS volumes + SSL_CERT_FILE for DuckDB

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- main_k8s_test.go: pass nil TLS config to buildSessionStore
- cmd/demo/main.go: check db.Close() return values (errcheck), fix gofmt

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
48.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@tgarciai tgarciai merged commit e9abb7e into main Mar 18, 2026
17 of 18 checks passed
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.

1 participant