diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c8517c51d..c8c951aa3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Fix NodePort with externaltrafficpolicy targets duplication @codearky - Update contributing section in README (#1760) @seanmalloy - Option to cache AWS zones list @bpineau +- Fix: only use absolute CNAMEs in Scaleway provider (#1859) @Sh4d1 ## v0.7.3 - 2020-08-05 diff --git a/provider/scaleway/scaleway.go b/provider/scaleway/scaleway.go index 3ee4f83034..df4677a79d 100644 --- a/provider/scaleway/scaleway.go +++ b/provider/scaleway/scaleway.go @@ -269,8 +269,13 @@ func endpointToScalewayRecords(zoneName string, ep *endpoint.Endpoint) []*domain records := []*domain.Record{} for _, target := range ep.Targets { + finalTargetName := target + if domain.RecordType(ep.RecordType) == domain.RecordTypeCNAME { + finalTargetName = provider.EnsureTrailingDot(target) + } + records = append(records, &domain.Record{ - Data: target, + Data: finalTargetName, Name: strings.Trim(strings.TrimSuffix(ep.DNSName, zoneName), ". "), Priority: priority, TTL: ttl, @@ -285,9 +290,14 @@ func endpointToScalewayRecordsChangeDelete(zoneName string, ep *endpoint.Endpoin records := []*domain.RecordChange{} for _, target := range ep.Targets { + finalTargetName := target + if domain.RecordType(ep.RecordType) == domain.RecordTypeCNAME { + finalTargetName = provider.EnsureTrailingDot(target) + } + records = append(records, &domain.RecordChange{ Delete: &domain.RecordChangeDelete{ - Data: target, + Data: finalTargetName, Name: strings.Trim(strings.TrimSuffix(ep.DNSName, zoneName), ". "), Type: domain.RecordType(ep.RecordType), }, diff --git a/provider/scaleway/scaleway_test.go b/provider/scaleway/scaleway_test.go index 56b5f45d75..a0a67461e0 100644 --- a/provider/scaleway/scaleway_test.go +++ b/provider/scaleway/scaleway_test.go @@ -93,7 +93,7 @@ func (m *mockScalewayDomain) ListDNSZoneRecords(req *domain.ListDNSZoneRecordsRe Type: domain.RecordTypeA, }, { - Data: "test.example.com", + Data: "test.example.com.", Name: "two", TTL: 600, Priority: 30, @@ -330,7 +330,7 @@ func TestScalewayProvider_generateApplyRequests(t *testing.T) { Add: &domain.RecordChangeAdd{ Records: []*domain.Record{ { - Data: "example.com", + Data: "example.com.", Name: "", TTL: 600, Type: domain.RecordTypeCNAME,