Skip to content

Commit

Permalink
[DCOS-47377] Configure node.attr.zone as long as ZONE is availabl…
Browse files Browse the repository at this point in the history
…e. (#2889)

This prevents shards from being unable to be allocated due to heterogenuity in
@zone constraints for pods.
  • Loading branch information
mpereira committed Jan 18, 2019
1 parent bd6927f commit db6cbf0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frameworks/elastic/src/main/dist/elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ bootstrap.memory_lock: false
metrics.statsd.host: {{STATSD_UDP_HOST}}
metrics.statsd.port: {{STATSD_UDP_PORT}}

{{#PLACEMENT_REFERENCED_ZONE}}
{{#ZONE}}
node.attr.zone: {{ZONE}}
{{#PLACEMENT_REFERENCED_ZONE}}
cluster.routing.allocation.awareness.attributes: zone
{{/ZONE}}
{{/PLACEMENT_REFERENCED_ZONE}}
{{/ZONE}}

{{#MASTER_ENABLED}}
gateway.expected_master_nodes: 3
Expand Down
31 changes: 30 additions & 1 deletion frameworks/elastic/tests/test_rack_awareness.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_zones_not_referenced_in_placement_constraints():
)
is None
)
assert get_in(["attributes", "zone"], node) is None
assert sdk_fault_domain.is_valid_zone(get_in(["attributes", "zone"], node))

sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)

Expand Down Expand Up @@ -57,3 +57,32 @@ def test_zones_referenced_in_placement_constraints():
assert sdk_fault_domain.is_valid_zone(get_in(["attributes", "zone"], node))

sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)


@pytest.mark.sanity
@pytest.mark.dcos_min_version("1.11")
@sdk_utils.dcos_ee_only
def test_heterogeneus_zone_constraints():
sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)
sdk_install.install(
config.PACKAGE_NAME,
config.SERVICE_NAME,
config.DEFAULT_TASK_COUNT,
additional_options={
"master_nodes": {"placement": '[["@zone", "GROUP_BY"]]'},
"data_nodes": {"placement": '[["hostname", "UNIQUE"]]'},
},
)

document_id = 99
document_fields = {"name": "X-Pack", "role": "commercial plugin"}
config.create_document(
config.DEFAULT_INDEX_NAME,
config.DEFAULT_INDEX_TYPE,
document_id,
document_fields,
service_name=config.SERVICE_NAME,
)
config.verify_document(config.SERVICE_NAME, document_id, document_fields)

sdk_install.uninstall(config.PACKAGE_NAME, config.SERVICE_NAME)

0 comments on commit db6cbf0

Please sign in to comment.