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

Return instance of LockService from createComponents #670

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Aug 27, 2024

Description

This is a small PR to return the LockService instance that's initialized with JobSchedulerPlugin.createComponents as one of the JobScheduler components so that it is injectable via Guice to plugins that rely on the JS SPI.

Tested this by making GeoSpatial into a ClusterPlugin and verified that the LockService is injectable with Guice. See companion geospatial PR here: opensearch-project/geospatial#677

This PR is part of an effort to remove usages of ThreadContext.stashContext across the plugins: opensearch-project/opensearch-plugins#238

Currently, plugins like geospatial instantiate their own instance of the LockService by passing in the Client given to the plugin through createComponents.

As part of the effort to Strengthen System Indices in the Plugin Ecosystem, plugins will be restricted to only perform transport actions to their own system indices. This PR is to ensure that plugins like Geospatial can re-use the LockService instantiated by JS (which has permission to JS system indices) vs creating its own LockService.

Related Issues

Related to opensearch-project/security#4439

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@cwperks
Copy link
Member Author

cwperks commented Aug 27, 2024

Eventually, the LockService's constructor should change visibility so that plugins cannot directly instantiate this class.

@cwperks cwperks changed the title Return lockService from createComponents Return instance of LockService from createComponents Aug 27, 2024
@cwperks cwperks merged commit 5bbe395 into opensearch-project:main Sep 4, 2024
15 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 4, 2024
Signed-off-by: Craig Perkins <[email protected]>
(cherry picked from commit 5bbe395)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
cwperks pushed a commit that referenced this pull request Sep 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
(cherry picked from commit 5bbe395)

Signed-off-by: Craig Perkins <[email protected]>
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
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants