Commit graph

75 commits

Author SHA1 Message Date
Yang Wang
e1c930f8c1
Make RepositoriesService project-aware (#129821)
This PR makes RepositoriesService project aware so that the basic Put,
Get, Delete and Verify repository actions are now project scoped. 

It intentionally leaves the following aspects out of scope for the
current changes: * Repository stats reporting * Repository clean-up,
analysis and integrity verification * Repository usages for searchable
snapshots and CCR

They will be worked on separately. One main reason for leaving them out
is that they are not needed by OBS which is currently blocked by
repository/snapshot changes. They may also have their own complexities,
e.g. stats reporting.

Resolves: ES-10478
2025-06-25 10:34:34 +10:00
Luke Whiting
1ccf1c6806
Streams - Log's Enable, Disable and Status endpoints (#129474)
* Enable And Disable Endpoint

* Status Endpoint

* Integration Tests

* REST Spec

* REST Spec tests

* Some documentation

* Update docs/changelog/129474.yaml

* Fix failing security test

* PR Fixes

* PR Fixes - Add missing feature flag name to YAML spec

* PR Fixes - Fix support for timeout and master_timeout parameters

* PR Fixes - Make the REST handler validation happy with the new params

* Delete docs/changelog/129474.yaml

* PR Fixes - Switch to local metadata action type and improve request handling

* PR Fixes - Make enable / disable endpoint cancellable

* PR Fixes - Switch timeout param name for status endpoint

* PR Fixes - Switch timeout param name for status endpoint in spec

* PR Fixes - Enforce local only use for status action

* PR Fixes - Refactor StreamsMetadata into server

* PR Fixes - Add streams module to multi project YAML test suite

* PR Fixes - Add streams cluster module to multi project YAML test suite
2025-06-19 11:48:44 +01:00
Pete Gillin
1fe3b77a2a
ES-10063 Add multi-project support for more stats APIs (#127650)
* Add multi-project support for more stats APIs

This affects the following APIs:
 - `GET _nodes/stats`:
   - For `indices`, it now prefixes the index name with the project ID (for non-default projects). Previously, it didn't tell you which project an index was in, and it failed if two projects had the same index name.
   - For `ingest`, it now gets the pipeline and processor stats for all projects, and prefixes the pipeline ID with the project ID. Previously, it only got them for the default project.
 - `GET /_cluster/stats`:
   - For `ingest`, it now aggregates the pipeline and processor stats for all projects. Previously, it only got them for the default project.
 - `GET /_info`:
   - For `ingest`, same as for `GET /_nodes/stats`.

This is done by making `IndicesService.stats()` and `IngestService.stats()` include project IDs in the `NodeIndicesStats` and `IngestStats` objects they return, and making those stats objects incorporate the project IDs when converting to XContent.

The transitive callers of these two methods are rather extensive (including all callers to `NodeService.stats()`, all callers of `TransportNodesStatsAction`, and so on). To ensure the change is safe, the callers were all checked out, and they fall into the following cases:
 - The behaviour change is one of the desired enhancements described above.
 - There is no behaviour change because it was getting node stats but neither `indices` nor `ingest` stats were requested.
 - There is no behaviour change because it was getting `indices` and/or `ingest` stats but only using aggregate values.
 - In `MachineLearningUsageTransportAction` and `TransportGetTrainedModelsStatsAction`, the `IngestStats` returned will return stats from all projects instead of just the default with this change, but they have been changed to filter the non-default project stats out, so this change is a noop there. (These actions are not MP-ready yet.)
 - `MonitoringService` will be affected, but this is the legacy monitoring module which is not in use anywhere that MP is going to be enabled. (If anything, the behaviour is probably improved by this change, as it will now include project IDs, rather than producing ambiguous unqualified results and failing in the case of duplicates.)

* Update test/external-modules/multi-project/build.gradle

Change suggested by Niels.

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>

* Respond to review comments

* fix merge weirdness

* [CI] Auto commit changes from spotless

* Fix test compilation following upstream change to base class

* Update x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/datatiers/DataTierUsageFixtures.java

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>

* Make projects-by-index map nullable and omit in single-project; always include project prefix in XContent in multip-project, even if default; also incorporate one other review comment

* Add a TODO

* update IT to reflect changed behaviour

* Switch to using XContent.Params to indicate whether it is multi-project or not

* Refactor NodesStatsMultiProjectIT to common up repeated assertions

* Defer use of ProjectIdResolver in REST handlers to keep tests happy

* Include index UUID in "unknown project" case

* Make the index-to-project map empty rather than null in the BWC deserialization case.

This works out fine, for the reasons given in the comment. As it happens, I'd already forgotten to do the null check in the one place it's actively used.

* remove a TODO that is done, and add a comment

* fix typo

* Get REST YAML tests working with project ID prefix TODO finish this

* As a drive-by, fix and un-suppress one of the health REST tests

* [CI] Auto commit changes from spotless

* TODO ugh

* Experiment with different stashing behaviour

* [CI] Auto commit changes from spotless

* Try a more sensible stash behaviour for assertions

* clarify comment

* Make checkstyle happy

* Make the way `Assertion` works more consistent, and simplify implementation

* [CI] Auto commit changes from spotless

* In RestNodesStatsAction, make the XContent params to channel.request(), which is the value it would have had before this change

---------

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-05-21 19:04:22 +01:00
Niels Bauman
483a9aee95
Allow REST tests to run in MP mode (#126906)
Mainly moves project setup from `MultipleProjectsClientYamlSuiteTestCase` to
`ESRestTestCase`. This allows both Java REST tests and YAML tests to be run
in MP mode by passing the system property `-Dtests.multi_project.enabled=true`.
Future work will add the required gradle changes to be able to run any REST test in
MP mode more easily.
2025-05-05 14:07:08 +02:00
Mary Gouseti
95257bbf07
Make data stream options multi-project aware (#126141) 2025-04-03 14:33:40 +03:00
Mary Gouseti
25050495b9
Data stream options convert to javaRestTests to yamlRestTests. (#126037)
In this PR we introduce the data stream API in the `es-rest-api` using
the feature flag feature. This enabled us to use the `yamlRestTests`
tests instead of the `javaRestTests`.
2025-04-03 01:32:54 +11:00
Tim Vernum
fdfe63eb37
Unable working MP YAML Tests (#124532)
This commit enables some existing yaml tests that work correctly on
multi-project
2025-03-11 15:45:54 +11:00
Rene Groeschke
496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Rene Groeschke
36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Rene Groeschke
e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Tim Vernum
3858dd61b1 Move multi-project module to test tree (MP-1957)
The multi-project module is actually a testing module, but was included
in the modules/ tree for convenience. This commit moves it to
`test/external-modules/` which is where it belongs.
2025-02-24 16:07:05 +11:00
Tim Vernum
13f9ace345 Explain unsupported reindex YAML test (MP-1912)
The yaml test

    reindex/30_search/Sorting deprecated wait_for_completion false

does not work correctly with security enabled.
This test should be permanently added to the "unsupported" list.

Relates: https://github.com/elastic/elasticsearch/issues/120252
2025-02-13 03:49:33 +01:00
Niels Bauman
f49db26e4b Unmute split API YAML tests (MP-1937) 2025-02-04 13:00:53 +01:00
Niels Bauman
2e1d84b2fc Make index block API project aware (MP-1936) 2025-02-04 11:40:20 +01:00
Niels Bauman
3c77133e9c Make Data Stream Lifecycle APIs project aware (MP-1925)
Make remaining Data Stream Lifecycle APIs project aware.
2025-01-23 09:22:30 +00:00
Niels Bauman
1d106a83ed Make migrate data stream API project aware (MP-1928)
Allows migrating aliases to data streams in multi-projects.
2025-01-23 06:42:41 +00:00
Simon Cooper
49ceed728c Add required test mutes for blocks 2025-01-22 13:34:59 +00:00
Niels Bauman
3e65cdcab9 Unmute various multi-project YAML tests (MP-1927)
These tests are already passing.
2025-01-22 08:07:10 +10:00
Niels Bauman
0e64300930 Make modify data stream API project aware (MP-1926)
Makes the modify data stream API (for changing the backing and failure
indices) project aware.
2025-01-21 07:19:52 +00:00
Niels Bauman
5ef1ace001 Make data stream aliases project aware (MP-1924)
Allows putting aliases for data streams.
2025-01-21 15:57:39 +10:00
Niels Bauman
c7c8b1d74e Unmute data stream tests (MP-1919)
Unmutes several data stream yaml tests that are working in multi-project
mode.
2025-01-21 09:49:51 +10:00
Niels Bauman
0474c2b9ea Make simulate APIs project aware (MP-1920)
Updates all simulate APIs to be project aware.
2025-01-20 22:11:01 +10:00
Tim Vernum
5541043153 Explain DBQ/UBQ yaml test failures (MP-1913)
Update the muted test list to explain why some delete_by_query and
update_by_query tests cannot run in our multi-project suite
2025-01-20 06:46:36 +00:00
Tim Vernum
5724e31171 Make resize (clone,shrink,split) project aware (MP-1901)
This updates `TransportResizeAction` to be project aware.

Although these actions are not supported on Serverless projects, we make
them work correctly with projects so that we can work towards removing
the deprecated `getProject` method.
2025-01-14 06:45:04 +00:00
Tim Vernum
347be271f6 Make reindex/UBQ/DBQ project aware (MP-1902)
This updates the reindex module to be project aware
2025-01-14 01:38:56 +00:00
Tim Vernum
6d728c7fb8 Make /_cat/component_templates project aware (MP-1907)
This updates `RestCatComponentTemplateAction` to act on the selected
(resolved) project

Relates: https://github.com/elastic/elasticsearch/pull/119920
2025-01-13 07:57:16 +00:00
Simon Cooper
415a5e67d2 Merge main into multi-project 2025-01-13 06:20:35 +00:00
Tim Vernum
f76be23dfd Make cluster stats operate over all projects (MP-1892)
This updates the cluster stats action to take all projects into account
when calculating the statistics. This is true even if a specific project
is requested.

The only exception is the "health status" because we only have
primitives for calculating the health of a single project. The stats
response will always give the health of the targeted project.
2025-01-13 16:22:50 +11:00
Tim Vernum
cecac35f6b Mute new core test 2025-01-13 16:02:11 +11:00
Tim Vernum
1351a47c6c Make _cat/indices project aware (MP-1897)
This updates `RestIndicesAction` to act on the correct project in the
cluster state
2025-01-10 07:51:13 +00:00
Tim Vernum
df345db352 Unmute tsdb/settings tests (MP-1900)
These tests are no longer broken
2025-01-09 13:59:37 +11:00
Tim Vernum
69de93ded0 Unmute /_cat/segments tests (MP-1899)
These tests now work due to MP-1877
2025-01-09 13:59:25 +11:00
Tim Vernum
0f8b5edc86 Make "ResolveIndexAction" project aware (MP-1894)
This commit changes `ResolveIndexAction` to resolve against the target
project.
2025-01-08 08:34:17 +00:00
Tim Vernum
a22d6949d4 Unmute /_cat/aliases tests (MP-1898)
These tests now pass
2025-01-08 08:29:32 +00:00
Niels Bauman
537f4e87b2 Make lazy rollover project aware (MP-1881)
Allows marking data streams (and their failure stores) for lazy rollover
and executing the lazy rollover during indexing in a multi-project
setting.
2024-12-23 10:26:37 +00:00
Yang Wang
41f5cb4295 Fix more cluster-blocks usages and unmute tests (MP-1878)
This PR fixes two more cluster-blocks usages and unmuted tests that can
pass. Some of the tests can already pass without the fix so that this PR
also unmutes them.
2024-12-23 00:05:47 +00:00
Yang Wang
22fc4818c8 Fix tests and mute tests
Fix ClusterStateTests
Relates: https://github.com/elastic/elasticsearch/pull/119083

Mute failure store related data stream tests that are renamed or new.
Relates: https://github.com/elastic/elasticsearch/pull/118662
2024-12-22 23:18:32 +11:00
Niels Bauman
0df103d7af Make indices segments API project aware (MP-1877)
Updates the indices segments transport action to be project aware.
2024-12-19 14:40:21 +00:00
Niels Bauman
bd678373d8 Execute pipelines during indexing in multiple projects (MP-1866)
Allows executing pipelines during indexing and pipeline simulation in
multiple projects.
2024-12-18 12:34:20 +00:00
Yang Wang
c416f251cb Make open/close index and add index blocks work with multi-project (MP-1870)
This PR makes open/close indices and add index blocks work by replaces a
large percentage of usages for the deprecated methods with the
corresponding project-aware versions. The ones that are no longer used
are removed. Some deprecated methods still remain after this PR. They
require even more cascading changes in areas that have not been touched,
such as snapshot/restore, watcher, security index settings etc. I prefer
to leave them out since this PR is already big enough. The main changes
are in MetadataIndexStateService class where both routing table and
metadata need to be specific to the right project.
2024-12-18 01:33:35 +00:00
Yang Wang
6707bef217 Make ClusterBlocks compatible with multi-project (MP-1859)
This PR adds a project layer to ClusterBlocks so that it works with
multiple projects. Previously the index level blocks are tracked with a
map of "index-name to set-of-blocks". This is changed to be a map of
"project-id to project-level-blocks", where project-level-blocks
currently contains just the index level blocks. This structure is
expandable in that if we want to support project-wide blocks (as opposed
to cluster-wide blocks), they can be added to the project-level-blocks.

One alternative that has been considered but decided against is to
update the map of "index-name to set-of-blocks" to "index-object/uuid to
set-of-blocks". This has a few issues: (1) ClusterBlocks has no
references to Metadata so it cannot serve a request for index blocks
given an index name (bwc); (2) Similarly, when deserializing from an
old node, which provides only index names, there is no easy way to
lookup for the associated index UUID; (3) The structure is rather rigid
and cannot be easily expanded for project-level blocks if they become a
thing; (4) No easy way to get all indices blocks for a project.

I chose to keep all existing ClusterBlocks methods that take index name
as argument to avoid too many cascading changes. I marked all of them as
deprecated for removal so that they can be easily spotted, replaced and
removed in subsequent PRs. That said, there are still test failures
where cascading changes are necessary.

Relates: ES-10162
2024-12-13 04:59:07 +00:00
Niels Bauman
26f991a055 Make rollover project aware (MP-1846)
Makes both alias and data stream rollover project aware.
2024-12-12 19:00:25 +00:00
Niels Bauman
344c3cd54c Allow putting index settings in multiple projects (MP-1838)
Updates the transport action to put index settings to support multiple
projects.
2024-12-12 18:51:19 +00:00
Pooya Salehi
3b6a2776a2 Use ProjectResolver in PrevalidateNodeRemoval 2024-12-04 17:36:20 +01:00
Niels Bauman
6a87781cff Make force merge project aware (MP-1839)
Updates the force merge transport action to support multiple projects.
2024-12-04 08:47:11 +01:00
Niels Bauman
1fd8a8ba34 Allow creating and retrieving data streams in multiple projects (MP-1817)
Modifies the PUT and GET data stream APIs to be project-aware.
2024-12-03 09:14:21 +00:00
Yang Wang
7f50a53e27 Mute new yaml test since it needs close index 2024-11-30 12:27:28 +11:00
Tim Vernum
53be424c39 Update exclusion list for core yaml tests (MP-1835) 2024-11-29 04:08:16 +00:00
Yang Wang
f3ed2b2f2f Make put-alias project aware (MP-1805)
This PR makes put-alias project aware so that the aliases API works in a
multi-project setup. This is achieved by adding a new project-id field
to IndicesAliasesClusterStateUpdateRequest.

The alias actions are also used by MetadataRolloverService. These usages
are NOT updated in this PR and still assumes default project. They will
be handled separately.
2024-11-27 16:53:22 +00:00
Tim Vernum
5e6864b9cf Make explain project aware (MP-1812)
This commit updates `TransportExplainAction` to be project aware and
enables the YAML tests
2024-11-27 15:46:23 +11:00