Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
wntmddus authored Jan 7, 2025
2 parents 174cd04 + 3db0eaf commit da3053b
Show file tree
Hide file tree
Showing 30 changed files with 183 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @bowenlan-amzn @Hailong-am @vikasvb90
* @bowenlan-amzn @Hailong-am @vikasvb90 @tandonks @shiv0408 @soosinha
13 changes: 6 additions & 7 deletions .github/workflows/multi-node-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
push:
branches:
- "**"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -35,25 +33,26 @@ jobs:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: 21
# index-management
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run integration tests with multi node config
run: |
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "./gradlew integTest -PnumNodes=3 ${{ env.TEST_FILTER }}"
- name: Upload failed logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/security-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
push:
branches:
- "**"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand All @@ -24,25 +22,26 @@ jobs:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: 21
# index-management
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Run integration tests
run: |
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "./gradlew integTest -Dsecurity=true -Dhttps=true --tests '*IT'"
- name: Upload failed logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: logs
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ on:
push:
branches:
- "**"
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
Get-CI-Image-Tag:
Expand Down Expand Up @@ -36,19 +34,20 @@ jobs:
# using the same image which is used by opensearch-build team to build the OpenSearch Distribution
# this image tag is subject to change as more dependencies and updates will arrive over time
image: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
# need to switch to root so that github actions can install runner binary on container without permission issues.
options: --user root
options: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}

