-
Notifications
You must be signed in to change notification settings - Fork 56
Onboards flow-framework plugin to resource-sharing and access control framework #1251
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
base: main
Are you sure you want to change the base?
Changes from all commits
72da7b3
dc16660
6937e06
69009e6
bd13659
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,7 @@ opensearchplugin { | |
classname = "${projectPath}.${pathToPlugin}.${pluginClassName}" | ||
licenseFile = rootProject.file('LICENSE') | ||
noticeFile = rootProject.file('NOTICE') | ||
extendedPlugins = ['opensearch-security;optional=true'] | ||
} | ||
|
||
dependencyLicenses.enabled = false | ||
|
@@ -195,6 +196,9 @@ configurations { | |
} | ||
|
||
dependencies { | ||
// For resource access control | ||
compileOnly group: 'org.opensearch', name:'opensearch-security-spi', version:"3.4.0-SNAPSHOT" | ||
|
||
implementation("org.opensearch:opensearch:${opensearch_version}") | ||
api("org.opensearch:opensearch-ml-client:${opensearch_build}") | ||
// json, jsonpath, and commons-text are required by MLClient but must be provided by calling plugins | ||
|
@@ -252,6 +256,8 @@ dependencies { | |
testImplementation("org.junit.jupiter:junit-jupiter:${junitJupiterVersion}") | ||
testImplementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson_databind}") | ||
|
||
testImplementation 'org.awaitility:awaitility:4.3.0' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Constant for the version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack. |
||
|
||
// ZipArchive dependencies used for integration tests | ||
zipArchive("org.opensearch.plugin:opensearch-job-scheduler:${opensearch_build}") | ||
zipArchive("org.opensearch.plugin:opensearch-ml-plugin:${opensearch_build}") | ||
|
@@ -347,6 +353,8 @@ integTest { | |
systemProperty('user', user) | ||
systemProperty('password', password) | ||
|
||
systemProperty "resource_sharing.enabled", System.getProperty("resource_sharing.enabled") | ||
|
||
// Only tenant aware test if set | ||
if (System.getProperty("tests.rest.tenantaware") == "true") { | ||
filter { | ||
|
@@ -506,6 +514,10 @@ testClusters.integTest { | |
'".plugins-flow-framework-state"' + | ||
']' | ||
) | ||
if (System.getProperty("resource_sharing.enabled") == "true") { | ||
setting("plugins.security.experimental.resource_sharing.enabled", "true") | ||
setting("plugins.security.experimental.resource_sharing.protected_types", "[\"workflow\", \"workflow_state\"]") | ||
} | ||
setSecure(true) | ||
} | ||
|
||
|
@@ -538,7 +550,13 @@ testClusters.integTest { | |
if (System.getProperty("opensearch.debug") != null) { | ||
def debugPort = 5005 | ||
nodes.forEach { node -> | ||
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=*:${debugPort}") | ||
// server=n,suspend=y -> node tries to connect to a debugger and hence test runs fails with | ||
// Exec output and error: | ||
// | Output for ./bin/opensearch-plugin:ERROR: transport error 202: connect failed: Connection refused | ||
// | ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510) | ||
// | JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:700]. | ||
// So instead, we listen to a debugger by saying server=y and suspend=n | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove the comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, let's keep it to understand what these changes mean. |
||
node.jvmArgs("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:${debugPort}") | ||
debugPort += 1 | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
package org.opensearch.flowframework; | ||
|
||
import org.opensearch.flowframework.common.CommonValue; | ||
import org.opensearch.flowframework.util.ResourceSharingClientAccessor; | ||
import org.opensearch.security.spi.resources.ResourceProvider; | ||
import org.opensearch.security.spi.resources.ResourceSharingExtension; | ||
import org.opensearch.security.spi.resources.client.ResourceSharingClient; | ||
|
||
import java.util.Set; | ||
|
||
import static org.opensearch.flowframework.common.CommonValue.GLOBAL_CONTEXT_INDEX; | ||
import static org.opensearch.flowframework.common.CommonValue.WORKFLOW_STATE_INDEX; | ||
|
||
public class FlowFrameworkResourceSharingExtension implements ResourceSharingExtension { | ||
@Override | ||
public Set<ResourceProvider> getResourceProviders() { | ||
return Set.of( | ||
new ResourceProvider(CommonValue.WORKFLOW_RESOURCE_TYPE, GLOBAL_CONTEXT_INDEX), | ||
new ResourceProvider(CommonValue.WORKFLOW_STATE_RESOURCE_TYPE, WORKFLOW_STATE_INDEX) | ||
); | ||
} | ||
|
||
@Override | ||
public void assignResourceSharingClient(ResourceSharingClient resourceSharingClient) { | ||
ResourceSharingClientAccessor.getInstance().setResourceSharingClient(resourceSharingClient); | ||
} | ||
} |
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.
Can we fetch the version from the variable?
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, once main branch has the version bumped I'll revert it.
i explicitly set it in last commit: 69009e6