Introduce system index types including external#68919
Introduce system index types including external#68919jaymode merged 24 commits intoelastic:masterfrom
Conversation
This commit introduces system index types that will be used to differentiate behavior. Previously system indices were all treated the same regardless of whether they belonged to Elasticsearch, a stack component, or one of our solutions. Upon further discussion and analysis this decision was not in the best interest of the various teams and instead a new type of system index was needed. These system indices will be referred to as external system indices. Within external system indices, an option exists for these indices to be managed by Elasticsearch or to be managed by the external product. In order to represent this within Elasticsearch, each system index will have a type and this type will be used to control behavior. Closes elastic#67383
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/indices/SystemIndices.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/RestController.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/enrich/src/main/java/org/elasticsearch/xpack/enrich/EnrichPlugin.java
Outdated
Show resolved
Hide resolved
|
I see this expression all over the tests: ...and it makes me wonder whether it's worth putting it in a test utility class somewhere. That said, the only value it would add is cutting down some repetition, and at this point I'm not sure it'd be worth the cost of the extra refactoring. |
test/framework/src/main/java/org/elasticsearch/indices/EmptySystemIndices.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/elasticsearch/indices/TestIndexNameExpressionResolver.java
Outdated
Show resolved
Hide resolved
AthenaEryma
left a comment
There was a problem hiding this comment.
Left a few minor comments but overall LGTM
| .setIndexPattern(".apm-custom-link") | ||
| .setDescription("system index for APM custom links") | ||
| .setType(Type.EXTERNAL_UNMANAGED) | ||
| .setAllowedStackComponents(List.of("kibana")) |
There was a problem hiding this comment.
Nit: Move "kibana" (or List.of("kibana")) to a constant.
| final Predicate<IndexMetadata> systemIndexAccessLevelPredicate = systemIndexAccessLevel == SystemIndexAccessLevel.NONE ? | ||
| indexMetadata -> true : | ||
| systemIndices | ||
| .getProductSystemIndexMetadataPredicate(threadContext.getHeader(EXTERNAL_SYSTEM_INDEX_ACCESS_CONTROL_HEADER_KEY)) | ||
| .negate(); |
There was a problem hiding this comment.
Might be worth breaking this up a bit, it took me a minute to parse this expression.
| return this; | ||
| } | ||
|
|
||
| public Builder setAllowedStackComponents(List<String> allowedStackComponents) { |
There was a problem hiding this comment.
Nit: It's allowedStackComponents here in the builder and allowedElasticProductOrigins elsewhere, we should probably be consistent.
williamrandolph
left a comment
There was a problem hiding this comment.
Looks good to me! I have one little thought on a Javadoc.
| /** | ||
| * The specific type of system index that this descriptor represents. System indices have three defined types, which is used to | ||
| * control behavior. Elasticsearch itself has system indices that are necessary for features of Elasticsearch; these system indices | ||
| * are referred to as internal system indices. Internal system indices are always managed indices that Elasticsearch itself manages. |
There was a problem hiding this comment.
I think it is worth mentioning that plugins, even third-party plugins, can implement internal indices. A plugin developer trying to implement SystemIndicesPlugin might look here to decide what type of index to choose.
This commit introduces system index types that will be used to differentiate behavior. Previously system indices were all treated the same regardless of whether they belonged to Elasticsearch, a stack component, or one of our solutions. Upon further discussion and analysis this decision was not in the best interest of the various teams and instead a new type of system index was needed. These system indices will be referred to as external system indices. Within external system indices, an option exists for these indices to be managed by Elasticsearch or to be managed by the external product. In order to represent this within Elasticsearch, each system index will have a type and this type will be used to control behavior. Closes #67383 Backport of #68919
This commit introduces system index types that will be used to
differentiate behavior. Previously system indices were all treated the
same regardless of whether they belonged to Elasticsearch, a stack
component, or one of our solutions. Upon further discussion and
analysis this decision was not in the best interest of the various
teams and instead a new type of system index was needed. These system
indices will be referred to as external system indices. Within external
system indices, an option exists for these indices to be managed by
Elasticsearch or to be managed by the external product.
In order to represent this within Elasticsearch, each system index will
have a type and this type will be used to control behavior.
Closes #67383
There are still some open items that need to be addressed:
Figure out integration with security restricted indicesIntegrate system indices with restricted indices names in security #69298