mirror of
https://github.com/coredns/coredns.git
synced 2026-10-17 15:55:47 -04:00
plugin/azure: add refresh directive (#8614)
Brings azure to parity with route53, which already exposes a refresh directive to control how often zones are re-synced. azure currently hardcodes this to 1 minute (Run calls h.run(ctx, time.Minute)) with no way to change it, even though the internal run() method already takes an arbitrary interval parameter - the plumbing exists, it just wasn't exposed as a Corefile option. Adds a refresh field to the Azure struct, threads it through New(), and has Run() use h.refresh instead of the hardcoded value. Parses the refresh directive in parse() mirroring route53's exact validation (accepts a plain number as seconds or a duration string, must be greater than 0). Extends TestSetup with refresh coverage (valid duration, valid plain number, missing arg, non-numeric, zero, negative). Verified it fails without the setup.go change (unknown property error) and passes with it. Signed-off-by: stackedbyaradhya <aradhyaj736@gmail.com>
This commit is contained in:
@@ -10,10 +10,10 @@ The azure plugin is useful for serving zones from Microsoft Azure DNS. The *azur
|
||||
all the DNS records supported by Azure, viz. A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, and TXT
|
||||
record types. NS record type is not supported by azure private DNS.
|
||||
|
||||
Zone data is loaded asynchronously after startup and refreshed every minute.
|
||||
An unavailable zone or zone-listing error is logged without preventing CoreDNS from
|
||||
starting or other configured zones from being updated. Each zone listing,
|
||||
including retries and pagination, has a one-minute timeout.
|
||||
Zone data is loaded asynchronously after startup and refreshed every minute by default,
|
||||
configurable via `refresh`. An unavailable zone or zone-listing error is logged without
|
||||
preventing CoreDNS from starting or other configured zones from being updated. Each zone
|
||||
listing, including retries and pagination, has a one-minute timeout.
|
||||
Configuration and credential initialization errors still prevent startup.
|
||||
|
||||
Until a zone has been successfully loaded, queries for it return SERVFAIL unless
|
||||
@@ -34,6 +34,7 @@ azure RESOURCE_GROUP:ZONE... {
|
||||
environment ENVIRONMENT
|
||||
fallthrough [ZONES...]
|
||||
access private
|
||||
refresh DURATION
|
||||
}
|
||||
~~~
|
||||
|
||||
@@ -52,6 +53,12 @@ azure RESOURCE_GROUP:ZONE... {
|
||||
|
||||
* `access` specifies if the zone is `public` or `private`. Default is `public`.
|
||||
|
||||
* `refresh` can be used to control how long between record retrievals from Azure DNS. It
|
||||
requires a duration string as a parameter to specify the duration between update cycles.
|
||||
Each update cycle may result in many Azure API calls depending on how many domains use this
|
||||
plugin and how many records are in each. Adjusting the update frequency may help reduce the
|
||||
potential of API throttling by Azure. If not provided the default refresh is 1 minute.
|
||||
|
||||
## Examples
|
||||
|
||||
Enable the *azure* plugin with Azure credentials for private zones `example.org`, `example.private`:
|
||||
|
||||
Reference in New Issue
Block a user