Repository navigation
Description
The per-link emission block in the v1.12 multi-doc network section — BondConfig / VLANConfig / BridgeConfig / LinkConfig branches, plus address stripping, plus gateway resolution — is duplicated byte-for-byte between charts/cozystack/templates/_helpers.tpl and charts/generic/templates/_helpers.tpl. Around 250 lines in each chart. PR #163 carried this convention forward when adding the BridgeConfig branch, the longest-prefix VIP selector, and the floatingIP validation.
Why it hurts
Every change to the multi-doc renderer has to be applied twice. Drift between the two charts is detectable only through the *_Generic_* mirror tests in pkg/engine/contract_network_multidoc_test.go, which #163 expanded to cover every contract — but the mirror suite is a heuristic, not a structural guarantee. Future maintainers will have to keep adding mirrors for every new contract, or the partial symmetry will silently let one chart's hunk regress.
Fix
Extract talm.config.multidoc.per_link into charts/talm/templates/_helpers.tpl and include it from both chart-specific talos.config.network.multidoc defines. The cozystack-specific RegistryMirrorConfig emission stays where it is — only the per-link iteration body moves.
Once factored:
- One source of truth for the per-link emission logic.
- The chart-specific multi-doc defines shrink to the chart-unique parts (cozystack: RegistryMirrorConfig + per-link include; generic: per-link include only).
- The
*_Generic_*mirror tests in fix(charts): pin Layer2VIPConfig to subnet-matching link, not default route #163 stay as defensive coverage but become structural rather than load-bearing.
Scope
The factor-out is mechanical — git diff charts/cozystack/templates/_helpers.tpl charts/generic/templates/_helpers.tpl already shows the two blocks are identical. The only judgment call is the name of the shared partial and where it lives (talm chart vs a new shared file). Suggest the talm chart since other shared discovery helpers already live there.
References
PR #163 — every reviewer iteration noted the duplication as non-blocking but worth a follow-up. Six *_Generic_* mirror tests in #163 exist precisely to catch drift this issue would eliminate by construction.
Activity
lexfrei commentedon May 14, 2026
Resolved by #208 (merged into main as 6e914ea).