-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Enhancement] Pass localNode info to all plugins on node start #7919
[Enhancement] Pass localNode info to all plugins on node start #7919
Conversation
… directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
Codecov Report
@@ Coverage Diff @@
## main #7919 +/- ##
============================================
- Coverage 70.93% 70.78% -0.15%
+ Complexity 56633 56559 -74
============================================
Files 4719 4719
Lines 267555 267557 +2
Branches 39206 39206
============================================
- Hits 189778 189393 -385
- Misses 61721 62140 +419
+ Partials 16056 16024 -32
|
Gradle Check (Jenkins) Run Completed with:
|
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
CI failed with |
Gradle Check (Jenkins) Run Completed with:
|
…ed and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
Gradle Check (Jenkins) Run Completed with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these tests, looks good to me
@dblock Would you please review this again? |
Gradle Check (Jenkins) Run Completed with:
|
The CI test failures seem flaky: https://build.ci.opensearch.org/job/gradle-check/17928/ |
Gradle Check (Jenkins) Run Completed with:
|
@dblock dismissing your review as tests are added. Feel free to come back to this.
The backport to
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-7919-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 40d758387bd9227314a64a73035260829bfc3c10
# Push it to GitHub
git push --set-upstream origin backport/backport-7919-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 |
@DarshitChanpura sadly needs manual backport to |
…earch-project#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com> (cherry picked from commit 40d7583)
* [Enhancement] Pass localNode info to all plugins on node start (#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com> (cherry picked from commit 40d7583) * Adds a CHANGELOG entry Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…earch-project#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com>
…search-project#8192) * [Enhancement] Pass localNode info to all plugins on node start (opensearch-project#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com> (cherry picked from commit 40d7583) * Adds a CHANGELOG entry Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
…earch-project#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com> Signed-off-by: Rishab Nahata <rnnahata@amazon.com>
…earch-project#7919) * Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hacky implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds this PR to changelog Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Makes onNodeStarted call plugin agnostic Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Marking onNodeStarted() as deprecated Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds a test to verify the behaviour of new signature of onNodeStarted Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Updates test to also check for nodeId Signed-off-by: Darshit Chanpura <dchanp@amazon.com> * Adds instructions to use the overloaded implementation of onNodeStarted and adds a test to check that current plugins are not affect with this implementation Signed-off-by: Darshit Chanpura <dchanp@amazon.com> --------- Signed-off-by: Darshit Chanpura <dchanp@amazon.com> Signed-off-by: Darshit Chanpura <35282393+DarshitChanpura@users.noreply.github.com> Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Updates Node start to now pass localNode info so that it is available directly to a plugin instead of hack-y implementation
This deficit was encountered while trying to solve opensearch-project/security#2724 which required localNode information in order to check whether the intercepted requests were for/from localNode.
The approaches tried:
getLocalNode()
<- fails with AssertionError stating that the calling class is not an instance of ClusterStateObserver.onNodeStarted()
implementation <- doesn't contain any value.And so with recommendation from @reta , implemented this approach.
Related Issues
opensearch-project/security#2724
Check List
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.