SaltDns. Knot. Desired
(Salt v1.0.0)
What Knot should hold for a zone, and the changes that get it there. Pure.
Postgres holds the zone's rrsets and settings. Knot's copy additionally has
data the system owns: the SOA, the apex NS records and, for a signed zone,
every DNSSEC record. This module builds the desired view (rrsets from
Postgres plus the configured apex NS) and the actual view (what Knot
returned, with the SOA and the DNSSEC types removed), and diffs them with
SaltDns.Zones.Diff. The SOA is compared separately: only its settings
count, never its serial, which belongs to Knot.
Status decides where a zone goes: active zones use their organisation's
template (member of its catalog, transferable to its secondaries; the edge
learns of them from SaltDns.Knot.EdgeCatalog), disabled zones are
removed. pending zones are not on the primary at all: Knot's zones are
keyed by name, several organisations may prepare the same name, and only the
single active holder of a name may touch its Knot zone.
Summary
Functions
Knot's records as rrsets, without the SOA and without DNSSEC types. The
rdata is passed through SaltDns.Zones.Rdata.canonical/2, the same
function that produced the form stored in Postgres, so a difference in how
Knot prints a record (hex case, name case, address text) is not drift.
The desired rrsets: the zone's own rrsets plus the apex NS the system adds.
Rrsets are in the shape SaltDns.Zones.Diff takes (struct or map with
name, type, ttl and records carrying rdata and disabled).
The SaltDns.Knot.ensure_zone/2 options for the zone.
The changes that make Knot's records match Postgres: record changes from
Diff, then an SOA replacement if the SOA settings differ. now is unix
seconds, used only to pick a new SOA serial above the old one.
An :add of the desired SOA if the actual SOA's settings differ, else [].
Where the zone belongs on the primary.
Types
@type zone() :: %{ :name => String.t(), :status => :pending | :active | :disabled, :default_ttl => pos_integer(), :soa_refresh => non_neg_integer(), :soa_retry => non_neg_integer(), :soa_expire => non_neg_integer(), :soa_minimum => non_neg_integer(), optional(atom()) => term() }
Functions
@spec actual_rrsets([SaltDns.Zones.Change.t()]) :: [map()]
Knot's records as rrsets, without the SOA and without DNSSEC types. The
rdata is passed through SaltDns.Zones.Rdata.canonical/2, the same
function that produced the form stored in Postgres, so a difference in how
Knot prints a record (hex case, name case, address text) is not drift.
The desired rrsets: the zone's own rrsets plus the apex NS the system adds.
Rrsets are in the shape SaltDns.Zones.Diff takes (struct or map with
name, type, ttl and records carrying rdata and disabled).
@spec ensure_opts(zone(), settings()) :: SaltDns.Knot.zone_opts()
The SaltDns.Knot.ensure_zone/2 options for the zone.
@spec plan(zone(), [map()], settings(), [SaltDns.Zones.Change.t()], integer()) :: [ SaltDns.Zones.Change.t() ]
The changes that make Knot's records match Postgres: record changes from
Diff, then an SOA replacement if the SOA settings differ. now is unix
seconds, used only to pick a new SOA serial above the old one.
@spec soa_change(zone(), settings(), [SaltDns.Zones.Change.t()], integer()) :: [ SaltDns.Zones.Change.t() ]
An :add of the desired SOA if the actual SOA's settings differ, else [].
Where the zone belongs on the primary.