Skip to content
Merged
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ ext {
}

group = "org.opensearch"
version = "${opensearchVersion}.0-beta1"
version = "${opensearchVersion}.0-rc1"

dependencies {
compileOnly "org.opensearch:opensearch:${opensearch_version}"
compileOnly "org.opensearch:opensearch-job-scheduler-spi:1.0.0.0-beta1"
compileOnly "org.opensearch:opensearch-job-scheduler-spi:1.0.0.0-rc1"
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
compile "org.jetbrains:annotations:13.0"
compile "org.opensearch:notification:1.0.0.0-beta1"
compile "org.opensearch:common-utils:1.0.0.0-beta1"
compile "org.opensearch:common-utils:1.0.0.0-rc1"
compile "com.github.seancfoley:ipaddress:5.3.3"

testCompile "org.opensearch.test:framework:${opensearch_version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,12 @@ import org.opensearch.common.component.Lifecycle
import org.opensearch.common.component.LifecycleComponent
import org.opensearch.common.component.LifecycleListener
import org.opensearch.common.inject.Inject
import org.opensearch.indexmanagement.indexstatemanagement.settings.LegacyOpenDistroManagedIndexSettings
import org.opensearch.indexmanagement.rollup.settings.LegacyOpenDistroRollupSettings
import org.opensearch.transport.RemoteClusterService
import org.opensearch.transport.TransportService

internal class IndexManagementPlugin : JobSchedulerExtension, NetworkPlugin, ActionPlugin, Plugin() {
class IndexManagementPlugin : JobSchedulerExtension, NetworkPlugin, ActionPlugin, Plugin() {

private val logger = LogManager.getLogger(javaClass)
lateinit var indexManagementIndices: IndexManagementIndices
Expand Down Expand Up @@ -323,7 +325,32 @@ internal class IndexManagementPlugin : JobSchedulerExtension, NetworkPlugin, Act
RollupSettings.ROLLUP_INDEX,
RollupSettings.ROLLUP_ENABLED,
RollupSettings.ROLLUP_SEARCH_ENABLED,
RollupSettings.ROLLUP_DASHBOARDS
RollupSettings.ROLLUP_DASHBOARDS,
LegacyOpenDistroManagedIndexSettings.HISTORY_ENABLED,
LegacyOpenDistroManagedIndexSettings.HISTORY_INDEX_MAX_AGE,
LegacyOpenDistroManagedIndexSettings.HISTORY_MAX_DOCS,
LegacyOpenDistroManagedIndexSettings.HISTORY_RETENTION_PERIOD,
LegacyOpenDistroManagedIndexSettings.HISTORY_ROLLOVER_CHECK_PERIOD,
LegacyOpenDistroManagedIndexSettings.HISTORY_NUMBER_OF_SHARDS,
LegacyOpenDistroManagedIndexSettings.HISTORY_NUMBER_OF_REPLICAS,
LegacyOpenDistroManagedIndexSettings.POLICY_ID,
LegacyOpenDistroManagedIndexSettings.ROLLOVER_ALIAS,
LegacyOpenDistroManagedIndexSettings.INDEX_STATE_MANAGEMENT_ENABLED,
LegacyOpenDistroManagedIndexSettings.METADATA_SERVICE_ENABLED,
LegacyOpenDistroManagedIndexSettings.JOB_INTERVAL,
LegacyOpenDistroManagedIndexSettings.SWEEP_PERIOD,
LegacyOpenDistroManagedIndexSettings.COORDINATOR_BACKOFF_COUNT,
LegacyOpenDistroManagedIndexSettings.COORDINATOR_BACKOFF_MILLIS,
LegacyOpenDistroManagedIndexSettings.ALLOW_LIST,
LegacyOpenDistroManagedIndexSettings.SNAPSHOT_DENY_LIST,
LegacyOpenDistroRollupSettings.ROLLUP_INGEST_BACKOFF_COUNT,
LegacyOpenDistroRollupSettings.ROLLUP_INGEST_BACKOFF_MILLIS,
LegacyOpenDistroRollupSettings.ROLLUP_SEARCH_BACKOFF_COUNT,
LegacyOpenDistroRollupSettings.ROLLUP_SEARCH_BACKOFF_MILLIS,
LegacyOpenDistroRollupSettings.ROLLUP_INDEX,
LegacyOpenDistroRollupSettings.ROLLUP_ENABLED,
LegacyOpenDistroRollupSettings.ROLLUP_SEARCH_ENABLED,
LegacyOpenDistroRollupSettings.ROLLUP_DASHBOARDS
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,21 @@ import org.opensearch.common.xcontent.XContentHelper
import org.opensearch.common.xcontent.XContentType
import org.opensearch.index.Index
import org.opensearch.index.IndexNotFoundException
import org.opensearch.indexmanagement.indexstatemanagement.settings.LegacyOpenDistroManagedIndexSettings

private val log = LogManager.getLogger("Index Management Helper")

/**
* Returns the current rollover_alias if it exists otherwise returns null.
*/
fun IndexMetadata.getRolloverAlias(): String? {
if (this.settings.get(ManagedIndexSettings.ROLLOVER_ALIAS.key).isNullOrBlank()) return null
if (this.settings.get(ManagedIndexSettings.ROLLOVER_ALIAS.key).isNullOrBlank()) {
return if (this.settings.get(LegacyOpenDistroManagedIndexSettings.ROLLOVER_ALIAS.key).isNullOrBlank()) {
null
} else {
this.settings.get(LegacyOpenDistroManagedIndexSettings.ROLLOVER_ALIAS.key)
}
}

return this.settings.get(ManagedIndexSettings.ROLLOVER_ALIAS.key)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
/*
* 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.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package org.opensearch.indexmanagement.indexstatemanagement.settings

import org.opensearch.common.settings.Setting
import org.opensearch.common.unit.TimeValue
import org.opensearch.indexmanagement.indexstatemanagement.model.action.ActionConfig
import java.util.concurrent.TimeUnit
import java.util.function.Function

class LegacyOpenDistroManagedIndexSettings {
companion object {
const val DEFAULT_ISM_ENABLED = true
const val DEFAULT_METADATA_SERVICE_ENABLED = true
const val DEFAULT_JOB_INTERVAL = 5
private val ALLOW_LIST_ALL = ActionConfig.ActionType.values().toList().map { it.type }
val ALLOW_LIST_NONE = emptyList<String>()
val SNAPSHOT_DENY_LIST_NONE = emptyList<String>()
const val HOST_DENY_LIST = "opendistro.destination.host.deny_list"

val INDEX_STATE_MANAGEMENT_ENABLED: Setting<Boolean> = Setting.boolSetting(
"opendistro.index_state_management.enabled",
DEFAULT_ISM_ENABLED,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val METADATA_SERVICE_ENABLED: Setting<Boolean> = Setting.boolSetting(
"opendistro.index_state_management.metadata_service.enabled",
DEFAULT_METADATA_SERVICE_ENABLED,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val POLICY_ID: Setting<String> = Setting.simpleString(
"index.opendistro.index_state_management.policy_id",
Setting.Property.IndexScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val ROLLOVER_ALIAS: Setting<String> = Setting.simpleString(
"index.opendistro.index_state_management.rollover_alias",
Setting.Property.IndexScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val JOB_INTERVAL: Setting<Int> = Setting.intSetting(
"opendistro.index_state_management.job_interval",
DEFAULT_JOB_INTERVAL,
1,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val SWEEP_PERIOD: Setting<TimeValue> = Setting.timeSetting(
"opendistro.index_state_management.coordinator.sweep_period",
TimeValue.timeValueMinutes(10),
TimeValue.timeValueMinutes(5),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val COORDINATOR_BACKOFF_MILLIS: Setting<TimeValue> = Setting.positiveTimeSetting(
"opendistro.index_state_management.coordinator.backoff_millis",
TimeValue.timeValueMillis(50),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val COORDINATOR_BACKOFF_COUNT: Setting<Int> = Setting.intSetting(
"opendistro.index_state_management.coordinator.backoff_count",
2,
0,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_ENABLED: Setting<Boolean> = Setting.boolSetting(
"opendistro.index_state_management.history.enabled",
true,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_MAX_DOCS: Setting<Long> = Setting.longSetting(
"opendistro.index_state_management.history.max_docs",
2500000L, // 1 doc is ~10kb or less. This many doc is roughly 25gb
0L,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_INDEX_MAX_AGE: Setting<TimeValue> = Setting.positiveTimeSetting(
"opendistro.index_state_management.history.max_age",
TimeValue.timeValueHours(24),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_ROLLOVER_CHECK_PERIOD: Setting<TimeValue> = Setting.positiveTimeSetting(
"opendistro.index_state_management.history.rollover_check_period",
TimeValue.timeValueHours(8),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_RETENTION_PERIOD: Setting<TimeValue> = Setting.positiveTimeSetting(
"opendistro.index_state_management.history.rollover_retention_period",
TimeValue(30, TimeUnit.DAYS),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_NUMBER_OF_SHARDS: Setting<Int> = Setting.intSetting(
"opendistro.index_state_management.history.number_of_shards",
1,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val HISTORY_NUMBER_OF_REPLICAS: Setting<Int> = Setting.intSetting(
"opendistro.index_state_management.history.number_of_replicas",
1,
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val ALLOW_LIST: Setting<List<String>> = Setting.listSetting(
"opendistro.index_state_management.allow_list",
ALLOW_LIST_ALL,
Function.identity(),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)

val SNAPSHOT_DENY_LIST: Setting<List<String>> = Setting.listSetting(
"opendistro.index_state_management.snapshot.deny_list",
SNAPSHOT_DENY_LIST_NONE,
Function.identity(),
Setting.Property.NodeScope,
Setting.Property.Dynamic,
Setting.Property.Deprecated
)
}
}
Loading