Skip to content

chart: factor v1.12 multi-doc per-link branch into a named template #165

Closed

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:

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

  1. added
    kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debt
    priority/backlogGeneral backlog priority. Lower than priority/important-longterm
    area/chartIssues or PRs related to charts/ (Chart.yaml, helpers, templates)
    on May 11, 2026
  2. lexfrei commented on May 14, 2026

    @lexfrei
    ContributorAuthor

    Resolved by #208 (merged into main as 6e914ea).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/chartIssues or PRs related to charts/ (Chart.yaml, helpers, templates)kind/cleanupCategorizes issue or PR as related to cleanup of code, process, or technical debtpriority/backlogGeneral backlog priority. Lower than priority/important-longterm

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions