GitOps tooling for OctoDNS: processors, CLI wrappers, and workflow automation.
pip install "octodns-gitops @ git+https://github.com/ginsys/octodns-gitops@main"Or pin to a specific commit:
pip install "octodns-gitops @ git+https://github.com/ginsys/octodns-gitops@COMMIT_HASH"Use in your config.yaml:
processors:
acme-filter:
class: octodns_gitops.processors.AcmeFilter
external-dns-filter:
class: octodns_gitops.processors.ExternalDnsFilter
txt_prefix: 'extdns'
owner_id: 'my-cluster'- AcmeFilter: Ignores
_acme-challengerecords (managed by certificate authorities) - ExternalDnsFilter: Ignores records managed by external-dns
Use in your logging.yaml:
filters:
suppress_soa:
(): octodns_gitops.logging.SuppressSoaWarningsFilteroctodns-gitops-validate- Validate zone file syntaxoctodns-gitops-sync- Sync zones with improved output and safety thresholdsoctodns-gitops-drift- Check for drift between live DNS and local zonesoctodns-gitops-report- Query nameservers and show consistency reportoctodns-gitops-init- Generate Makefile for dns-zones repositoriesoctodns-gitops-forwardemail- Reconcile Forward Email domain settings and aliases with per-domain files (see below)
A dns-zones repo can also own the account side of its mail domains at Forward Email:
domain settings and aliases, kept in mail/forward-email/<domain>.yaml and reconciled through the REST API.
Opt in with a top-level forward_email: block in config.yaml (ignored by octoDNS, like delegation:):
forward_email:
token: env/FORWARD_EMAIL_API_TOKEN # env/ reference only, never a literal
directory: ./mail/forward-email # default
defaults: # optional repo-level overrides of the package defaults
settings: {} # API-writable domain fields
expect: {} # read-only fields, drift-checked only
alias: {} # alias field defaults
domains: # the ownership boundary: nothing outside it is ever touched
- example.comOne file per claimed domain; everything equal to the resolved defaults is omitted:
domain: example.com
settings:
ignore_mx_check: true # only fields the API can write
expect:
has_newsletter: true # FE-staff-set fields we want reported on mismatch
aliases:
- name: hello
recipients: [you@example.org]
- name: '/^([\w\-\.]+)$/' # regex names must be single-quoted
recipients: ['$1@example.org']
is_enabled: falseContract:
make mail-planis a dry run;make mail-applywrites.DOMAIN=example.comscopes either.- Domains are never created or deleted from git; a claimed domain missing from the account is an error.
PRUNE=1(the literal1;0/falsedo not prune) deletes aliases absent from git, inside claimed domains only, after a second listing agrees with the first. An alias withhas_imap: trueor stored mail is a mailbox: it is never pruned and blocks the run until it is added to git withhas_imap: trueor removed in the web UI. The same guard covers updates: a declared alias that merely omitshas_imapnever turns IMAP off on a live mailbox — writehas_imap: trueto keep it, orhas_imap: falseto turn it off deliberately.make mail-exportwrites the files from live state (bootstrap, or re-baseline after a deliberate web-UI change). A freshly exported file must plan as zero changes. Write-only settings already declared in the file being overwritten are preserved, since the API cannot return them.make mail-driftcompares FE's generated DNS records (DKIM key,fe-bouncesCNAME, verification TXT, the DMARCruaaddress) with the repo's zone file, and reports read-only expectation mismatches. Unlessignore_mx_check: true, the apex MX must be exactly FE's two exchangers at one shared preference — any other exchanger is a finding. The zone file is read from every YamlProvider the zone'ssources:names (merged, as octoDNS does); with several YamlProviders and no such entry the domain is reported as ambiguous rather than unchecked. Exit 1 on any finding. A claimed domain with no zone file in this repo is a supported layout, butmail-driftthen proves nothing about its DNS records: it prints "not checked" and exits 0.aliases:is always an explicit list (aliases: []for a domain with none) and every alias declaresrecipients:; an absent key is an error, never "empty" — withPRUNE=1that would have meant "delete everything".recipients: []is only valid for a mailbox (has_imapresolving to true): an alias that would deliver nowhere is an error. A duplicated YAML key is an error, never last-wins.vacation_respondertakes exactlyis_enabled(bool, required),subjectandmessage.max_quota_per_aliasandbounce_webhookcannot be read back from the API: they are sent with every domain update but never produce a diff on their own.- Forward Email re-validates an alias's stored regex pattern on every write to that alias, and
no longer accepts Perl-style look-around (
(?!,(?=,(?<). A grandfathered look-around alias exports and plans normally but 400s on any update — even one that changes nothing else, and even when the update body omits the name. The plan prints a WARNING when it is about to touch such an alias; changing anything on it means recreating it with a supported pattern (or pinning its current live values in git so no update is planned). One failing alias write does not skip the domain's remaining writes; the run still exits 1.
- Copy the template to your dns-zones repo:
curl -O https://raw.githubusercontent.com/ginsys/octodns-gitops/main/templates/mise.toml- Configure your secrets in
mise.local.toml:
[hooks.enter]
shell = "bash"
script = "source $HOME/etc/keys/tokens.bash"- Run setup:
mise trust
mise run setup- Use the generated Makefile:
make plan # Preview changes
make apply # Apply changes
make drift-check # Check for drift
make report # Query nameserversThe CLI tools read environment variables:
QUIET=1- Quiet mode (default)DEBUG=1- Debug outputZONE=example.com.- Process single zone
GPL-3.0-or-later