Skip to content

Make stack.templates.enabled a dynamic setting#63764

Merged
dakrone merged 4 commits intoelastic:masterfrom
dakrone:stack-template-dynamic-disable
Oct 16, 2020
Merged

Make stack.templates.enabled a dynamic setting#63764
dakrone merged 4 commits intoelastic:masterfrom
dakrone:stack-template-dynamic-disable

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone dakrone commented Oct 15, 2020

This change allows the setting for disabling the automatically installed stack templates (the
logs-*-*, metrics-*-*, and synthetics-*-* templates) to be changed dynamically.

As a byproduct, it also moves thes IndexTemplateRegistry to use an initialize() method so that
constructors are not tempted to use a this reference in the constructor (see #37861 and #38560
for more information about why we want to avoid that).

Resolves #62835

This change allows the setting for disabling the automatically installed stack templates (the
`logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically.

As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that
constructors are not tempted to use a `this` reference in the constructor (see elastic#37861 for more
information about why to avoid that).

Resolves elastic#62835
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-core-features (:Core/Features/Features)

@elasticmachine elasticmachine added the Team:Data Management (obsolete) DO NOT USE. This team no longer exists. label Oct 15, 2020
Copy link
Copy Markdown
Contributor

@andreidan andreidan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for working on this Lee

this.stackTemplateEnabled = true;
} else {
logger.info(
"stack composable templates [{}] and component templates [{}] will not be installed or reinstalled",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit confusing as to why this happened. Should we also mention that the setting was updated and as a result, the templates will not be installed/reinstalled anymore?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the settings infrastructure already logs a message to that effect, so this looks like:

[2020-10-16T09:16:27,285][INFO ][o.e.c.s.ClusterSettings  ] [runTask-0] updating [stack.templates.enabled] from [true] to [false]
[2020-10-16T09:16:27,286][INFO ][o.e.x.s.StackTemplateRegistry] [runTask-0] stack composable templates [logs,metrics,synthetics] and component templates [logs-mappings,logs-settings,metrics-mappings,metrics-settings,synthetics-mappings,synthetics-settings] will not be installed or reinstalled

That's why I left out any mention that the setting was updated (it happens regardless)

@dakrone dakrone merged commit 1872e97 into elastic:master Oct 16, 2020
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Oct 16, 2020
* Make stack.templates.enabled a dynamic setting

This change allows the setting for disabling the automatically installed stack templates (the
`logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically.

As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that
constructors are not tempted to use a `this` reference in the constructor (see elastic#37861 for more
information about why to avoid that).

Resolves elastic#62835
dakrone added a commit that referenced this pull request Oct 16, 2020
* Make stack.templates.enabled a dynamic setting

This change allows the setting for disabling the automatically installed stack templates (the
`logs-*-*`, `metrics-*-*`, and `synthetics-*-*` templates) to be changed dynamically.

As a byproduct, it also moves thes `IndexTemplateRegistry` to use an `initialize()` method so that
constructors are not tempted to use a `this` reference in the constructor (see #37861 for more
information about why to avoid that).

Resolves #62835
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a setting to disable stack installed templates

5 participants