plugin/clouddns: add refresh directive (#8616)

Brings clouddns to parity with route53, which already exposes a
refresh directive to control how often zones are re-synced. clouddns
currently hardcodes this to 1 minute (delay := 1 * time.Minute in Run)
with no way to change it.

Adds a refresh field to the CloudDNS struct, threads it through New(),
and has Run() use h.refresh instead of the hardcoded delay. Parses the
refresh directive in setup() mirroring route53's exact validation
(accepts a plain number as seconds or a duration string, must be
greater than 0).

Extends TestSetupCloudDNS 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:
Aradhya Jain
2026-10-09 07:17:32 +05:30
committed by GitHub
parent 45ac7fe659
commit 538c3554bc
5 changed files with 67 additions and 8 deletions

View File

@@ -55,6 +55,24 @@ func TestSetupCloudDNS(t *testing.T) {
}`, false},
{`clouddns example.org.:example-project:zone-name {
credentials
}`, true},
{`clouddns example.org.:example-project:zone-name {
refresh 3m
}`, false},
{`clouddns example.org.:example-project:zone-name {
refresh 30
}`, false},
{`clouddns example.org.:example-project:zone-name {
refresh
}`, true},
{`clouddns example.org.:example-project:zone-name {
refresh abc
}`, true},
{`clouddns example.org.:example-project:zone-name {
refresh 0
}`, true},
{`clouddns example.org.:example-project:zone-name {
refresh -5m
}`, true},
{`clouddns example.org.:example-project:zone-name example.org.:example-project:zone-name {
}`, true},