Skip to content

Commit a6243cf

Browse files
chore(providers): rename custom TTL constants to defaultTTL (#5312)
* chore(provider): inline providers Signed-off-by: ivan katliarchuk <[email protected]> * chore(provider): inline providers Signed-off-by: ivan katliarchuk <[email protected]> * chore(provider): inline providers Signed-off-by: ivan katliarchuk <[email protected]> * chore(provider): inline providers Signed-off-by: ivan katliarchuk <[email protected]> * chore(provider): inline providers Signed-off-by: ivan katliarchuk <[email protected]> --------- Signed-off-by: ivan katliarchuk <[email protected]>
1 parent 3c93bcb commit a6243cf

31 files changed

+427
-392
lines changed

docs/providers.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Providers
2+
3+
Provider supported configurations
4+
5+
| Provider Name | Zone Cache | Dry Run | Default TTL (seconds) |
6+
|:--------------|:-----------|:--------|:----------------------|
7+
| Akamai | n/a | yes | 600 |
8+
| AlibabaCloud | n/a | yes | 600 |
9+
| AWS | yes | yes | 300 |
10+
| AWSSD | n/a | yes | 300 |
11+
| Azure | yes | yes | 300 |
12+
| Civo | n/a | yes | n/a |
13+
| Cloudflare | n/a | yes | 1 |
14+
| CoreDNS | n/a | yes | n/a |
15+
| DigitalOcean | n/a | yes | 300 |
16+
| DNSSimple | n/a | yes | 3600 |
17+
| Exoscale | n/a | yes | n/a |
18+
| Gandi | n/a | no | 600 |
19+
| GoDaddy | n/a | yes | 600 |
20+
| Google GCP | n/a | yes | 300 |
21+
| IBMCloud | n/a | yes | 1 |
22+
| InMemory | n/a | n/a | n/a |
23+
| Linode | n/a | n/a | n/a |
24+
| NS1 | n/a | yes | 10 |
25+
| OCI | yes | yes | 300 |
26+
| OVH | n/a | yes | 0 |
27+
| PDNS | n/a | yes | 300 |
28+
| PiHole | n/a | yes | n/a |
29+
| Plural | n/a | n/a | n/a |
30+
| RFC2136 | n/a | yes | n/a |
31+
| Scaleway | n/a | n/a | 300 |
32+
| TencentCloud | n/a | n/a | n/a |
33+
| Transip | n/a | yes | 60 |
34+
| Ultradns | n/a | yes | n/a |
35+
| Webhook | n/a | n/a | n/a |

provider/akamai/akamai.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import (
3434

3535
const (
3636
// Default Record TTL
37-
edgeDNSRecordTTL = 600
38-
maxUint = ^uint(0)
39-
maxInt = int(maxUint >> 1)
37+
defaultTTL = 600
38+
maxUint = ^uint(0)
39+
maxInt = int(maxUint >> 1)
4040
)
4141

4242
// edgeDNSClient is a proxy interface of the Akamai edgegrid configdns-v2 package that can be stubbed for testing.
@@ -352,7 +352,7 @@ func trimTxtRdata(rdata []string, rtype string) []string {
352352
func ttlAsInt(src endpoint.TTL) int {
353353
var temp interface{} = int64(src)
354354
temp64 := temp.(int64)
355-
var ttl = edgeDNSRecordTTL
355+
var ttl = defaultTTL
356356
if temp64 > 0 && temp64 <= int64(maxInt) {
357357
ttl = int(temp64)
358358
}

provider/alibabacloud/alibaba_cloud.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
const (
41-
defaultAlibabaCloudRecordTTL = 600
41+
defaultTTL = 600
4242
defaultAlibabaCloudPrivateZoneRecordTTL = 60
4343
defaultAlibabaCloudPageSize = 50
4444
nullHostAlibabaCloud = "@"
@@ -606,12 +606,12 @@ func (p *AlibabaCloudProvider) deleteRecords(recordMap map[string][]alidns.Recor
606606

607607
func (p *AlibabaCloudProvider) equals(record alidns.Record, endpoint *endpoint.Endpoint) bool {
608608
ttl1 := record.TTL
609-
if ttl1 == defaultAlibabaCloudRecordTTL {
609+
if ttl1 == defaultTTL {
610610
ttl1 = 0
611611
}
612612

613613
ttl2 := int64(endpoint.RecordTTL)
614-
if ttl2 == defaultAlibabaCloudRecordTTL {
614+
if ttl2 == defaultTTL {
615615
ttl2 = 0
616616
}
617617

provider/alibabacloud/alibaba_cloud_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func TestAlibabaCloudProvider_ApplyChanges(t *testing.T) {
272272
defaultTtlPlan := &endpoint.Endpoint{
273273
DNSName: "ttl.container-service.top",
274274
RecordType: "A",
275-
RecordTTL: defaultAlibabaCloudRecordTTL,
275+
RecordTTL: defaultTTL,
276276
Targets: endpoint.NewTargets("4.3.2.1"),
277277
}
278278
changes := plan.Changes{

provider/aws/aws.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import (
3939

4040
const (
4141
defaultAWSProfile = "default"
42-
recordTTL = 300
42+
defaultTTL = 300
4343
// From the experiments, it seems that the default MaxItems applied is 100,
4444
// and that, on the server side, there is a hard limit of 300 elements per page.
4545
// After a discussion with AWS representatives, clients should accept
@@ -510,7 +510,7 @@ func (p *AWSProvider) records(ctx context.Context, zones map[string]*profiledZon
510510
if r.AliasTarget != nil {
511511
// Alias records don't have TTLs so provide the default to match the TXT generation
512512
if ttl == 0 {
513-
ttl = recordTTL
513+
ttl = defaultTTL
514514
}
515515
ep := endpoint.
516516
NewEndpointWithTTL(name, string(r.Type), ttl, *r.AliasTarget.DNSName).
@@ -804,8 +804,8 @@ func (p *AWSProvider) AdjustEndpoints(endpoints []*endpoint.Endpoint) ([]*endpoi
804804

805805
if alias {
806806
if ep.RecordTTL.IsConfigured() {
807-
log.Debugf("Modifying endpoint: %v, setting ttl=%v", ep, recordTTL)
808-
ep.RecordTTL = recordTTL
807+
log.Debugf("Modifying endpoint: %v, setting ttl=%v", ep, defaultTTL)
808+
ep.RecordTTL = defaultTTL
809809
}
810810
if prop, ok := ep.GetProviderSpecificProperty(providerSpecificEvaluateTargetHealth); ok {
811811
if prop != "true" && prop != "false" {
@@ -866,7 +866,7 @@ func (p *AWSProvider) newChange(action route53types.ChangeAction, ep *endpoint.E
866866
change.sizeValues += 1
867867
} else {
868868
if !ep.RecordTTL.IsConfigured() {
869-
change.ResourceRecordSet.TTL = aws.Int64(recordTTL)
869+
change.ResourceRecordSet.TTL = aws.Int64(defaultTTL)
870870
} else {
871871
change.ResourceRecordSet.TTL = aws.Int64(int64(ep.RecordTTL))
872872
}

0 commit comments

Comments
 (0)