feat(stack): surface NATS server-side TLS in self-managed stack - #1442
feat(stack): surface NATS server-side TLS in self-managed stack#1442sparve-nv wants to merge 1 commit into
Conversation
The nats release's chart values are only global.yaml.gotmpl + secrets/<env>-secrets.yaml, so a nats.config.nats.tls value in environments/<env>.yaml is silently dropped and NATS starts with no cert -- which the INFO-first worker client experiences as a silent hang. Split-plane deployments (workers reaching NATS over a public L4-passthrough LB) require server TLS, because the LB cannot terminate the INFO-first handshake. Surface config.nats.tls and config.merge.allow_non_tls as per-field dig passthroughs, folded into the single existing config: block (a second config: key under nats: would be silently collapsed): allow_non_tls nests under the existing merge next to server_tags, and tls is added under config.nats. Both are emitted only when set (with / kindIs "bool"), so existing installs render byte-identical and the chart's config.merge accounts/auth_callout are preserved. Document the knobs in base.yaml and add tests/nats-tls-wiring.sh. Closes NVIDIA#1342 Signed-off-by: sparve <sparve@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe self-managed stack now passes optional NATS server TLS and ChangesNATS TLS wiring
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The change is mergeable with explicit owner awareness: existing installations remain unchanged, but enabling the documented mixed TLS/plaintext mode on a public NATS listener allows unencrypted traffic and should be restricted to environments where that exposure is acceptable. Sequence Diagram(s)sequenceDiagram
participant EnvironmentValues
participant GlobalTemplate
participant Helmfile
participant NATSChart
EnvironmentValues->>GlobalTemplate: provide optional TLS and allow_non_tls values
GlobalTemplate->>Helmfile: render merged NATS configuration
Helmfile->>NATSChart: pass rendered chart values
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Summary
Surface NATS server-side TLS in the self-managed stack so it can be enabled from
environments/<env>.yaml(vianats.config.nats.tls+nats.config.merge.allow_non_tls), instead of only by misusing the secrets file or patchingglobal.yaml.gotmpl. Both knobs default off, so existing installs render byte-identical.Additional Details
The
natsrelease's chart values are only../global.yaml.gotmpl+../secrets/<env>-secrets.yaml— the environment file is not in the release'svalues:list, so it reaches the release only whereglobal.yaml.gotmplre-emits it viadig … .Values. Thenats:block wiredreloader.image,podDisruptionBudget, and a storageClass-gatedconfig:block, but had no passthrough forconfig.nats.tls/config.merge.allow_non_tls. Net effect: anats.config.nats.tlsvalue inenvironments/<env>.yamlwas silently dropped and NATS started with no cert — which the INFO-first worker client experiences as a silent hang, not an error.This matters for split-plane deployments (workers outside the control-plane cluster reaching NATS over a public, L4-passthrough load balancer): TLS must terminate at the NATS server, because an LB cannot — the INFO-first client deadlocks an LB-terminated handshake.
allow_non_tls: truekeeps in-cluster plaintext clients working on the same:4222.Fix — add the passthrough as per-field
diginto the single existingconfig:block (a secondconfig:key undernats:would be silently collapsed to the last one, dropping the block):deploy/stacks/self-managed/global.yaml.gotmpl— surfaceconfig.nats.tls(emitted onlywitha value) andconfig.merge.allow_non_tls(emitted only when an explicit bool), folded into the existingconfig:block next toserver_tagsand the storageClassjetstreamoverride.deploy/stacks/self-managed/environments/base.yaml— document the two knobs as commented examples (so they don't materialize).deploy/stacks/self-managed/tests/nats-tls-wiring.sh— new wiring test, registered in theMakefile.Operators then set it in
environments/<env>.yaml:For the Reviewer
tlsuseswithandallow_non_tlsuseskindIs "bool", so the stack never invents a default — an env file that sets neither renders byte-identical, and the chart's own default applies.digpattern already used in this file (reloader.image,podDisruptionBudget,startupProbe, and theapiKeys/sis/revalroute flags), rather than a whole-subtree merge — it keeps the override surface tight and stack-owned.config:block on purpose; a secondconfig:(ormerge:) key collapses silently, which is whyallow_non_tlsnests under the existingmergenext toserver_tags.merge.server_tags(+ optionalallow_non_tls); Helm deep-merges the chart'sconfig.merge.accounts/authorizationunderneath, unchanged.For QA
Automated test (
make test). Addeddeploy/stacks/self-managed/tests/nats-tls-wiring.sh, wired into the offlinemake testtarget next tonats-placement-tags.sh. Following the existing value-wiring pattern (pdb-value-wiring.sh), it renders thenatsrelease values withhelmfile write-valuesand asserts viayq:config.nats.tls, noconfig.merge.allow_non_tls, andserver_tagspreserved;config.nats.tls.{enabled,secretName}andconfig.merge.allow_non_tls: truethread through, andserver_tagssurvives alongsideallow_non_tls(guards the single-block collapse);false:config.merge.allow_non_tls: falseis honored (explicit bool, not just truthy).Manual verification.
natsrelease values on this branch vsorigin/mainwith a default env — a rawdiffis empty for both the no-storageClass andstorageClass=gp3cases, confirming no change when the knobs are unset.helm-nvcf-natschart (+ synadianatssubchart)nats.confConfigMap::4222listener carriestls { cert_file, key_file }andallow_non_tls: true, withserver_tagsand theauth_calloutaccounts preserved;tlsand noallow_non_tls;server_tagsandauth_calloutintact.nats-placement-tags.shandpdb-value-wiring.shstill pass.Issues
Fixes #1342
Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Tests