steps:
- name: Run start commands
run: ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}
# build index management
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4
# This is a hack, but this step creates a link to the X: mounted drive, which makes the path
# short enough to work on Windows
- name: Build with Gradle
Expand All @@ -61,18 +60,19 @@ jobs:
with:
name: logs-${{ matrix.java }}-${{ matrix.feature }}
path: build/testclusters/integTest-*/logs/*
overwrite: 'true'
- name: Create Artifact Path
run: |
mkdir -p index-management-artifacts
cp ./build/distributions/*.zip index-management-artifacts
- name: Uploads coverage
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
# This step uses the upload-artifact Github action: https://github.com/actions/upload-artifact
- name: Upload Artifacts
# v4 requires node.js 20 which is not supported
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: index-management-plugin-ubuntu-latest-${{ matrix.java }}
path: index-management-artifacts
Expand Down Expand Up @@ -106,13 +106,13 @@ jobs:
steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
uses: actions/setup-java@v4
with:
distribution: temurin # Temurin is a distribution of adoptium
java-version: ${{ matrix.java }}
# build index management
- name: Checkout Branch
uses: actions/checkout@v2
uses: actions/checkout@v4
# This is a hack, but this step creates a link to the X: mounted drive, which makes the path
# short enough to work on Windows
- name: Shorten Path
Expand Down
3 changes: 3 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
| Vikas Bansal | [vikasvb90](https://github.com/vikasvb90) | Amazon |
| Bowen Lan | [bowenlan-amzn](https://github.com/bowenlan-amzn) | Amazon |
| Hailong Cui | [Hailong-am](https://github.com/Hailong-am) | Amazon |
| Kshitij Tandon | [tandonks](https://github.com/tandonks) | Amazon |
| Shivansh Arora | [shiv0408](https://github.com/shiv0408) | Amazon |
| Sooraj Sinha | [soosinha](https://github.com/soosinha) | Amazon |

## Emeritus

Expand Down
29 changes: 21 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ buildscript {
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.7"
classpath "org.jacoco:org.jacoco.agent:0.8.10"
}
}

plugins {
id "com.netflix.nebula.ospackage" version "11.5.0"
id "de.undercouch.download" version "5.3.0"
id "com.netflix.nebula.ospackage" version "11.10.1"
id "com.dorongold.task-tree" version "2.1.1"
}

Expand Down Expand Up @@ -189,6 +190,18 @@ tasks.named('forbiddenApisTest').configure {

ext {
projectSubstitutions = [:]

['esnode.pem', 'esnode-key.pem', 'kirk.pem', 'kirk-key.pem', 'root-ca.pem', 'sample.pem', 'test-kirk.jks'].forEach { file ->
File local = getLayout().getBuildDirectory().file(file).get().getAsFile()
download.run {
src "https://raw.githubusercontent.com/opensearch-project/security/refs/heads/main/bwc-test/src/test/resources/security/" + file
dest local
overwrite false
}
processResources {
from(local)
}
}
}

allprojects {
Expand All @@ -209,7 +222,7 @@ dependencies {
implementation "org.jetbrains:annotations:13.0"
implementation project(path: ":${rootProject.name}-spi", configuration: 'shadow')
implementation "org.opensearch:common-utils:${common_utils_version}"
implementation "com.github.seancfoley:ipaddress:5.4.1"
implementation "com.github.seancfoley:ipaddress:5.5.1"
implementation "commons-codec:commons-codec:${versions.commonscodec}"
implementation "org.apache.httpcomponents:httpclient:${versions.httpclient}"
implementation "org.apache.httpcomponents:httpcore:${versions.httpcore}"
Expand Down Expand Up @@ -342,11 +355,11 @@ afterEvaluate {
plugins.add(firstPlugin)

if (securityEnabled) {
node.extraConfigFile("kirk.pem", file("src/test/resources/security/kirk.pem"))
node.extraConfigFile("kirk-key.pem", file("src/test/resources/security/kirk-key.pem"))
node.extraConfigFile("esnode.pem", file("src/test/resources/security/esnode.pem"))
node.extraConfigFile("esnode-key.pem", file("src/test/resources/security/esnode-key.pem"))
node.extraConfigFile("root-ca.pem", file("src/test/resources/security/root-ca.pem"))
node.extraConfigFile("kirk.pem", file("build/resources/main/kirk.pem"))
node.extraConfigFile("kirk-key.pem", file("build/resources/main/kirk-key.pem"))
node.extraConfigFile("esnode.pem", file("build/resources/main/esnode.pem"))
node.extraConfigFile("esnode-key.pem", file("build/resources/main/esnode-key.pem"))
node.extraConfigFile("root-ca.pem", file("build/resources/main/root-ca.pem"))
node.setting("plugins.security.ssl.transport.pemcert_filepath", "esnode.pem")
node.setting("plugins.security.ssl.transport.pemkey_filepath", "esnode-key.pem")
node.setting("plugins.security.ssl.transport.pemtrustedcas_filepath", "root-ca.pem")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,27 @@ constructor(
updateSettingReqsList.add(
UpdateSettingsRequest().indices(*readOnlyIndices.map { indices[it] }.toTypedArray())
.settings(
Settings.builder().put(ManagedIndexSettings.AUTO_MANAGE.key, false)
.put(INDEX_READ_ONLY_SETTING.key, true),
Settings.builder().put(INDEX_READ_ONLY_SETTING.key, false),
),
)
updateSettingReqsList.add(
UpdateSettingsRequest().indices(*readOnlyIndices.map { indices[it] }.toTypedArray())
.settings(
Settings.builder().put(ManagedIndexSettings.AUTO_MANAGE.key, false).put(INDEX_READ_ONLY_SETTING.key, true),
),
)
}
if (readOnlyAllowDeleteIndices.isNotEmpty()) {
updateSettingReqsList.add(
UpdateSettingsRequest().indices(*readOnlyAllowDeleteIndices.map { indices[it] }.toTypedArray())
.settings(
Settings.builder().put(ManagedIndexSettings.AUTO_MANAGE.key, false)
.put(INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.key, true),
Settings.builder().put(INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.key, false),
),
)
updateSettingReqsList.add(
UpdateSettingsRequest().indices(*readOnlyAllowDeleteIndices.map { indices[it] }.toTypedArray())
.settings(
Settings.builder().put(ManagedIndexSettings.AUTO_MANAGE.key, false).put(INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.key, true),
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,30 @@

package org.opensearch.indexmanagement.rollup.action.start

import org.opensearch.action.ActionRequest
import org.opensearch.action.ActionRequestValidationException
import org.opensearch.action.ValidateActions.addValidationError
import org.opensearch.action.update.UpdateRequest
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.core.common.io.stream.StreamOutput
import java.io.IOException

class StartRollupRequest : UpdateRequest {
class StartRollupRequest : ActionRequest {

val id: String
get() = field

@Throws(IOException::class)
constructor(sin: StreamInput) : super(sin)
constructor(sin: StreamInput) : super(sin) {
this.id = sin.readString()
}

constructor(id: String) {
super.id(id)
this.id = id
}

override fun validate(): ActionRequestValidationException? {
var validationException: ActionRequestValidationException? = null
if (super.id().isEmpty()) {
if (this.id.isEmpty()) {
validationException = addValidationError("id is missing", validationException)
}
return validationException
Expand All @@ -31,5 +37,6 @@ class StartRollupRequest : UpdateRequest {
@Throws(IOException::class)
override fun writeTo(out: StreamOutput) {
super.writeTo(out)
out.writeString(id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.opensearch.commons.authuser.User
import org.opensearch.core.action.ActionListener
import org.opensearch.core.rest.RestStatus
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.indexmanagement.IndexManagementPlugin
import org.opensearch.indexmanagement.IndexManagementPlugin.Companion.INDEX_MANAGEMENT_INDEX
import org.opensearch.indexmanagement.opensearchapi.parseWithType
import org.opensearch.indexmanagement.rollup.model.Rollup
Expand Down Expand Up @@ -70,7 +71,7 @@ constructor(
ConfigConstants.OPENSEARCH_SECURITY_USER_INFO_THREAD_CONTEXT,
)}",
)
val getReq = GetRequest(INDEX_MANAGEMENT_INDEX, request.id())
val getReq = GetRequest(INDEX_MANAGEMENT_INDEX, request.id)
val user: User? = buildUser(client.threadPool().threadContext)
client.threadPool().threadContext.stashContext().use {
client.get(
Expand Down Expand Up @@ -115,7 +116,8 @@ constructor(
// TODO: Should create a transport action to update metadata
private fun updateRollupJob(rollup: Rollup, request: StartRollupRequest, actionListener: ActionListener<AcknowledgedResponse>) {
val now = Instant.now().toEpochMilli()
request.index(INDEX_MANAGEMENT_INDEX).doc(
val updateReq = UpdateRequest(IndexManagementPlugin.INDEX_MANAGEMENT_INDEX, request.id)
updateReq.doc(
mapOf(
Rollup.ROLLUP_TYPE to
mapOf(
Expand All @@ -125,7 +127,7 @@ constructor(
),
)
client.update(
request,
updateReq,
object : ActionListener<UpdateResponse> {
override fun onResponse(response: UpdateResponse) {
if (response.result == DocWriteResponse.Result.UPDATED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,30 @@

package org.opensearch.indexmanagement.rollup.action.stop

import org.opensearch.action.ActionRequest
import org.opensearch.action.ActionRequestValidationException
import org.opensearch.action.ValidateActions.addValidationError
import org.opensearch.action.update.UpdateRequest
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.core.common.io.stream.StreamOutput
import java.io.IOException

class StopRollupRequest : UpdateRequest {
class StopRollupRequest : ActionRequest {

val id: String
get() = field

@Throws(IOException::class)
constructor(sin: StreamInput) : super(sin)
constructor(sin: StreamInput) : super(sin) {
this.id = sin.readString()
}

constructor(id: String) {
super.id(id)
this.id = id
}

override fun validate(): ActionRequestValidationException? {
var validationException: ActionRequestValidationException? = null
if (super.id().isEmpty()) {
if (this.id.isEmpty()) {
validationException = addValidationError("id is missing", validationException)
}
return validationException
Expand All @@ -31,5 +37,6 @@ class StopRollupRequest : UpdateRequest {
@Throws(IOException::class)
override fun writeTo(out: StreamOutput) {
super.writeTo(out)
out.writeString(id)
}
}
Loading

0 comments on commit da3053b

Please sign in to comment.