-
Notifications
You must be signed in to change notification settings - Fork 283
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
Settings migration to Opensearch #1176
Settings migration to Opensearch #1176
Conversation
29b0021
to
1c8773b
Compare
4be5f42
to
1c8773b
Compare
.github/workflows/ci.yml
Outdated
@@ -45,7 +45,7 @@ jobs: | |||
|
|||
- name: Build OpenSearch | |||
working-directory: ./OpenSearch | |||
run: ./gradlew publishToMavenLocal -Dbuild.snapshot=false | |||
run: ./gradlew publishToMavenLocal -Dbuild.version_qualifier=beta1 -Dbuild.snapshot=false |
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.
-rc1
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.
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.
The problem was introduced in #1174 that removes qualifier but does not update pom dependency. I wonder how that PR was tested and approved.
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.
This works here because you have hardcoded beta1 in pom.xml for the OpenSearch dependency. See opensearch-project/OpenSearch#762 (comment).
Change this to be rc1, and update your code to say rc1 instead beta1 everywhere you find "beta1".
These qualifiers don't do anything in the build as long as they are consistent so that the dependency on OpenSearch can be resolved, but in order for the plugin to start the version of the engine and the plugin will have to match, and the next version is rc1.
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.
This works here because you have hardcoded beta1 in pom.xml for the OpenSearch dependency. See opensearch-project/OpenSearch#762 (comment).
@dblock I guess you refer to CI, but it works only because maven artifacts are cached:
security/.github/workflows/ci.yml
Line 32 in 5a81a42
- name: Cache Maven packages |
These qualifiers don't do anything in the build as long as they are consistent so that the dependency on OpenSearch can be resolved, but in order for the plugin to start the version of the engine and the plugin will have to match, and the next version is rc1.
If rc1
does not correspond to a commit/tag in Opensearch, why is it used? If plugins are supposed to be built against the latest commit of 1.x branch, it should use SNAPSHOT
(this is the meaning of SNAPSHOT
), not an rc1
tag/qualifier.
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.
Yes re: cached maven artifacts, I didn't see that, should probably be removed now
You're right on rc1. If we had Maven we would be able to say exactly what you're building against, which could be an rc1 eventually. Right now if you called everything -SNAPSHOT you wouldn't have a way to rename that to rc1 because it would need a change in code. I think we need to fix opensearch-project/OpenSearch#763 first, then we can undo this craziness. It's just a workaround to produce something called -rc1
everywhere.
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.
Yes re: cached maven artifacts, I didn't see that, should probably be removed now
Caching maven artifacts should not be removed, it works as designed to speed up security plugin build and avoid loading artifacts from maven on each build. What should be removed is using CI to build and publish Opensearch artifacts to local maven repo.
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.
You can be right, or you can prevent a similar problem from happening in the short term. Your call.
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.
Similar problems should be prevented by testing and PR review, not by removing what worked before and is not broken. Even if caching is removed, what prevents CI of using wrong branch/tag and naming it beta1
or rc1
?
Codecov Report
@@ Coverage Diff @@
## main #1176 +/- ##
=========================================
Coverage 64.57% 64.57%
+ Complexity 3173 3172 -1
=========================================
Files 244 244
Lines 17125 17123 -2
Branches 3036 3035 -1
=========================================
- Hits 11059 11058 -1
+ Misses 4522 4520 -2
- Partials 1544 1545 +1
Continue to review full report at Codecov.
|
70e52a4
to
4fd9998
Compare
Was this PR tested for backward compatibility during rolling upgrade from ODFE distribution? |
@vrozov Can you specify more about this? |
Unlikely because opensearch-project/OpenSearch#669 prevents this altogether rn. |
src/test/resources/auditlog/endpoints/sink/configuration_all_variants.yml
Show resolved
Hide resolved
src/test/resources/auditlog/endpoints/sink/configuration_all_variants.yml
Show resolved
Hide resolved
I highly doubt that even after fixing opensearch-project/OpenSearch#669, it will work in clusters where security plugin is installed and enabled. The PR introduces backward incompatible changes. |
Can you point out the backward incompatible changes? This code is compatible for the old |
…ix in InitializationIntegrationTests
4fd9998
to
2e5034d
Compare
+1 @vrozov if there are more changes to be taken care of could you list them down on an issue? |
@andy840314 The change impacts not only settings, but also inter node communication (for example headers). I am not in position to point to all possible backward incompatible changes, so was my request to extensively test those changes. @saratvemulapalli those are specific to the security plugin, plus it may impact few other plugins that pass info to the security plugin using thread context. |
Actually, only the variable name for those constant are changed. |
ConfigConstants.OPENDISTRO_SECURITY_COMPLIANCE_HISTORY_WRITE_LOG_DIFFS, | ||
ConfigConstants.OPENDISTRO_SECURITY_COMPLIANCE_HISTORY_WRITE_IGNORE_USERS, | ||
ConfigConstants.OPENDISTRO_SECURITY_COMPLIANCE_HISTORY_WRITE_WATCHED_INDICES | ||
ConfigConstants.SECURITY_AUDIT_ENABLE_REST, |
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.
This introduces new key and immediately deprecates it. All those keys are already deprecated and should not be migrated to new keys.
These changes will split into different PR as discussed. |
opendistro-for-elasticsearch/security pull request intake form
Please provide as much details as possible to get feedback/acceptance on your PR quickly
Category: (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
Refactoring
Github Issue # or road-map entry, if available:
Description of changes:
Several files to be modified
OpenSearchSecurityPlugin
(security/src/main/java/com/amazon/opendistroforelasticsearch/security/OpenDistroSecurityPlugin.java
Line 858 in f698fe6
OpenSearchSecuritySSLPlugin
(security/src/main/java/com/amazon/opendistroforelasticsearch/security/ssl/OpenDistroSecuritySSLPlugin.java
Line 318 in f698fe6
Change
getSettings()
to add settings fromSecuritySettings
/SSLSecuritySettings
instead of add settings directly. e.g.settings.add(Setting.boolSetting(ConfigConstants.SECURITY_SSL_ONLY, ...));
→settings.add(SecuritySettings.SECURITY_SSL_ONLY)
;All files that uses
ConfigConstants
andSSLConfigConstants
:Remove prefix
OPENDISTRO_
All files that contains
opendistro_security
string for settings for several test files):Change
opendistro_security
toplugins.security
6 files to be added
ConfigConstants.java
:Copy and modify file
LegacyOpenDistroConfigConstants.java
. Change any string that containsopendistro_security
toplugins.security
, remove prefixOPENDISTRO_
for variable names.SecuritySettings.java
:New class for settings. Use
LegacyOpenDistroSecuritySettings
as fallbackSetting to ensure backward compatibility for opendistroLegacyOpenDistroSecuritySettings.java
New class for legacy settings. Define the default value for settings here.
SSLConfigConstants.java
:Copy and modify file
LegacyOpenDistroSSLConfigConstants.java
. Change any string that containsopendistro_security
toplugins.security
, remove prefixOPENDISTRO_
for variable names.SSLSecuritySettings.java
:New class for SSL settings. Use
LegacyOpenDistroSSLSecuritySettings
as fallbackSetting to ensure backward compatibility for opendistroLegacyOpenDistroSSLSecuritySettings.java
:New class for legacy SSL settings, Define the default value for SSL settings here.
2 files name changed
ConfigConstants.java
→LegacyOpenDistroConfigConstants.java
SSLConfigConstants.java
→LegacyOpenDistroSSLConfigConstants.java
1 test file added
SecuritySettingTests.java
Why these changes are required?
Settings rename and backward compatibility for OpenDistro
What is the old behavior before changes and new behavior after changes? (Please add any example/logs/screen-shot if available)
Testing done: (Please provide details of testing done: Unit testing, integration testing and manual testing)
Unit tests
TO-DOs, if any: (Please describe pending items and provide Github issues# for each of them)
Is it backport from main branch? (If yes, please add backport PR # and commits #)
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
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.