Jump to: navigation, search

Designate/Blueprints/RecordSets

< Designate‎ | Blueprints
Revision as of 14:49, 2 April 2014 by Rjrjr (talk | contribs) (Alternative Solution)

This proposal is for the updated recordsets for designate v2.

We will have only records and no recordsets either explicitly(as it is currently in designate v2) or implicitly (as it is currently in designate v1). The checks for TTL are done when creates/updates are done.

Create a Record

/zones/<zone_id>/records

Example request: POST /zones/89acac79-38e7-497d-807c-a011e1310438/records

 Host: example.com
 Accept: application/json
 Content-Type: application/json
 {
     "name": "www.example.com.",
     "type": "A",
     "data": "192.0.2.3"
     "TTL": 200
 }

When a create record is done, it would get records based on the domain_id, name and type. If none exist, it is created. If one or more exist, then all the TTLs should be the same. If not return an error. The error details would include the current records or the TTL of the current records.

When no records already exist and if 2 users concurrently try to create records with the same type and name, then the first record in will be added as is. The 2nd record is checked for TTL, if it is different then an error is returned. The error details would include the current records or the TTL of the current records.

Modify a Record

/zones/<zone_id>/records/<record_id>

Example request: PATCH /zones/89acac79-38e7-497d-807c-a011e1310438/records/2e32e609-3a4f-45ba-bdef-e50eacd345ad

 Host: example.com
 Accept: application/json
 Content-Type: application/json
 {
     "name": "www.example.com.",
     "type": "A",
     "data": "192.0.2.5"
     "TTL":500
 }

When a record is modified - the TTL value is checked with existing records based on the domain_id, new name and type. If the TTL is not the same, return an error. The error details would include the current records or the TTL of the current records.

To modify TTLs for all the records with the same name and type, we can have a new field in the json body call "modify-rrset". If it is set to TRUE, then all the records matching the old-name and old-type are modified. Alternatively we could have a parameter called ?modify-rrset. If it is set to TRUE, then modify all the records matching the old-name and old-type.

If we have 2 A records

   2e32e609-3a4f-45ba-bdef-e50eacd345ad    www.example.com   A  192.0.2.5   200seconds
   3e32e609-3a4f-45ba-bdef-e50eacd345ae    www.example.com   A  192.0.2.6   200seconds

To modify the TTL of these records we would send the following request to either of the records

Example request: PATCH /zones/89acac79-38e7-497d-807c-a011e1310438/records/2e32e609-3a4f-45ba-bdef-e50eacd345ad?modify-rrset=true

 Host: example.com
 Accept: application/json
 Content-Type: application/json
 {
     "ttl": 500
 }

or alternatively the request could be as follows

Example request: PATCH /zones/89acac79-38e7-497d-807c-a011e1310438/records/2e32e609-3a4f-45ba-bdef-e50eacd345ad

 Host: example.com
 Accept: application/json
 Content-Type: application/json
 {
     "ttl": 500,
     "modify-rrset": true
 }

After this request is processed, the 2 A records would be as follows

   2e32e609-3a4f-45ba-bdef-e50eacd345ad    www.example.com   A  192.0.2.5 500seconds
   3e32e609-3a4f-45ba-bdef-e50eacd345ae    www.example.com   A  192.0.2.6 500seconds

Alternative Solution

This proposal would be to hide the concept of record sets from users completely. Rather than do anything special, handle records in a record set with different TTLs the way BIND does. BIND will send the RRSet with the TTL of the lowest record. So, the change that is needed is to have mini-DNS handle it this way.

For example, a primary master in BIND has the following entries for a zone:

   ttltest1	600	A	192.168.0.250
   ttltest1	1200	A	192.168.0.251

The secondary slave will show:

   $TTL 600        ; 10 minutes
   ttltest1                A       192.168.0.250
                           A       192.168.0.251