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

Route53 support for healthcheck protocol & port

This commit is contained in:
Ross McFarland
2018-03-31 14:47:22 -07:00
parent e6d8669611
commit b51a9148b8
2 changed files with 59 additions and 13 deletions

View File

@@ -526,11 +526,12 @@ class Route53Provider(BaseProvider):
# We've got a cached version use it
return self._health_checks
def _health_check_equivilent(self, host, path, health_check,
first_value=None):
def _health_check_equivilent(self, host, path, protocol, port,
health_check, first_value=None):
config = health_check['HealthCheckConfig']
return host == config['FullyQualifiedDomainName'] and \
path == config['ResourcePath'] and \
path == config['ResourcePath'] and protocol == config['Type'] \
and port == config['Port'] and \
(first_value is None or first_value == config['IPAddress'])
def get_health_check_id(self, record, ident, geo, create):
@@ -546,6 +547,8 @@ class Route53Provider(BaseProvider):
healthcheck_host = record.healthcheck_host
healthcheck_path = record.healthcheck_path
healthcheck_protocol = record.healthcheck_protocol
healthcheck_port = record.healthcheck_port
# we're looking for a healthcheck with the current version & our record
# type, we'll ignore anything else
@@ -556,7 +559,9 @@ class Route53Provider(BaseProvider):
# not a version & type match, ignore
continue
if self._health_check_equivilent(healthcheck_host,
healthcheck_path, health_check,
healthcheck_path,
healthcheck_protocol,
healthcheck_port, health_check,
first_value=first_value):
# this is the health check we're looking for
return id
@@ -567,15 +572,15 @@ class Route53Provider(BaseProvider):
# no existing matches, we need to create a new health check
config = {
'EnableSNI': True,
'EnableSNI': healthcheck_protocol == 'HTTPS',
'FailureThreshold': 6,
'FullyQualifiedDomainName': healthcheck_host,
'IPAddress': first_value,
'MeasureLatency': True,
'Port': 443,
'Port': healthcheck_port,
'RequestInterval': 10,
'ResourcePath': healthcheck_path,
'Type': 'HTTPS',
'Type': healthcheck_protocol,
}
ref = '{}:{}:{}:{}'.format(self.HEALTH_CHECK_VERSION, record._type,
record.name, uuid4().hex[:16])
@@ -699,6 +704,8 @@ class Route53Provider(BaseProvider):
healthcheck_host = record.healthcheck_host
healthcheck_path = record.healthcheck_path
healthcheck_protocol = record.healthcheck_protocol
healthcheck_port = record.healthcheck_port
fqdn = record.fqdn
# loop through all the r53 rrsets
@@ -718,6 +725,8 @@ class Route53Provider(BaseProvider):
if caller_ref.startswith(self.HEALTH_CHECK_VERSION):
if self._health_check_equivilent(healthcheck_host,
healthcheck_path,
healthcheck_protocol,
healthcheck_port,
health_check):
# it has the right health check
continue