Browse Source

Merge remote-tracking branch 'origin/master' into route53-dynamic-status-support

pull/819/head
Ross McFarland 4 years ago
parent
commit
40f72d8914
No known key found for this signature in database GPG Key ID: 943B179E15D3B22A
3 changed files with 67 additions and 2 deletions
  1. +20
    -2
      docs/dynamic_records.md
  2. +28
    -0
      octodns/provider/azuredns.py
  3. +19
    -0
      tests/test_octodns_provider_azuredns.py

+ 20
- 2
docs/dynamic_records.md View File

@ -130,7 +130,7 @@ Support matrix:
* Azure DNS supports only `obey` and `down` * Azure DNS supports only `obey` and `down`
* All other dynamic-capable providers only support the default `obey` * All other dynamic-capable providers only support the default `obey`
#### Route53 Healtch Check Options
#### Route53 Health Check Options
| Key | Description | Default | | Key | Description | Default |
|--|--|--| |--|--|--|
@ -220,4 +220,22 @@ Sonar check regions (sonar_regions) possible values:
connect_timeout: 2 connect_timeout: 2
response_timeout: 10 response_timeout: 10
rapid_recheck: True rapid_recheck: True
```
```
#### [Azure Health Check Options](https://docs.microsoft.com/en-us/azure/traffic-manager/traffic-manager-monitoring#configure-endpoint-monitoring)
| Key | Description | Default |
|--|--|--|
| interval_in_seconds | This value specifies how often an endpoint is checked for its health from a Traffic Manager probing agent. You can specify two values here: 30 seconds (normal probing) and 10 seconds (fast probing). If no values are provided, the profile sets to a default value of 30 seconds. Visit the [Traffic Manager Pricing](https://azure.microsoft.com/pricing/details/traffic-manager) page to learn more about fast probing pricing. | 30 |
| timeout_in_seconds | This property specifies the amount of time the Traffic Manager probing agent should wait before considering a health probe check to an endpoint a failure. If the Probing Interval is set to 30 seconds, then you can set the Timeout value between 5 and 10 seconds. If no value is specified, it uses a default value of 10 seconds. If the Probing Interval is set to 10 seconds, then you can set the Timeout value between 5 and 9 seconds. If no Timeout value is specified, it uses a default value of 9 seconds. | 10 or 9 |
| tolerated_number_of_failures | This value specifies how many failures a Traffic Manager probing agent tolerates before marking that endpoint as unhealthy. Its value can range between 0 and 9. A value of 0 means a single monitoring failure can cause that endpoint to be marked as unhealthy. If no value is specified, it uses the default value of 3. | 3 |
```
---
octodns:
azuredns:
healthcheck:
interval_in_seconds: 10
timeout_in_seconds: 7
tolerated_number_of_failures: 4
```

+ 28
- 0
octodns/provider/azuredns.py View File

@ -286,11 +286,33 @@ def _pool_traffic_manager_name(pool, record):
return f'{prefix}-pool-{pool}' return f'{prefix}-pool-{pool}'
def _healthcheck_tolerated_number_of_failures(record):
return record._octodns.get('azuredns', {}) \
.get('healthcheck', {}) \
.get('tolerated_number_of_failures')
def _healthcheck_interval_in_seconds(record):
return record._octodns.get('azuredns', {}) \
.get('healthcheck', {}) \
.get('interval_in_seconds')
def _healthcheck_timeout_in_seconds(record):
return record._octodns.get('azuredns', {}) \
.get('healthcheck', {}) \
.get('timeout_in_seconds')
def _get_monitor(record): def _get_monitor(record):
monitor = MonitorConfig( monitor = MonitorConfig(
protocol=record.healthcheck_protocol, protocol=record.healthcheck_protocol,
port=record.healthcheck_port, port=record.healthcheck_port,
path=record.healthcheck_path, path=record.healthcheck_path,
interval_in_seconds=_healthcheck_interval_in_seconds(record),
timeout_in_seconds=_healthcheck_timeout_in_seconds(record),
tolerated_number_of_failures=
_healthcheck_tolerated_number_of_failures(record),
) )
host = record.healthcheck_host() host = record.healthcheck_host()
if host: if host:
@ -358,6 +380,12 @@ def _profile_is_match(have, desired):
if monitor_have.protocol != monitor_desired.protocol or \ if monitor_have.protocol != monitor_desired.protocol or \
monitor_have.port != monitor_desired.port or \ monitor_have.port != monitor_desired.port or \
monitor_have.path != monitor_desired.path or \ monitor_have.path != monitor_desired.path or \
monitor_have.tolerated_number_of_failures != \
monitor_desired.tolerated_number_of_failures or \
monitor_have.interval_in_seconds != \
monitor_desired.interval_in_seconds or \
monitor_have.timeout_in_seconds != \
monitor_desired.timeout_in_seconds or \
monitor_have.custom_headers != monitor_desired.custom_headers: monitor_have.custom_headers != monitor_desired.custom_headers:
return false(monitor_have, monitor_desired, have.name) return false(monitor_have, monitor_desired, have.name)


+ 19
- 0
tests/test_octodns_provider_azuredns.py View File

@ -470,6 +470,9 @@ class Test_ProfileIsMatch(TestCase):
monitor_proto = 'HTTPS', monitor_proto = 'HTTPS',
monitor_port = 4443, monitor_port = 4443,
monitor_path = '/_ping', monitor_path = '/_ping',
monitor_interval_in_seconds = None,
monitor_timeout_in_seconds = None,
monitor_tolerated_number_of_failures = None,
endpoints = 1, endpoints = 1,
endpoint_name = 'name', endpoint_name = 'name',
endpoint_type = 'profile/nestedEndpoints', endpoint_type = 'profile/nestedEndpoints',
@ -487,6 +490,10 @@ class Test_ProfileIsMatch(TestCase):
protocol=monitor_proto, protocol=monitor_proto,
port=monitor_port, port=monitor_port,
path=monitor_path, path=monitor_path,
interval_in_seconds=monitor_interval_in_seconds,
timeout_in_seconds=monitor_timeout_in_seconds,
tolerated_number_of_failures=
monitor_tolerated_number_of_failures,
), ),
endpoints=[Endpoint( endpoints=[Endpoint(
name=endpoint_name, name=endpoint_name,
@ -506,6 +513,18 @@ class Test_ProfileIsMatch(TestCase):
self.assertFalse(is_match(profile(), profile(endpoints=2))) self.assertFalse(is_match(profile(), profile(endpoints=2)))
self.assertFalse(is_match(profile(), profile(dns_name='two'))) self.assertFalse(is_match(profile(), profile(dns_name='two')))
self.assertFalse(is_match(profile(), profile(monitor_proto='HTTP'))) self.assertFalse(is_match(profile(), profile(monitor_proto='HTTP')))
self.assertFalse(is_match(
profile(),
profile(monitor_interval_in_seconds=9),
))
self.assertFalse(is_match(
profile(),
profile(monitor_timeout_in_seconds=3),
))
self.assertFalse(is_match(
profile(),
profile(monitor_tolerated_number_of_failures=2),
))
self.assertFalse(is_match(profile(), profile(endpoint_name='a'))) self.assertFalse(is_match(profile(), profile(endpoint_name='a')))
self.assertFalse(is_match(profile(), profile(endpoint_type='b'))) self.assertFalse(is_match(profile(), profile(endpoint_type='b')))
self.assertFalse( self.assertFalse(


Loading…
Cancel
Save