Skip to content

Commit

Permalink
Move kibana reporting data stream settings into component template (#…
Browse files Browse the repository at this point in the history
…107581)

Previously these were contained in the index template, however, Kibana
needs to be able to make overrides to only the settings, so factoring
these out would allow them to do this (in such a way that they can be
overridden by the `kibana-reporting@custom` component template as well).

Relates to #97765
  • Loading branch information
dakrone committed May 8, 2024
1 parent ab40808 commit ef8b610
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
@@ -0,0 +1,14 @@
{
"template": {
"settings": {
"number_of_shards": 1,
"auto_expand_replicas": "0-1"
}
},
"_meta": {
"description": "default kibana reporting settings installed by elasticsearch",
"managed": true
},
"version": ${xpack.stack.template.version},
"deprecated": ${xpack.stack.template.deprecated}
}
Expand Up @@ -5,14 +5,10 @@
"hidden": true
},
"allow_auto_create": true,
"composed_of": ["kibana-reporting@custom"],
"composed_of": ["kibana-reporting@settings", "kibana-reporting@custom"],
"ignore_missing_component_templates": ["kibana-reporting@custom"],
"template": {
"lifecycle": {},
"settings": {
"number_of_shards": 1,
"auto_expand_replicas": "0-1"
},
"mappings": {
"properties": {
"meta": {
Expand Down
Expand Up @@ -107,6 +107,7 @@ public class StackTemplateRegistry extends IndexTemplateRegistry {
// Kibana reporting template
///////////////////////////////////
public static final String KIBANA_REPORTING_INDEX_TEMPLATE_NAME = ".kibana-reporting";
public static final String KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME = "kibana-reporting@settings";

public StackTemplateRegistry(
Settings nodeSettings,
Expand Down Expand Up @@ -229,6 +230,13 @@ protected List<LifecyclePolicy> getLifecyclePolicies() {
REGISTRY_VERSION,
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
),
new IndexTemplateConfig(
KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME,
"/kibana-reporting@settings.json",
REGISTRY_VERSION,
TEMPLATE_VERSION_VARIABLE,
ADDITIONAL_TEMPLATE_VARIABLES
)
)) {
try {
Expand Down
Expand Up @@ -429,6 +429,7 @@ public void testSameOrHigherVersionTemplateNotUpgraded() {
versions.put(StackTemplateRegistry.METRICS_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.SYNTHETICS_SETTINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.SYNTHETICS_MAPPINGS_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
versions.put(StackTemplateRegistry.KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME, StackTemplateRegistry.REGISTRY_VERSION);
ClusterChangedEvent sameVersionEvent = createClusterChangedEvent(versions, nodes);
client.setVerifier((action, request, listener) -> {
if (action instanceof PutComponentTemplateAction) {
Expand Down Expand Up @@ -484,6 +485,10 @@ public void testSameOrHigherVersionTemplateNotUpgraded() {
StackTemplateRegistry.SYNTHETICS_MAPPINGS_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
);
versions.put(
StackTemplateRegistry.KIBANA_REPORTING_COMPONENT_TEMPLATE_NAME,
StackTemplateRegistry.REGISTRY_VERSION + randomIntBetween(1, 1000)
);
ClusterChangedEvent higherVersionEvent = createClusterChangedEvent(versions, nodes);
registry.clusterChanged(higherVersionEvent);
}
Expand Down

0 comments on commit ef8b610

Please sign in to comment.