Skip to content

Commit

Permalink
Register system index descriptors through SystemIndexPlugin.getSystem…
Browse files Browse the repository at this point in the history
…IndexDescriptors (opensearch-project#1009)
  • Loading branch information
cwperks committed Jun 26, 2024
1 parent dd52913 commit 2f81773
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ testClusters.integTest {
}

// For job-scheduler and reports-scheduler, the latest opensearch releases appear to be 1.1.0.0.
String baseVersion = "2.15.0"
String baseVersion = "2.16.0"
String bwcVersion = baseVersion + ".0"
String baseName = "reportsSchedulerBwcCluster"
String bwcFilePath = "src/test/resources/bwc"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import org.opensearch.core.common.io.stream.NamedWriteableRegistry
import org.opensearch.core.xcontent.NamedXContentRegistry
import org.opensearch.env.Environment
import org.opensearch.env.NodeEnvironment
import org.opensearch.indices.SystemIndexDescriptor
import org.opensearch.jobscheduler.spi.JobSchedulerExtension
import org.opensearch.jobscheduler.spi.ScheduledJobParser
import org.opensearch.jobscheduler.spi.ScheduledJobRunner
import org.opensearch.plugins.ActionPlugin
import org.opensearch.plugins.Plugin
import org.opensearch.plugins.SystemIndexPlugin
import org.opensearch.reportsscheduler.action.CreateReportDefinitionAction
import org.opensearch.reportsscheduler.action.DeleteReportDefinitionAction
import org.opensearch.reportsscheduler.action.GetAllReportDefinitionsAction
Expand All @@ -38,6 +40,7 @@ import org.opensearch.reportsscheduler.action.UpdateReportInstanceStatusAction
import org.opensearch.reportsscheduler.index.ReportDefinitionsIndex
import org.opensearch.reportsscheduler.index.ReportDefinitionsIndex.REPORT_DEFINITIONS_INDEX_NAME
import org.opensearch.reportsscheduler.index.ReportInstancesIndex
import org.opensearch.reportsscheduler.index.ReportInstancesIndex.REPORT_INSTANCES_INDEX_NAME
import org.opensearch.reportsscheduler.resthandler.OnDemandReportRestHandler
import org.opensearch.reportsscheduler.resthandler.ReportDefinitionListRestHandler
import org.opensearch.reportsscheduler.resthandler.ReportDefinitionRestHandler
Expand All @@ -59,7 +62,7 @@ import java.util.function.Supplier
* Entry point of the OpenSearch Reports scheduler plugin.
* This class initializes the rest handlers.
*/
class ReportsSchedulerPlugin : Plugin(), ActionPlugin, JobSchedulerExtension {
class ReportsSchedulerPlugin : Plugin(), ActionPlugin, SystemIndexPlugin, JobSchedulerExtension {

companion object {
const val PLUGIN_NAME = "opensearch-reports-scheduler"
Expand All @@ -77,6 +80,13 @@ class ReportsSchedulerPlugin : Plugin(), ActionPlugin, JobSchedulerExtension {
return settingList
}

override fun getSystemIndexDescriptors(settings: Settings): Collection<SystemIndexDescriptor> {
return listOf(
SystemIndexDescriptor(REPORT_DEFINITIONS_INDEX_NAME, "Reports Scheduler Plugin Definitions index"),
SystemIndexDescriptor(REPORT_INSTANCES_INDEX_NAME, "Reports Scheduler Plugin Instances index")
)
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit
*/
internal object ReportInstancesIndex {
private val log by logger(ReportInstancesIndex::class.java)
private const val REPORT_INSTANCES_INDEX_NAME = ".opendistro-reports-instances"
const val REPORT_INSTANCES_INDEX_NAME = ".opendistro-reports-instances"
private const val REPORT_INSTANCES_MAPPING_FILE_NAME = "report-instances-mapping.yml"
private const val REPORT_INSTANCES_SETTINGS_FILE_NAME = "report-instances-settings.yml"

Expand Down

0 comments on commit 2f81773

Please sign in to comment.