-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Improve ILM policy and alias setup log output #24480
Conversation
Pinging @elastic/agent (Team:Agent) |
@@ -287,8 +287,9 @@ func TestDefaultSupport_Manager_EnsurePolicy(t *testing.T) { | |||
onHasILMPolicy(testPolicy.Name).Return(true, nil), | |||
}, | |||
}, | |||
"overwrite existing": { | |||
"overwrite": { |
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.
The test was wrong. When overwrite is enabled we ignore checkExists and always attempt to create the resource. The mock as configured checks that: HasPolicy will not be called, ILMPolicy will be created and indicates success.
The idxmgmt has not all 'information' to properly log the outcome of the policy and status setup. The PR moves the reporting to the ILM package directly, and 'unifies' the logic of EnsurePolicy and EnsureAlias.
a89a5bb
to
3f61d76
Compare
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪💚 Flaky test reportTests succeeded. Expand to view the summary
Test stats 🧪
|
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.
Minor changelog nit.
(cherry picked from commit 4edc6dc)
* Update to elastic/beats@abd6a93bf275 * idxmgmt: update test due to libbeat change See elastic/beats#24480
* Update to elastic/beats@205e3dd3eef2 * idxmgmt: update test due to libbeat change See elastic/beats#24480 * Update to elastic/beats@18f4e405ad11
* Update to elastic/beats@abd6a93bf275 * idxmgmt: update test due to libbeat change See elastic/beats#24480
What does this PR do?
The idxmgmt has not all 'information' to properly log the outcome of the
policy and status setup. The PR moves the reporting to the ILM package
directly, and 'unifies' the logic of EnsurePolicy and EnsureAlias.
Why is it important?
The change fixes the status reporting for the ILM and index alias setup, that is written to the logs.
With the fix one can tell if some resources have been installed, or not, depending on the actual settings in the configuration file. Before it was potentially reported that a policy/alias has been created, although the creation of the resources was disabled.
The change also updates EnsurePolicy/EnsureAlias to follow a similar pattern, which makes it a little easier to follow the code. We now allow EnsureAlias to create the first index and alias if
check_exists: false
andoverwrite: true
. If the alias already exists, no new alias will be created, as Elasticsearch will return an error.This change in semantics fixes a setup that has ILM enabled with aforementioned settings, potentially indexing without the appropriate alias/index being setup ahead of time.
Checklist
- [ ] I have commented my code, particularly in hard-to-understand areas- [ ] I have made corresponding changes to the documentation- [ ] I have made corresponding change to the default configuration filesCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Related issues