diff --git a/docs/flags.md b/docs/flags.md index 2a17954078..1b294dbea4 100644 --- a/docs/flags.md +++ b/docs/flags.md @@ -175,6 +175,7 @@ | `--[no-]once` | When enabled, exits the synchronization loop after the first iteration (default: disabled) | | `--[no-]dry-run` | When enabled, prints DNS record changes rather than actually performing them (default: disabled) | | `--[no-]events` | When enabled, in addition to running every interval, the reconciliation loop will get triggered when supported sources change (default: disabled) | +| `--min-ttl=0s` | Configure global TTL for records in duration format. This value is used when the TTL for a source is not set or set to 0. (optional; examples: 1m12s, 72s, 72) | | `--log-format=text` | The format in which log messages are printed (default: text, options: text, json) | | `--metrics-address=":7979"` | Specify where to serve the metrics and health check endpoint (default: :7979) | | `--log-level=info` | Set the level of logging. (default: info, options: panic, debug, info, warning, error, fatal) | diff --git a/pkg/apis/externaldns/types.go b/pkg/apis/externaldns/types.go index fc5d047ded..fccedde6d7 100644 --- a/pkg/apis/externaldns/types.go +++ b/pkg/apis/externaldns/types.go @@ -313,6 +313,7 @@ var defaultConfig = &Config{ ManagedDNSRecordTypes: []string{endpoint.RecordTypeA, endpoint.RecordTypeAAAA, endpoint.RecordTypeCNAME}, MetricsAddress: ":7979", MinEventSyncInterval: 5 * time.Second, + MinTTL: 0, Namespace: "", NAT64Networks: []string{}, NS1Endpoint: "", @@ -801,6 +802,7 @@ func bindFlags(b FlagBinder, cfg *Config) { b.BoolVar("once", "When enabled, exits the synchronization loop after the first iteration (default: disabled)", defaultConfig.Once, &cfg.Once) b.BoolVar("dry-run", "When enabled, prints DNS record changes rather than actually performing them (default: disabled)", defaultConfig.DryRun, &cfg.DryRun) b.BoolVar("events", "When enabled, in addition to running every interval, the reconciliation loop will get triggered when supported sources change (default: disabled)", defaultConfig.UpdateEvents, &cfg.UpdateEvents) + b.DurationVar("min-ttl", "Configure global TTL for records in duration format. This value is used when the TTL for a source is not set or set to 0. (optional; examples: 1m12s, 72s, 72)", defaultConfig.MinTTL, &cfg.MinTTL) // Miscellaneous flags b.EnumVar("log-format", "The format in which log messages are printed (default: text, options: text, json)", defaultConfig.LogFormat, &cfg.LogFormat, "text", "json") diff --git a/pkg/apis/externaldns/types_test.go b/pkg/apis/externaldns/types_test.go index 1879e94143..aa000366b0 100644 --- a/pkg/apis/externaldns/types_test.go +++ b/pkg/apis/externaldns/types_test.go @@ -224,6 +224,7 @@ var ( TXTCacheInterval: 12 * time.Hour, Interval: 10 * time.Minute, MinEventSyncInterval: 50 * time.Second, + MinTTL: 40 * time.Second, Once: true, DryRun: true, UpdateEvents: true, @@ -370,6 +371,7 @@ func TestParseFlags(t *testing.T) { "--dynamodb-table=custom-table", "--interval=10m", "--min-event-sync-interval=50s", + "--min-ttl=40s", "--once", "--dry-run", "--events", @@ -492,6 +494,7 @@ func TestParseFlags(t *testing.T) { "EXTERNAL_DNS_TXT_NEW_FORMAT_ONLY": "1", "EXTERNAL_DNS_INTERVAL": "10m", "EXTERNAL_DNS_MIN_EVENT_SYNC_INTERVAL": "50s", + "EXTERNAL_DNS_MIN_TTL": "40s", "EXTERNAL_DNS_ONCE": "1", "EXTERNAL_DNS_DRY_RUN": "1", "EXTERNAL_DNS_EVENTS": "1",