SaltDns.Knot.Reconcile (Salt v1.0.0)

Brings one zone on the Knot primary in line with Postgres.

The zone row is read first, so the version in the result is never newer than the rrsets that follow (see SaltDns.Knot.ZoneWriter).

Postgres is the system of record: the zone's rrsets and settings are read, Knot's copy is read back (SaltDns.Knot.read_zone/1), and the difference is applied in one zone transaction (SaltDns.Knot.Desired.plan/5). A zone that is not on the primary yet is created first; a disabled or deleted zone is removed.

When the zone already existed and needed changes, that is drift (someone changed Knot behind Salt DNS's back, or a delivery was lost). Drift writes an audit row with source reconciler and action reconcile whose diff is the repair, and emits [:salt_dns, :knot, :drift]. Every run emits [:salt_dns, :knot, :reconcile].

Summary

Functions

Removes the Knot zone of name for a zone that is disabled or deleted, but only if no other zone holds the name as its active zone: then the Knot zone is theirs, and is left alone.

Reconciles the zone with this id.

Types

result()

@type result() ::
  {:ok,
   %{
     action: :removed | :gone | :synced | :skipped | :refused | :frozen,
     created: boolean(),
     changes: non_neg_integer()
   }}
  | {:error, term()}

Functions

remove_named(zone_id, name, opts \\ [])

@spec remove_named(integer(), String.t(), keyword()) :: :ok | {:error, term()}

Removes the Knot zone of name for a zone that is disabled or deleted, but only if no other zone holds the name as its active zone: then the Knot zone is theirs, and is left alone.

zone(zone_id)

@spec zone(integer()) :: result()

Reconciles the zone with this id.