Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion charts/lerian-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ via `include` by the product charts that declare it as a dependency.
`lerian-common.multiTenant.env` — env-wide constants come from `global.*`
(set once per environment); the per-app enable knob stays in the component's
`extraEnvVars`/`configmap`; a component value overrides the global default; and
each helper stays **inert until `global.*` is set** (backward-compatible).
each helper stays **inert until `global.*` is set** (backward-compatible);
`serviceDiscovery.env` additionally activates from a legacy `configmap.SD_ADDRESS`,
and a component `configmap.SD_*` value takes precedence over the `global.*` default.
- **Env contracts (flat-passthrough):** `lerian-common.serviceDiscovery.envFlat`,
`lerian-common.otel.envFlat`, `lerian-common.multiTenant.envFlat` — reproduce a
chart's EXISTING native env block **byte-for-byte** (same keys, defaults, quoting
Expand Down
17 changes: 11 additions & 6 deletions charts/lerian-common/templates/_service_discovery.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,20 @@ global.serviceDiscovery (all optional except address when enabled):
no-configmap caller renders byte-identical to before. */ -}}
{{- $c := .configmap | default dict -}}
{{- /*
Derive ONLY when enabled AND global.serviceDiscovery.address is configured.
Derive ONLY when enabled AND an SD address is configured — via EITHER the
environment-wide `global.serviceDiscovery.address` OR the legacy flat
`configmap.SD_ADDRESS` (on-prem/client values that predate global). Gating on
both preserves the documented backward-compat contract: a chart deployed with
`configmap.SD_ENABLED=true` + `configmap.SD_ADDRESS` (no global) still derives
the full sibling block, matching pre-refactor output.
This keeps adoption backward-compatible: a chart carrying this helper but
deployed against a not-yet-migrated environment (SD_* still hand-set in
extraEnvVars, no global.serviceDiscovery) stays INERT — extraEnvVars drives
SD exactly as before, no duplicate keys, no render break. The environment
opts into derivation by setting global.serviceDiscovery + stripping the
per-app SD_* block down to just SD_ENABLED.
extraEnvVars, no global.serviceDiscovery, no configmap.SD_ADDRESS) stays
INERT — extraEnvVars drives SD exactly as before, no duplicate keys, no render
break. The environment opts into derivation by setting global.serviceDiscovery
(or configmap.SD_ADDRESS) + stripping the per-app SD_* block down to SD_ENABLED.
*/ -}}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
{{- if and .enabled $sd.address -}}
{{- if and .enabled (or $sd.address (index $c "SD_ADDRESS")) -}}
{{- /* SD_ENABLED is NOT emitted here: it is the app's single knob and is
rendered by the component's own extraEnvVars passthrough. Emitting it again
would produce a duplicate key. This helper only adds the derived siblings. */ -}}
Expand Down
6 changes: 4 additions & 2 deletions charts/lerian-common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
# (`SD_ENABLED` / `STREAMING_ENABLED`) or `configmap` (`MULTI_TENANT_ENABLED`),
# and a component's own value overrides the global default. Every helper is
# backward-compatible: with the `global.*` block absent it stays inert and the
# component's existing values drive the output unchanged.
# component's existing values drive the output unchanged. Exception:
# `serviceDiscovery.env` also activates from a legacy `configmap.SD_ADDRESS`
# (a component `configmap.SD_*` value takes precedence over the `global.*` default).

global: {}
# -- Service Discovery (lib-service-discovery). Set once per environment.
# serviceDiscovery:
# address: "" # REQUIRED when SD_ENABLED=true (e.g. consul.<env>:443). No default.
# address: "" # SD_ADDRESS when SD_ENABLED=true (e.g. consul.<env>:443), unless supplied via legacy configmap.SD_ADDRESS (which wins). No default.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
# tls: false # SD_TLS
# tlsSkipVerify: false # SD_TLS_SKIP_VERIFY
# workload: "" # SD_WORKLOAD — per-env isolation key (provider+consumer must match)
Expand Down
Loading