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

[Extensions] Add ExtensionAwarePlugin extension point to add custom settings for extensions #7526

Merged
merged 25 commits into from May 25, 2023

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented May 11, 2023

Description

This creates a new extension point inside of IdentityPlugin called getExtensionSettings that allows this singular plugin to define settings that should be placed in extensions.yml that are needed for security. This creates a new scope for settings called the Extension scope that means that these particular settings should be placed in extensions.yml and pertain to an extension. I first implemented this without using scoped settings, but ultimately chose to use Scoped Settings similar to get Plugin.getSettings() works. Using ScopeSettings, defaults can be assigned to the settings within the implementation of the getExtensionSettings() method.

Related Issues

opensearch-project/security#2746

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

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

Gradle Check (Jenkins) Run Completed with:

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

Gradle Check (Jenkins) Run Completed with:

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

Gradle Check (Jenkins) Run Completed with:

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

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      2 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure
      1 org.opensearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT.test {yaml=pit/10_basic/Delete all}

Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since security is a plugin for OpenSearch. This design LGTM! Later, if we decide security to be an extension we can utilize getSettings extension point from SDK to register the settings coming from security.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure
      1 org.opensearch.indices.replication.SegmentReplicationIT.testReplicationPostDeleteAndForceMerge

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks requested a review from dbwiddis as a code owner May 23, 2023 22:27
Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @cwperks for the changes!

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.remotestore.RemoteStoreRefreshListenerIT.testRemoteRefreshRetryOnFailure

@cwperks
Copy link
Member Author

cwperks commented May 25, 2023

@owaiskazi19 @reta Can this be merged if there are no outstanding questions? This should be backported to 2.x.

@cwperks cwperks added the backport 2.x Backport to 2.x branch label May 25, 2023
@reta
Copy link
Collaborator

reta commented May 25, 2023

@owaiskazi19 @reta Can this be merged if there are no outstanding questions? This should be backported to 2.x.

The merge is blocked by unresolved conversations, could you please resolve them? Thank you.

@cwperks
Copy link
Member Author

cwperks commented May 25, 2023

All comments have now been marked as resolved

@reta reta merged commit 277eb3d into opensearch-project:main May 25, 2023
14 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-7526-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 277eb3d59fb9edcae8575577ec135032e3563f2e
# Push it to GitHub
git push --set-upstream origin backport/backport-7526-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7526-to-2.x.

@reta
Copy link
Collaborator

reta commented May 25, 2023

@cwperks may need manual backport sadly ...

@cwperks
Copy link
Member Author

cwperks commented May 25, 2023

On it

cwperks added a commit to cwperks/OpenSearch that referenced this pull request May 25, 2023
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 277eb3d)
@cwperks
Copy link
Member Author

cwperks commented May 25, 2023

Opened up backport PR: #7756

reta pushed a commit that referenced this pull request May 25, 2023
…to add custom settings for extensions (#7526) (#7756)

* [Extensions] Add ExtensionAwarePlugin extension point to add custom settings for extensions (#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
(cherry picked from commit 277eb3d)

* Fix conflicts

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

* Switch versions

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
dblock pushed a commit to dblock/OpenSearch that referenced this pull request May 25, 2023
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
suranjay pushed a commit to suranjay/OpenSearch that referenced this pull request May 29, 2023
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
scrawfor99 pushed a commit to scrawfor99/OpenSearch that referenced this pull request May 31, 2023
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
austintlee pushed a commit to austintlee/OpenSearch that referenced this pull request Jun 2, 2023
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
…ettings for extensions (opensearch-project#7526)

* WIP on extension settings

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

* Use getExtensionSettings from the identity service

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

* Add extension scoped settings and add area for additional settings

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

* Run spotlessApply

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

* Re-run CI

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

* spotlessApply

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

* Change contructor to take list of additionalSettings

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

* One constructor

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

* Remove isAuthenticated

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

* Re-run CI

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

* Re-run CI

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

* Create ExtensionAwarePlugin extension point

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

* Update CHANGELOG

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

* Address code review feedback

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

* Compute additionalSettingsKeys outside of loop

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

* Address code review feedback

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

* Add comment

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

---------

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants