From 2a5c53285d336901624c81f4d7bf6f40a768b5aa Mon Sep 17 00:00:00 2001 From: Aleh Zasypkin Date: Fri, 25 Aug 2023 17:45:12 +0200 Subject: [PATCH 1/2] Revert "Kibana system index does not allow user templates to affect it (#98696)" This reverts commit 22393215e7c2d049b0325b74f258f070150d5551. --- .../org/elasticsearch/kibana/KibanaPlugin.java | 1 + .../AbstractFeatureMigrationIntegTest.java | 16 +++++----------- .../migration/FeatureMigrationIT.java | 8 ++++---- .../indices/SystemIndexDescriptor.java | 7 ++++--- .../upgrades/SystemIndexMigrator.java | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/modules/kibana/src/main/java/org/elasticsearch/kibana/KibanaPlugin.java b/modules/kibana/src/main/java/org/elasticsearch/kibana/KibanaPlugin.java index 011dbb602e01e..a6c48fc8b772f 100644 --- a/modules/kibana/src/main/java/org/elasticsearch/kibana/KibanaPlugin.java +++ b/modules/kibana/src/main/java/org/elasticsearch/kibana/KibanaPlugin.java @@ -27,6 +27,7 @@ public class KibanaPlugin extends Plugin implements SystemIndexPlugin { .setAliasName(".kibana") .setType(Type.EXTERNAL_UNMANAGED) .setAllowedElasticProductOrigins(KIBANA_PRODUCT_ORIGIN) + .setAllowsTemplates() .build(); public static final SystemIndexDescriptor REPORTING_INDEX_DESCRIPTOR = SystemIndexDescriptor.builder() diff --git a/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/AbstractFeatureMigrationIntegTest.java b/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/AbstractFeatureMigrationIntegTest.java index 462ed69c975b6..087cc31c5377b 100644 --- a/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/AbstractFeatureMigrationIntegTest.java +++ b/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/AbstractFeatureMigrationIntegTest.java @@ -120,10 +120,10 @@ public abstract class AbstractFeatureMigrationIntegTest extends ESIntegTestCase static final int EXTERNAL_UNMANAGED_FLAG_VALUE = 4; static final String ASSOCIATED_INDEX_NAME = ".my-associated-idx"; - public static final SystemIndexDescriptor ALLOW_TEMPLATES_MOCK_INDEX_DESCRIPTOR = SystemIndexDescriptor.builder() - .setIndexPattern(".allow_templates_*") - .setDescription("A system index that allows user templates") - .setAliasName(".allow_templates") + public static final SystemIndexDescriptor KIBANA_MOCK_INDEX_DESCRIPTOR = SystemIndexDescriptor.builder() + .setIndexPattern(".kibana_*") + .setDescription("Kibana saved objects system index") + .setAliasName(".kibana") .setType(SystemIndexDescriptor.Type.EXTERNAL_UNMANAGED) .setAllowedElasticProductOrigins(Collections.emptyList()) .setAllowedElasticProductOrigins(Collections.singletonList(ORIGIN)) @@ -281,13 +281,7 @@ public String getFeatureDescription() { @Override public Collection getSystemIndexDescriptors(Settings settings) { - return Arrays.asList( - INTERNAL_MANAGED, - INTERNAL_UNMANAGED, - EXTERNAL_MANAGED, - EXTERNAL_UNMANAGED, - ALLOW_TEMPLATES_MOCK_INDEX_DESCRIPTOR - ); + return Arrays.asList(INTERNAL_MANAGED, INTERNAL_UNMANAGED, EXTERNAL_MANAGED, EXTERNAL_UNMANAGED, KIBANA_MOCK_INDEX_DESCRIPTOR); } @Override diff --git a/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/FeatureMigrationIT.java b/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/FeatureMigrationIT.java index ac9753a2c6e48..14647820e71f6 100644 --- a/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/FeatureMigrationIT.java +++ b/modules/reindex/src/internalClusterTest/java/org/elasticsearch/migration/FeatureMigrationIT.java @@ -358,8 +358,8 @@ public void testBailOnMigrateWithTemplatesV1() throws Exception { } public void testMigrateWithTemplatesV1() throws Exception { - // this should pass for both, the first allows templates, the second INTERNAL_UNMANAGED doesn't match the template - migrateWithTemplatesV1(".allow_templates", ALLOW_TEMPLATES_MOCK_INDEX_DESCRIPTOR, INTERNAL_UNMANAGED); + // this should pass for both, kibana allows templates, the unmanaged doesn't match the template + migrateWithTemplatesV1(".kibana", KIBANA_MOCK_INDEX_DESCRIPTOR, INTERNAL_UNMANAGED); assertBusy(() -> { GetFeatureUpgradeStatusResponse statusResp = client().execute( @@ -442,8 +442,8 @@ public void testBailOnMigrateWithTemplatesV2() throws Exception { } public void testMigrateWithTemplatesV2() throws Exception { - // this should pass for both, the first allows templates, the second INTERNAL_UNMANAGED doesn't match the template - migrateWithTemplatesV2(".allow_templates", ALLOW_TEMPLATES_MOCK_INDEX_DESCRIPTOR, INTERNAL_UNMANAGED); + // this should pass for both, kibana allows templates, the unmanaged doesn't match the template + migrateWithTemplatesV2(".kibana", KIBANA_MOCK_INDEX_DESCRIPTOR, INTERNAL_UNMANAGED); assertBusy(() -> { GetFeatureUpgradeStatusResponse statusResp = client().execute( diff --git a/server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java b/server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java index 64caf2365e4bf..4d37cea8bcf98 100644 --- a/server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java +++ b/server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java @@ -174,8 +174,9 @@ public class SystemIndexDescriptor implements IndexPatternMatcher, Comparable Date: Fri, 25 Aug 2023 18:08:39 +0200 Subject: [PATCH 2/2] Update docs/changelog/98888.yaml --- docs/changelog/98888.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/98888.yaml diff --git a/docs/changelog/98888.yaml b/docs/changelog/98888.yaml new file mode 100644 index 0000000000000..1f2f7ea27ff19 --- /dev/null +++ b/docs/changelog/98888.yaml @@ -0,0 +1,5 @@ +pr: 98888 +summary: Revert "Kibana system index does not allow user templates to affect it" +area: Infra/Core +type: bug +issues: []