From 1e9dc4ee555cde3cbd6b040d6e3250f6aa9e2fe1 Mon Sep 17 00:00:00 2001 From: Sarat Vemulapalli Date: Thu, 2 Feb 2023 12:35:11 -0800 Subject: [PATCH] Add support for minimum compatible version for Extensions and OpenSearch (#365) * Updating extensions config file Signed-off-by: Sarat Vemulapalli * Updating with new ExtensionNode class def Signed-off-by: Sarat Vemulapalli * Updating docs Signed-off-by: Sarat Vemulapalli * Addressing comments Signed-off-by: Sarat Vemulapalli * Adding more changes Signed-off-by: Sarat Vemulapalli --------- Signed-off-by: Sarat Vemulapalli --- DESIGN.md | 9 ++++++--- DEVELOPER_GUIDE.md | 7 +------ .../java/org/opensearch/sdk/TestExtensionsRunner.java | 7 ++----- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index ac69e1b2..130be287 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -46,12 +46,11 @@ Here is an example extension configuration `extensions.yml`: extensions: - name: sample-extension // extension name uniqueId: opensearch-sdk-1 // identifier for the extension - hostName: 'sdk_host' // name of the host where extension is running hostAddress: '127.0.0.1' // host to reach port: '4532' // port to reach version: '1.0' // extension version - description: Extension for the Opensearch SDK Repo // description of the extension - opensearchVersion: '3.0.0' // OpenSearch compatibility + opensearchVersion: '3.0.0' // Compiled with OpenSearch version + minimumCompatibleVersion: '3.0.0' // Minimum version of OpenSearch the extension is wire compatible with ``` ### Communication @@ -74,6 +73,10 @@ The sequence diagram below shows the process of initializing an Extension, regis The `org.opensearch.sdk.sample` package contains a sample `HelloWorldExtension` implementing the below steps. It is executed following the steps in the [`DEVELOPER_GUIDE`](DEVELOPER_GUIDE.md). +#### Wire Compatibility + +Extensions will be wire compatible across minor and patch versions. The configuration contains `minimumCompatibleVersion` which is validated by ExtensionsManager in OpenSearch. + #### Extension REST Actions Walk Through ![](Docs/ExtensionRestActions.svg) diff --git a/DEVELOPER_GUIDE.md b/DEVELOPER_GUIDE.md index 12a4062f..cc52fd64 100644 --- a/DEVELOPER_GUIDE.md +++ b/DEVELOPER_GUIDE.md @@ -102,16 +102,11 @@ A sample `extensions.yml` file is shown below. The `uniqueId` will be used in RE extensions: - name: hello-world uniqueId: opensearch-sdk-java-1 - hostName: 'sdk_host' hostAddress: '127.0.0.1' port: '4532' version: '1.0' - description: Extension for the Opensearch SDK Repo opensearchVersion: '3.0.0' - javaVersion: '14' - className: ExtensionsRunner - customFolderName: opensearch-sdk-java - hasNativeController: false + minimumCompatibleVersion: '3.0.0' ``` #### Run OpenSearch diff --git a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java index 1d7f0433..24333bf0 100644 --- a/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java +++ b/src/test/java/org/opensearch/sdk/TestExtensionsRunner.java @@ -111,13 +111,10 @@ public void testHandleExtensionInitRequest() throws UnknownHostException { DiscoveryExtensionNode extension = new DiscoveryExtensionNode( EXTENSION_NAME, "opensearch-sdk-1", - "", - "", - "", sourceNode.getAddress(), new HashMap(), - null, - null, + Version.fromString("3.0.0"), + Version.fromString("3.0.0"), new ArrayList() );