Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors #1251

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Jun 21, 2024

Description

This PR registers the system indices in this plugin through the SystemIndexPlugin extension point in core. These indices will not be functionally different than they are today, its just a formal registration as a system index.

Issues Resolved

Related to opensearch-project/security#4439

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…IndexDescriptors

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@kaituo
Copy link
Collaborator

kaituo commented Jun 21, 2024

@cwperks
Copy link
Member Author

cwperks commented Jun 21, 2024

When adding an system index, do we still need to put the name or pattern in https://github.com/opensearch-project/security/blob/37afcaab74c8ef3133249f8ebe728ea897d0af2f/src/main/java/org/opensearch/security/tools/democonfig/SecuritySettingsConfigurer.java#L64-L67 ?

You should add the name of the index if you create a single index and you should use a pattern if you create multiple system indices based on a pattern.

If you create .opendistro-anomaly-detector-1, .opendistro-anomaly-detector-2, ... then you should register .opendistro-anomaly-detector*, but if you only use .opendistro-anomaly-detector then you only need to register the single index. No need for a wildcard if its a single index.

@kaituo
Copy link
Collaborator

kaituo commented Jun 21, 2024

When adding an system index, do we still need to put the name or pattern in https://github.com/opensearch-project/security/blob/37afcaab74c8ef3133249f8ebe728ea897d0af2f/src/main/java/org/opensearch/security/tools/democonfig/SecuritySettingsConfigurer.java#L64-L67 ?

You should add the name of the index if you create a single index and you should use a pattern if you create multiple system indices based on a pattern.

If you create .opendistro-anomaly-detector-1, .opendistro-anomaly-detector-2, ... then you should register .opendistro-anomaly-detector*, but if you only use .opendistro-anomaly-detector then you only need to register the single index. No need for a wildcard if its a single index.

I meant to ask do we still need to put system index name/patterns in src/main/java/org/opensearch/security/tools/democonfig/SecuritySettingsConfigurer.java? Is putting system index name/patterns in each plugin's files (e.g., AD's TimeSeriesAnalyticsPlugin.java) enough? Or we need to put in both places?

@cwperks
Copy link
Member Author

cwperks commented Jun 24, 2024

I meant to ask do we still need to put system index name/patterns in src/main/java/org/opensearch/security/tools/democonfig/SecuritySettingsConfigurer.java? Is putting system index name/patterns in each plugin's files (e.g., AD's TimeSeriesAnalyticsPlugin.java) enough? Or we need to put in both places?

This PR is a step towards eliminating the need to make a PR to the security repo to add it to the list in src/main/java/org/opensearch/security/tools/democonfig/SecuritySettingsConfigurer.java. I'm working with the maintainers in core to pass the system indices to the security plugin, but once opensearch-project/OpenSearch#14415 and the companion security PR are merged then it would not longer be necessary to submit a PR to the security repo to add a system index. To add a system index, you would create a PR like this one and it would automatically get passed to the security plugin to protect.

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
Copy link

codecov bot commented Jun 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.65%. Comparing base (3f0fc8c) to head (7fb2a9e).

Current head 7fb2a9e differs from pull request most recent head b0cdde9

Please upload reports for the commit b0cdde9 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1251      +/-   ##
============================================
- Coverage     71.83%   71.65%   -0.18%     
+ Complexity     4898     4881      -17     
============================================
  Files           518      518              
  Lines         22879    22884       +5     
  Branches       2245     2245              
============================================
- Hits          16434    16398      -36     
- Misses         5410     5444      +34     
- Partials       1035     1042       +7     
Flag Coverage Δ
plugin 71.65% <100.00%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ensearch/timeseries/TimeSeriesAnalyticsPlugin.java 98.03% <100.00%> (+0.03%) ⬆️

... and 9 files with indirect coverage changes

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@kaituo
Copy link
Collaborator

kaituo commented Jun 25, 2024

@cwperks Do we need to backport the PR to 2.x?

@cwperks
Copy link
Member Author

cwperks commented Jun 25, 2024

@cwperks Do we need to backport the PR to 2.x?

Yes please

@kaituo kaituo merged commit c059eff into opensearch-project:main Jun 25, 2024
14 of 15 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 25, 2024
…IndexDescriptors (#1251)

* Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Respond to code review feedback

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Remove newline

Signed-off-by: Craig Perkins <cwperx@amazon.com>

* Bump bwc version

Signed-off-by: Craig Perkins <cwperx@amazon.com>

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit c059eff)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kaituo pushed a commit that referenced this pull request Jun 26, 2024
…IndexDescriptors (#1251) (#1254)

* Register system index descriptors through SystemIndexPlugin.getSystemIndexDescriptors



* Respond to code review feedback



* Remove newline



* Bump bwc version



---------


(cherry picked from commit c059eff)

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

2 participants