The ionos plugin automatically uses the correct API based on the given IONOS_API_KEY.
This PR implements the support for the IONOS cloud DNS API.
mapping entities
External DNS uses the endpoint.Endpoint abstraction for a record in DNS. Normally, a DNS provider must map this abstraction to the entities of the DNS Provider API and vice versa.
In this case for the IONOS cloud DNS API we have the entities from the ionos sdk-go-dns
Depedant from the use case there are wrapper of the core entities. Concrete you have to implement:
For the get records call ( GET /records) : mapping from []RecordRead to []*endpoint.Endpoint.
For the apply changes call (POST /records) mapping from []*endpoint.Endpoint to []RecordRead ( for deleting records) and mapping []*endpoint.Endpoint to []RecordCreate ( for creating records)
The interesting thing here is that these are not 1:1 relations. So, 2 RecordRead can be "merged" to 1 endpoint.Endpoint and vice versa. So the current criteria is when records have the same name, type and ttl they are mapped to one endpoint where the content of the record is a part of endpoint.Target []string.
handling zones
For finding and creating records you need a zone (id) as an input parameter. As there is no according abstraction on External DNS for zones, we need to derive the zone from the endpoint.Endpoint.DNSName. This is realized with a function for finding a zone for a domainName. The algorithm selects the zone which has the most equal domain parts with the given domain name. In order to minimize the api calls in the apply changes use case. We retrieve all zones from the customers at the beginning and the algorithm above operates on these zones which are in memory.
pagination and limits
The API offers pagination for retrieving zones and records on the customer level. We are using the max page size ( 1000) for the requests and limit the count of items to operate to 10000.
filtering
When retrieving zones and records through the API we only load the ones with the "Available" state. This filter is applied on the server side. Filtering names with the DomainFilter ( a feature coming from the External-DNS), is applied on the client side.
Overview and Motivation
According the customer contract IONOS offers 2 public APIs for creating DNS entries:
The ionos plugin automatically uses the correct API based on the given
IONOS_API_KEY
.This PR implements the support for the IONOS cloud DNS API.
mapping entities
External DNS uses the
endpoint.Endpoint
abstraction for a record in DNS. Normally, a DNS provider must map this abstraction to the entities of the DNS Provider API and vice versa. In this case for the IONOS cloud DNS API we have the entities from the ionos sdk-go-dnsDepedant from the use case there are wrapper of the core entities. Concrete you have to implement:
For the get records call (
GET /records
) : mapping from[]RecordRead
to[]*endpoint.Endpoint
.For the apply changes call (
POST /records
) mapping from[]*endpoint.Endpoint
to[]RecordRead
( for deleting records) and mapping[]*endpoint.Endpoint
to[]RecordCreate
( for creating records)The interesting thing here is that these are not 1:1 relations. So, 2
RecordRead
can be "merged" to 1endpoint.Endpoint
and vice versa. So the current criteria is when records have the same name, type and ttl they are mapped to one endpoint where the content of the record is a part ofendpoint.Target []string
.handling zones
For finding and creating records you need a zone (id) as an input parameter. As there is no according abstraction on External DNS for zones, we need to derive the zone from the
endpoint.Endpoint.DNSName
. This is realized with a function for finding a zone for a domainName. The algorithm selects the zone which has the most equal domain parts with the given domain name. In order to minimize the api calls in the apply changes use case. We retrieve all zones from the customers at the beginning and the algorithm above operates on these zones which are in memory.pagination and limits
The API offers pagination for retrieving zones and records on the customer level. We are using the max page size ( 1000) for the requests and limit the count of items to operate to 10000.
filtering
When retrieving zones and records through the API we only load the ones with the "Available" state. This filter is applied on the server side. Filtering names with the
DomainFilter
( a feature coming from the External-DNS), is applied on the client side.