1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

ROUTE53: Allow R53_ALIAS records to enable target health evaluation (#2649)

This commit is contained in:
Jonathan Bouvier
2023-11-27 17:50:21 -05:00
committed by GitHub
parent bf9e48d06f
commit e783d7024c
13 changed files with 196 additions and 44 deletions

View File

@ -328,8 +328,14 @@ var R53_ALIAS = recordBuilder('R53_ALIAS', {
record.target = args.target;
if (_.isObject(record.r53_alias)) {
record.r53_alias['type'] = args.type;
if (!_.isString(record.r53_alias['evaluate_target_health'])) {
record.r53_alias['evaluate_target_health'] = 'false';
}
} else {
record.r53_alias = { type: args.type };
record.r53_alias = {
type: args.type,
evaluate_target_health: 'false',
};
}
},
});
@ -347,6 +353,17 @@ function R53_ZONE(zone_id) {
};
}
// R53_EVALUATE_TARGET_HEALTH(enabled)
function R53_EVALUATE_TARGET_HEALTH(enabled) {
return function (r) {
if (_.isObject(r.r53_alias)) {
r.r53_alias['evaluate_target_health'] = enabled.toString();
} else {
r.r53_alias = { evaluate_target_health: enabled.toString() };
}
};
}
function validateR53AliasType(value) {
if (!_.isString(value)) {
return false;

View File

@ -2,6 +2,7 @@ D("foo.com", "none",
R53_ALIAS("mxtest", "MX", "foo.com."),
R53_ALIAS("atest", "A", "foo.com."),
R53_ALIAS("atest", "A", "foo.com.", R53_ZONE("Z2FTEDLFRTF")),
R53_ALIAS("aevaltargethealthtest", "A", "foo.com.", R53_EVALUATE_TARGET_HEALTH(true)),
R53_ALIAS("aaaatest", "AAAA", "foo.com."),
R53_ALIAS("aaaatest", "AAAA", "foo.com.", R53_ZONE("ERERTFGFGF")),
R53_ALIAS("cnametest", "CNAME", "foo.com."),

View File

@ -12,15 +12,8 @@
"name": "mxtest",
"target": "foo.com.",
"r53_alias": {
"type": "MX"
}
},
{
"type": "R53_ALIAS",
"name": "atest",
"target": "foo.com.",
"r53_alias": {
"type": "A"
"type": "MX",
"evaluate_target_health": "false"
}
},
{
@ -29,15 +22,26 @@
"target": "foo.com.",
"r53_alias": {
"type": "A",
"zone_id": "Z2FTEDLFRTF"
"evaluate_target_health": "false"
}
},
{
"type": "R53_ALIAS",
"name": "aaaatest",
"name": "atest",
"target": "foo.com.",
"r53_alias": {
"type": "AAAA"
"type": "A",
"zone_id": "Z2FTEDLFRTF",
"evaluate_target_health": "false"
}
},
{
"type": "R53_ALIAS",
"name": "aevaltargethealthtest",
"target": "foo.com.",
"r53_alias": {
"type": "A",
"evaluate_target_health": "true"
}
},
{
@ -46,7 +50,17 @@
"target": "foo.com.",
"r53_alias": {
"type": "AAAA",
"zone_id": "ERERTFGFGF"
"evaluate_target_health": "false"
}
},
{
"type": "R53_ALIAS",
"name": "aaaatest",
"target": "foo.com.",
"r53_alias": {
"type": "AAAA",
"zone_id": "ERERTFGFGF",
"evaluate_target_health": "false"
}
},
{
@ -54,7 +68,8 @@
"name": "cnametest",
"target": "foo.com.",
"r53_alias": {
"type": "CNAME"
"type": "CNAME",
"evaluate_target_health": "false"
}
},
{
@ -62,7 +77,8 @@
"name": "ptrtest",
"target": "foo.com.",
"r53_alias": {
"type": "PTR"
"type": "PTR",
"evaluate_target_health": "false"
}
},
{
@ -70,7 +86,8 @@
"name": "txttest",
"target": "foo.com.",
"r53_alias": {
"type": "TXT"
"type": "TXT",
"evaluate_target_health": "false"
}
},
{
@ -78,7 +95,8 @@
"name": "srvtest",
"target": "foo.com.",
"r53_alias": {
"type": "SRV"
"type": "SRV",
"evaluate_target_health": "false"
}
},
{
@ -86,7 +104,8 @@
"name": "spftest",
"target": "foo.com.",
"r53_alias": {
"type": "SPF"
"type": "SPF",
"evaluate_target_health": "false"
}
},
{
@ -94,7 +113,8 @@
"name": "caatest",
"target": "foo.com.",
"r53_alias": {
"type": "CAA"
"type": "CAA",
"evaluate_target_health": "false"
}
},
{
@ -102,7 +122,8 @@
"name": "naptrtest",
"target": "foo.com.",
"r53_alias": {
"type": "NAPTR"
"type": "NAPTR",
"evaluate_target_health": "false"
}
}
]

View File

@ -21,7 +21,8 @@
"name": "atest",
"r53_alias": {
"type": "A",
"zone_id": "Z2FTEDLFRTZ"
"zone_id": "Z2FTEDLFRTZ",
"evaluate_target_health": "false"
},
"target": "foo.com."
}