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 #1584

Merged

Conversation

cwperks
Copy link
Member

@cwperks cwperks commented Jun 21, 2024

Issue #, if available:

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.

Related to: opensearch-project/security#4439

CheckList:

  • Commits are signed per the DCO using --signoff

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.

@@ -117,6 +117,8 @@ class AlertIndices(
/** The in progress alert history index. */
const val ALERT_INDEX = ".opendistro-alerting-alerts"

const val ALERT_CONFIG_INDEX = ".opendistro-alerting-config"
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this here because I see it in the security repo, but I'm not able to find references to it in this repo. Where is this index declared and how is it used in the alerting plugin?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @bowenlan-amzn! I updated the PR to refer to this constant.

cwperks added 5 commits June 21, 2024 15:24
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
Signed-off-by: Craig Perkins <[email protected]>
@cwperks
Copy link
Member Author

cwperks commented Jul 2, 2024

@bowenlan-amzn Can this be merged?

@bowenlan-amzn
Copy link
Member

@cwperks I notice there's one test failure

REPRODUCE WITH: ./gradlew ':alerting:integTest' --tests "org.opensearch.alerting.DocumentMonitorRunnerIT.test execute monitor generates alerts and findings with per alert execution for actions" -Dtests.seed=E48D87D2E1142E72 -Dtests.security.manager=false -Dtests.locale=ta-IN -Dtests.timezone=Pacific/Niue -Druntime.java=17

org.opensearch.alerting.DocumentMonitorRunnerIT > test execute monitor generates alerts and findings with per alert execution for actions FAILED
    org.opensearch.client.WarningFailureException: method [POST], host [http://[::1]:43439], URI [/_refresh?expand_wildcards=open%2Chidden], status line [HTTP/1.1 200 OK]
    Warnings: [this request accesses system indices: [.opendistro-alerting-alert-history-2024.07.02-1], but in a future major version, direct access to system indices will be prevented by default, this request accesses system indices: [.opendistro-alerting-alerts], but in a future major version, direct access to system indices will be prevented by default, this request accesses system indices: [.opensearch-notifications-config], but in a future major version, direct access to system indices will be prevented by default]
    {"_shards":{"total":15,"successful":13,"failed":0}}
        at __randomizedtesting.SeedInfo.seed([E48D87D2E1142E72:1A6999FE631E4BFA]:0)
        at app//org.opensearch.client.RestClient.convertResponse(RestClient.java:381)
        at app//org.opensearch.client.RestClient.performRequest(RestClient.java:355)
        at app//org.opensearch.client.RestClient.performRequest(RestClient.java:330)
        at app//org.opensearch.test.rest.OpenSearchRestTestCase.refreshAllIndices(OpenSearchRestTestCase.java:718)
        at app//org.opensearch.alerting.DocumentMonitorRunnerIT.test execute monitor generates alerts and findings with per alert execution for actions(DocumentMonitorRunnerIT.kt:687)

can you fix this? probably a common problem, not sure if the refreshAllIndices method needs to be updated
https://github.com/opensearch-project/OpenSearch/blob/a1faafed3ad88dd8f863e40766b7f035df0ed99b/test/framework/src/main/java/org/opensearch/test/rest/OpenSearchRestTestCase.java#L706-L716

@cwperks
Copy link
Member Author

cwperks commented Jul 3, 2024

@bowenlan-amzn looking into it. I will get back shortly.

@cwperks
Copy link
Member Author

cwperks commented Jul 3, 2024

@bowenlan-amzn I get the same test failure when I revert this change. That message is a warning.

I was getting a ktlint error. The test passes with this change reverted.

@cwperks
Copy link
Member Author

cwperks commented Jul 3, 2024

FYI I see another error as well. Does this need to be addressed?

» ERROR][o.o.a.t.TransportDocLevelMonitorFanOutAction] [integTest-0] Optional finding callback failed
»  java.lang.IllegalStateException: failed to find action [org.opensearch.action.ActionType@de1e9751] to execute
»       at org.opensearch.client.node.NodeClient.transportAction(NodeClient.java:147) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:112) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:99) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:482) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.commons.alerting.AlertingPluginInterface.publishFinding(AlertingPluginInterface.kt:258) ~[common-utils-3.0.0.0-SNAPSHOT.jar:?]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.publishFinding(TransportDocLevelMonitorFanOutAction.kt:562) ~[opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.createFindings(TransportDocLevelMonitorFanOutAction.kt:525) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.access$createFindings(TransportDocLevelMonitorFanOutAction.kt:133) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction$createFindings$1.invokeSuspend(TransportDocLevelMonitorFanOutAction.kt) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.8.21.jar:1.8.21-release-380(1.8.21)]
»       at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]
» WARN ][o.o.n.i.NotificationConfigIndex] [integTest-0] notifications:getNotificationConfig - jl_ueJABFEYUG2kq6hJI not found; response:{"_index":".opensearch-notifications-config","_id":"jl_ueJABFEYUG2kq6hJI","found":false}

@cwperks
Copy link
Member Author

cwperks commented Jul 3, 2024

@bowenlan-amzn I opened up a PR in core to address this: opensearch-project/OpenSearch#14635

@bowenlan-amzn
Copy link
Member

@cwperks commented on Jul 3, 2024, 7:33 AM PDT:

FYI I see another error as well. Does this need to be addressed?

» ERROR][o.o.a.t.TransportDocLevelMonitorFanOutAction] [integTest-0] Optional finding callback failed
»  java.lang.IllegalStateException: failed to find action [org.opensearch.action.ActionType@de1e9751] to execute
»       at org.opensearch.client.node.NodeClient.transportAction(NodeClient.java:147) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.node.NodeClient.executeLocally(NodeClient.java:112) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.node.NodeClient.doExecute(NodeClient.java:99) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.client.support.AbstractClient.execute(AbstractClient.java:482) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»       at org.opensearch.commons.alerting.AlertingPluginInterface.publishFinding(AlertingPluginInterface.kt:258) ~[common-utils-3.0.0.0-SNAPSHOT.jar:?]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.publishFinding(TransportDocLevelMonitorFanOutAction.kt:562) ~[opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.createFindings(TransportDocLevelMonitorFanOutAction.kt:525) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction.access$createFindings(TransportDocLevelMonitorFanOutAction.kt:133) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at org.opensearch.alerting.transport.TransportDocLevelMonitorFanOutAction$createFindings$1.invokeSuspend(TransportDocLevelMonitorFanOutAction.kt) [opensearch-alerting-3.0.0.0-SNAPSHOT.jar:3.0.0.0-SNAPSHOT]
»       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) [kotlin-stdlib-1.8.21.jar:1.8.21-release-380(1.8.21)]
»       at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) [kotlinx-coroutines-core-1.1.1.jar:?]
»       at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) [kotlinx-coroutines-core-1.1.1.jar:?]
» WARN ][o.o.n.i.NotificationConfigIndex] [integTest-0] notifications:getNotificationConfig - jl_ueJABFEYUG2kq6hJI not found; response:{"_index":".opensearch-notifications-config","_id":"jl_ueJABFEYUG2kq6hJI","found":false}

If this is not causing a test to fail, it should be fine for now.

@bowenlan-amzn bowenlan-amzn merged commit a5bdc23 into opensearch-project:main Jul 3, 2024
16 of 19 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 3, 2024
…IndexDescriptors (#1584)

(cherry picked from commit a5bdc23)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
jowg-amazon pushed a commit that referenced this pull request Jul 17, 2024
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.

4 participants