-
Notifications
You must be signed in to change notification settings - Fork 25.6k
#104233 Allow Watcher Node Allocation Settings #115251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lukewhiting
merged 4 commits into
elastic:main
from
lukewhiting:104233-watcher-index-allocation
Oct 22, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
...lRestTest/resources/rest-api-spec/test/watcher/settings_endpoints/10_watcher_settings.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
setup: | ||
- do: | ||
cluster.health: | ||
wait_for_status: yellow | ||
- do: | ||
watcher.put_watch: | ||
id: "my_watch" | ||
body: > | ||
{ | ||
"trigger": { | ||
"schedule": { | ||
"hourly": { | ||
"minute": [ 0, 5 ] | ||
} | ||
} | ||
}, | ||
"input": { | ||
"simple": { | ||
"payload": { | ||
"send": "yes" | ||
} | ||
} | ||
}, | ||
"condition": { | ||
"always": {} | ||
}, | ||
"actions": { | ||
"test_index": { | ||
"index": { | ||
"index": "test" | ||
} | ||
} | ||
} | ||
} | ||
--- | ||
"Test update and get watch settings api": | ||
- do: | ||
watcher.get_settings: { } | ||
|
||
- match: { index.auto_expand_replicas: "0-1" } | ||
- match: { index.number_of_replicas: "0" } | ||
|
||
- do: | ||
watcher.update_settings: | ||
body: | ||
index.auto_expand_replicas: "0-all" | ||
|
||
- do: | ||
watcher.get_settings: { } | ||
|
||
- match: { index.auto_expand_replicas: "0-all" } | ||
- is_false: index.routing.allocation.include._tier_preference | ||
|
||
- do: | ||
watcher.update_settings: | ||
body: | ||
index.auto_expand_replicas: null | ||
index.number_of_replicas: 1 | ||
|
||
- do: | ||
watcher.get_settings: { } | ||
|
||
- match: { index.number_of_replicas: "1" } | ||
--- | ||
"Test disallowed setting name throws error": | ||
- requires: | ||
test_runner_features: regex | ||
- do: | ||
watcher.update_settings: | ||
body: | ||
index.disallowed_setting: "some_invalid_value" | ||
catch: bad_request | ||
- match: | ||
error: | ||
type: "action_request_validation_exception" | ||
reason: '/illegal settings\: \[index.disallowed_setting\].*/' | ||
--- | ||
"Test allowed prefix setting name": | ||
- do: | ||
watcher.update_settings: | ||
body: | ||
index.routing.allocation.include.role: "watcher" | ||
index.routing.allocation.exclude.role: "noWatcher" | ||
index.routing.allocation.require.role: "mustWatcher" | ||
- do: | ||
watcher.get_settings: { } | ||
- match: { index.routing.allocation.include.role: "watcher" } | ||
- match: { index.routing.allocation.exclude.role: "noWatcher" } | ||
- match: { index.routing.allocation.require.role: "mustWatcher" } | ||
--- | ||
"Test explicitly disallowed prefix setting name throws error": | ||
- requires: | ||
test_runner_features: regex | ||
- do: | ||
watcher.update_settings: | ||
body: | ||
index.routing.allocation.include.disallowed_prefix: "some_invalid_value" | ||
catch: bad_request | ||
- match: | ||
error: | ||
type: "action_request_validation_exception" | ||
reason: '/illegal settings\: \[index.routing.allocation.include.disallowed_prefix\].*/' |
66 changes: 0 additions & 66 deletions
66
...tTest/resources/rest-api-spec/test/watcher/update_settings/10_update_watcher_settings.yml
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you're denying this one because we always want the .watches shards in the hot tier? That makes me wonder what other possible values there are for these afix settings, and if we ought to just explicitly allow the
index.routing.allocation.exclude.role
,index.routing.allocation.include.role
, andindex.routing.allocation.require.role
ones and disallow anything else to avoid causing some unforeseen problems. You've probably looked at all these settings more than I have -- what do you think?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I based this restriction on what the default setting for the
.watcher
index are. I assumed we put it in the hot tier for good reason so locked off the ability to change that. I may be wrong in that assumption.Locking down the
index.routing.allocation.*.*
settings further is difficult / undesirable.index.routing.allocation.include.role
isn't actually a setting as such but a convention for a wildcard setting. Anything afterindex.routing.allocation.include.
is assumed to be an arbitrary node attribute hence my leaving it as allowing any setting with that prefix as we have no way of knowing what attributes the end user might have set on their nodes and how they would like to use those for scheduling watches.For instance
index.routing.allocation.include.sandwich_filling=turkey
is a valid setting for this if the user chose to use a bread based node attributes scheme to group their cluster members :-)