Skip to content

One ensure primitive per rule kind in the natmap daemon #28

Description

@FAZuH

Parent

#24 — Spec: One typed seam through which all NAT state flows

What to build

The natmap daemon's apply-a-mapping logic is implemented once per rule kind. A shared ensure_docker_mapping primitive carries the allocate→install→persist→rollback step for port mappings, and an ensure_static_rule primitive does the same for static NAT rules (dnat/hairpin). The reload path, on_container_start, and the reconcile routines all call these primitives instead of re-implementing the step independently. The orchestrators stay — they differ in what set of rules they process — but the per-rule apply step exists once. Behavior is unchanged from the operator's perspective.

Acceptance criteria

  • ensure_docker_mapping and ensure_static_rule primitives exist and are the single place the allocate→install→rollback step is implemented for their rule kind
  • reload, on_container_start, and the reconcile routines all route through the primitives; duplicated per-rule apply logic is removed
  • The primitives are unit-tested with a fake iptables/ports adapter, covering the stale-deallocate, untracked-container, and container-IP-reverify scenarios from recent bug fixes
  • Full workspace builds and all existing unit tests pass

Blocked by

None — can start immediately.

Activity

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

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions