From 7d49cc7f51629808514abb18727cfbad7f56a7d3 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Thu, 7 Nov 2024 15:11:35 -0600 Subject: [PATCH 1/7] move some dependencies to package --- package.json | 1 + tsconfig.base.json | 2 ++ .../README.md | 3 +++ .../index.ts | 9 ++++++++ .../kibana.jsonc | 5 ++++ .../package.json | 6 +++++ .../src}/policies.ts | 7 ++++++ .../tsconfig.json | 23 +++++++++++++++++++ .../common/types/index.ts | 2 +- .../public/locator.ts | 3 ++- .../synthetics/kibana.jsonc | 3 +-- .../components/settings/hooks/api.ts | 2 +- .../components/settings/policy_link.tsx | 2 +- yarn.lock | 4 ++++ 14 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md create mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts create mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc create mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json rename x-pack/{plugins/index_lifecycle_management/common/types => packages/index-lifecycle-management/index-lifecycle-management-common-shared/src}/policies.ts (94%) create mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json diff --git a/package.json b/package.json index 8be3b49992cf4..9cf598931eb10 100644 --- a/package.json +++ b/package.json @@ -567,6 +567,7 @@ "@kbn/i18n-react": "link:packages/kbn-i18n-react", "@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded", "@kbn/image-embeddable-plugin": "link:src/plugins/image_embeddable", + "@kbn/index-lifecycle-management-common-shared": "link:x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared", "@kbn/index-lifecycle-management-plugin": "link:x-pack/plugins/index_lifecycle_management", "@kbn/index-management-plugin": "link:x-pack/plugins/index_management", "@kbn/index-management-shared-types": "link:x-pack/packages/index-management/index_management_shared_types", diff --git a/tsconfig.base.json b/tsconfig.base.json index 7b1bc834fcc28..54b1ab09e9c4a 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1034,6 +1034,8 @@ "@kbn/import-locator/*": ["packages/kbn-import-locator/*"], "@kbn/import-resolver": ["packages/kbn-import-resolver"], "@kbn/import-resolver/*": ["packages/kbn-import-resolver/*"], + "@kbn/index-lifecycle-management-common-shared": ["x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared"], + "@kbn/index-lifecycle-management-common-shared/*": ["x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/*"], "@kbn/index-lifecycle-management-plugin": ["x-pack/plugins/index_lifecycle_management"], "@kbn/index-lifecycle-management-plugin/*": ["x-pack/plugins/index_lifecycle_management/*"], "@kbn/index-management-plugin": ["x-pack/plugins/index_management"], diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md new file mode 100644 index 0000000000000..66d1ff7e3c8f2 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md @@ -0,0 +1,3 @@ +# @kbn/index-lifecycle-management-common-shared + +Contains types and functions used and exported by the index lifecycle management plugin. Primarily used to address dependency issues. diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts new file mode 100644 index 0000000000000..044ab18aa34df --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; +export * from './src/policies'; diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc new file mode 100644 index 0000000000000..dfaef1d0dfb9c --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/index-lifecycle-management-common-shared", + "owner": "@elastic/kibana-management" +} diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json new file mode 100644 index 0000000000000..9c3e7c99dd7d9 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/index-lifecycle-management-common-shared", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0" +} diff --git a/x-pack/plugins/index_lifecycle_management/common/types/policies.ts b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts similarity index 94% rename from x-pack/plugins/index_lifecycle_management/common/types/policies.ts rename to x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts index 7ebb789f62e54..a85c8353e5156 100644 --- a/x-pack/plugins/index_lifecycle_management/common/types/policies.ts +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts @@ -5,6 +5,13 @@ * 2.0. */ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + export type Phase = keyof Phases; export type PhaseWithAllocation = 'warm' | 'cold'; diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json new file mode 100644 index 0000000000000..8e9142a838322 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/core-application-browser", + "@kbn/utility-types", + "@kbn/share-plugin", + ] +} diff --git a/x-pack/plugins/index_lifecycle_management/common/types/index.ts b/x-pack/plugins/index_lifecycle_management/common/types/index.ts index bc7e881a8c230..ee5939e328ce5 100644 --- a/x-pack/plugins/index_lifecycle_management/common/types/index.ts +++ b/x-pack/plugins/index_lifecycle_management/common/types/index.ts @@ -7,7 +7,7 @@ export * from './api'; -export * from './policies'; +export * from '@kbn/index-lifecycle-management-common-shared'; /** * These roles reflect how nodes are stratified into different data tiers. diff --git a/x-pack/plugins/index_lifecycle_management/public/locator.ts b/x-pack/plugins/index_lifecycle_management/public/locator.ts index 24599b6a6b47e..382cbc4ad1838 100644 --- a/x-pack/plugins/index_lifecycle_management/public/locator.ts +++ b/x-pack/plugins/index_lifecycle_management/public/locator.ts @@ -8,6 +8,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import { ManagementAppLocator } from '@kbn/management-plugin/common'; import { LocatorDefinition } from '@kbn/share-plugin/public'; +import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-common-shared'; import { getPoliciesListPath, getPolicyCreatePath, @@ -15,7 +16,7 @@ import { } from './application/services/navigation'; import { PLUGIN } from '../common/constants'; -export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; +export { ILM_LOCATOR_ID }; export interface IlmLocatorParams extends SerializableRecord { page: 'policies_list' | 'policy_edit' | 'policy_create'; diff --git a/x-pack/plugins/observability_solution/synthetics/kibana.jsonc b/x-pack/plugins/observability_solution/synthetics/kibana.jsonc index 89870a9e6c881..44d549843f469 100644 --- a/x-pack/plugins/observability_solution/synthetics/kibana.jsonc +++ b/x-pack/plugins/observability_solution/synthetics/kibana.jsonc @@ -63,8 +63,7 @@ "kibanaUtils", "observability", "spaces", - "indexLifecycleManagement", "unifiedDocViewer" ] } -} \ No newline at end of file +} diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts index ad3d45d0ba806..a113f86bdfef4 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/hooks/api.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { PolicyFromES } from '@kbn/index-lifecycle-management-plugin/common/types'; +import { PolicyFromES } from '@kbn/index-lifecycle-management-common-shared'; import { DataStream } from '@kbn/index-management-plugin/common'; import { CatIndicesResponse } from '@elastic/elasticsearch/lib/api/types'; import { apiService } from '../../../../../utils/api_service'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx index 0c9cb465c127f..3918e20bccabd 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/policy_link.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { EuiIconTip, EuiLink, EuiSkeletonText, EuiToolTip, EuiText } from '@elastic/eui'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-plugin/public'; +import { ILM_LOCATOR_ID } from '@kbn/index-lifecycle-management-common-shared'; import { useFetcher } from '@kbn/observability-shared-plugin/public'; import { i18n } from '@kbn/i18n'; import { useSyntheticsSettingsContext } from '../../contexts'; diff --git a/yarn.lock b/yarn.lock index 34d99f881d686..9efd93ee2182c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5328,6 +5328,10 @@ version "0.0.0" uid "" +"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared": + version "0.0.0" + uid "" + "@kbn/index-management-plugin@link:x-pack/plugins/index_management": version "0.0.0" uid "" From cf4181742b3e2303d0c00171a311ecfd194dcc1e Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Thu, 7 Nov 2024 21:23:06 +0000 Subject: [PATCH 2/7] [CI] Auto-commit changed files from 'node scripts/generate codeowners' --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6dc2aa32a79a9..38240526a0c2b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -766,6 +766,7 @@ x-pack/examples/triggers_actions_ui_example @elastic/response-ops x-pack/examples/ui_actions_enhanced_examples @elastic/appex-sharedux x-pack/packages/ai-infra/inference-common @elastic/appex-ai-infra x-pack/packages/ai-infra/product-doc-artifact-builder @elastic/appex-ai-infra +x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared @elastic/kibana-management x-pack/packages/index-management/index_management_shared_types @elastic/kibana-management x-pack/packages/kbn-ai-assistant @elastic/search-kibana x-pack/packages/kbn-ai-assistant-common @elastic/search-kibana From a68facf45eaae732f7137200a13e35d831572b7a Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Thu, 7 Nov 2024 21:27:27 -0600 Subject: [PATCH 3/7] remove dupe license --- .github/CODEOWNERS | 1 + package.json | 2 +- tsconfig.base.json | 4 +- .../README.md | 3 - .../index.ts | 9 - .../kibana.jsonc | 5 - .../package.json | 6 - .../src/policies.ts | 193 ------------------ .../tsconfig.json | 23 --- yarn.lock | 2 +- 10 files changed, 5 insertions(+), 243 deletions(-) delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts delete mode 100644 x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6dc2aa32a79a9..c448417ef6ba6 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -766,6 +766,7 @@ x-pack/examples/triggers_actions_ui_example @elastic/response-ops x-pack/examples/ui_actions_enhanced_examples @elastic/appex-sharedux x-pack/packages/ai-infra/inference-common @elastic/appex-ai-infra x-pack/packages/ai-infra/product-doc-artifact-builder @elastic/appex-ai-infra +x-pack/packages/index-lifecycle-management @elastic/kibana-management x-pack/packages/index-management/index_management_shared_types @elastic/kibana-management x-pack/packages/kbn-ai-assistant @elastic/search-kibana x-pack/packages/kbn-ai-assistant-common @elastic/search-kibana diff --git a/package.json b/package.json index 9cf598931eb10..6b284fda27615 100644 --- a/package.json +++ b/package.json @@ -567,7 +567,7 @@ "@kbn/i18n-react": "link:packages/kbn-i18n-react", "@kbn/iframe-embedded-plugin": "link:x-pack/test/functional_embedded/plugins/iframe_embedded", "@kbn/image-embeddable-plugin": "link:src/plugins/image_embeddable", - "@kbn/index-lifecycle-management-common-shared": "link:x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared", + "@kbn/index-lifecycle-management-common-shared": "link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared", "@kbn/index-lifecycle-management-plugin": "link:x-pack/plugins/index_lifecycle_management", "@kbn/index-management-plugin": "link:x-pack/plugins/index_management", "@kbn/index-management-shared-types": "link:x-pack/packages/index-management/index_management_shared_types", diff --git a/tsconfig.base.json b/tsconfig.base.json index 54b1ab09e9c4a..68faf44ed74d4 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1034,8 +1034,8 @@ "@kbn/import-locator/*": ["packages/kbn-import-locator/*"], "@kbn/import-resolver": ["packages/kbn-import-resolver"], "@kbn/import-resolver/*": ["packages/kbn-import-resolver/*"], - "@kbn/index-lifecycle-management-common-shared": ["x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared"], - "@kbn/index-lifecycle-management-common-shared/*": ["x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/*"], + "@kbn/index-lifecycle-management-common-shared": ["x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared"], + "@kbn/index-lifecycle-management-common-shared/*": ["x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/*"], "@kbn/index-lifecycle-management-plugin": ["x-pack/plugins/index_lifecycle_management"], "@kbn/index-lifecycle-management-plugin/*": ["x-pack/plugins/index_lifecycle_management/*"], "@kbn/index-management-plugin": ["x-pack/plugins/index_management"], diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md deleted file mode 100644 index 66d1ff7e3c8f2..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @kbn/index-lifecycle-management-common-shared - -Contains types and functions used and exported by the index lifecycle management plugin. Primarily used to address dependency issues. diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts deleted file mode 100644 index 044ab18aa34df..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; -export * from './src/policies'; diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc deleted file mode 100644 index dfaef1d0dfb9c..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/kibana.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "shared-common", - "id": "@kbn/index-lifecycle-management-common-shared", - "owner": "@elastic/kibana-management" -} diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json deleted file mode 100644 index 9c3e7c99dd7d9..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "@kbn/index-lifecycle-management-common-shared", - "private": true, - "version": "1.0.0", - "license": "Elastic License 2.0" -} diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts deleted file mode 100644 index a85c8353e5156..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/src/policies.ts +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -export type Phase = keyof Phases; - -export type PhaseWithAllocation = 'warm' | 'cold'; - -export type PhaseWithTiming = keyof Omit; - -export type PhaseExceptDelete = keyof Omit; - -export type PhaseWithDownsample = 'hot' | 'warm' | 'cold'; - -export interface SerializedPolicy { - name: string; - phases: Phases; - deprecated?: boolean; - _meta?: Record; -} - -export interface Phases { - hot?: SerializedHotPhase; - warm?: SerializedWarmPhase; - cold?: SerializedColdPhase; - frozen?: SerializedFrozenPhase; - delete?: SerializedDeletePhase; -} - -export interface PolicyFromES { - modifiedDate: string; - name: string; - policy: SerializedPolicy; - version: number; - indices?: string[]; - dataStreams?: string[]; - indexTemplates?: string[]; -} - -export interface SerializedPhase { - min_age?: string; - actions: { - [action: string]: any; - }; -} - -export interface MigrateAction { - /** - * If enabled is ever set it will probably only be set to `false` because the default value - * for this is `true`. Rather leave unspecified for true when serialising. - */ - enabled: boolean; -} - -export interface SerializedActionWithAllocation { - allocate?: AllocateAction; - migrate?: MigrateAction; -} - -export interface SearchableSnapshotAction { - snapshot_repository: string; - /** - * We do not configure this value in the UI as it is an advanced setting that will - * not suit the vast majority of cases. - */ - force_merge_index?: boolean; -} - -export interface RolloverAction { - max_age?: string; - max_docs?: number; - max_primary_shard_size?: string; - max_primary_shard_docs?: number; - /** - * @deprecated This will be removed in versions 8+ of the stack - */ - max_size?: string; -} - -export interface SerializedHotPhase extends SerializedPhase { - actions: { - rollover?: RolloverAction; - forcemerge?: ForcemergeAction; - readonly?: {}; - shrink?: ShrinkAction; - downsample?: DownsampleAction; - - set_priority?: SetPriorityAction; - /** - * Only available on enterprise license - */ - searchable_snapshot?: SearchableSnapshotAction; - }; -} - -export interface SerializedWarmPhase extends SerializedPhase { - actions: { - allocate?: AllocateAction; - shrink?: ShrinkAction; - forcemerge?: ForcemergeAction; - readonly?: {}; - downsample?: DownsampleAction; - set_priority?: SetPriorityAction; - migrate?: MigrateAction; - }; -} - -export interface SerializedColdPhase extends SerializedPhase { - actions: { - freeze?: {}; - readonly?: {}; - downsample?: DownsampleAction; - allocate?: AllocateAction; - set_priority?: SetPriorityAction; - migrate?: MigrateAction; - /** - * Only available on enterprise license - */ - searchable_snapshot?: SearchableSnapshotAction; - }; -} - -export interface SerializedFrozenPhase extends SerializedPhase { - actions: { - /** - * Only available on enterprise license - */ - searchable_snapshot?: SearchableSnapshotAction; - }; -} - -export interface SerializedDeletePhase extends SerializedPhase { - actions: { - wait_for_snapshot?: { - policy: string; - }; - delete?: { - delete_searchable_snapshot?: boolean; - }; - }; -} - -export interface AllocateAction { - number_of_replicas?: number; - include?: {}; - exclude?: {}; - require?: { - [attribute: string]: string; - }; -} - -export interface ShrinkAction { - number_of_shards?: number; - max_primary_shard_size?: string; - allow_write_after_shrink?: boolean; -} - -export interface ForcemergeAction { - max_num_segments: number; - // only accepted value for index_codec - index_codec?: 'best_compression'; -} - -export interface DownsampleAction { - fixed_interval: string; -} - -export interface SetPriorityAction { - priority: number | null; -} - -export interface CommonPhaseSettings { - phaseEnabled: boolean; -} - -export interface PhaseWithMinAge { - selectedMinimumAge: string; - selectedMinimumAgeUnits: string; -} - -export interface DeletePhase extends CommonPhaseSettings, PhaseWithMinAge { - waitForSnapshotPolicy: string; -} diff --git a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json b/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json deleted file mode 100644 index 8e9142a838322..0000000000000 --- a/x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "extends": "../../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "target/types", - "types": [ - "jest", - "node", - "react" - ] - }, - "include": [ - "**/*.ts", - "**/*.tsx" - ], - "exclude": [ - "target/**/*" - ], - "kbn_references": [ - "@kbn/core-application-browser", - "@kbn/utility-types", - "@kbn/share-plugin", - ] -} diff --git a/yarn.lock b/yarn.lock index 9efd93ee2182c..c36471f9003a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5328,7 +5328,7 @@ version "0.0.0" uid "" -"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index-lifecycle-management-common-shared": +"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared": version "0.0.0" uid "" From 73769c3f390563b0b7cfcc76b6b772ef7c2c8176 Mon Sep 17 00:00:00 2001 From: Matthew Kime Date: Thu, 7 Nov 2024 21:38:24 -0600 Subject: [PATCH 4/7] remove dupe license --- .../README.md | 3 + .../index.ts | 9 + .../kibana.jsonc | 5 + .../package.json | 6 + .../src/policies.ts | 186 ++++++++++++++++++ .../tsconfig.json | 23 +++ 6 files changed, 232 insertions(+) create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts create mode 100644 x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md new file mode 100644 index 0000000000000..66d1ff7e3c8f2 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/README.md @@ -0,0 +1,3 @@ +# @kbn/index-lifecycle-management-common-shared + +Contains types and functions used and exported by the index lifecycle management plugin. Primarily used to address dependency issues. diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts new file mode 100644 index 0000000000000..044ab18aa34df --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export const ILM_LOCATOR_ID = 'ILM_LOCATOR_ID'; +export * from './src/policies'; diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc new file mode 100644 index 0000000000000..dfaef1d0dfb9c --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/index-lifecycle-management-common-shared", + "owner": "@elastic/kibana-management" +} diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json new file mode 100644 index 0000000000000..9c3e7c99dd7d9 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/index-lifecycle-management-common-shared", + "private": true, + "version": "1.0.0", + "license": "Elastic License 2.0" +} diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts new file mode 100644 index 0000000000000..7ebb789f62e54 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/src/policies.ts @@ -0,0 +1,186 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +export type Phase = keyof Phases; + +export type PhaseWithAllocation = 'warm' | 'cold'; + +export type PhaseWithTiming = keyof Omit; + +export type PhaseExceptDelete = keyof Omit; + +export type PhaseWithDownsample = 'hot' | 'warm' | 'cold'; + +export interface SerializedPolicy { + name: string; + phases: Phases; + deprecated?: boolean; + _meta?: Record; +} + +export interface Phases { + hot?: SerializedHotPhase; + warm?: SerializedWarmPhase; + cold?: SerializedColdPhase; + frozen?: SerializedFrozenPhase; + delete?: SerializedDeletePhase; +} + +export interface PolicyFromES { + modifiedDate: string; + name: string; + policy: SerializedPolicy; + version: number; + indices?: string[]; + dataStreams?: string[]; + indexTemplates?: string[]; +} + +export interface SerializedPhase { + min_age?: string; + actions: { + [action: string]: any; + }; +} + +export interface MigrateAction { + /** + * If enabled is ever set it will probably only be set to `false` because the default value + * for this is `true`. Rather leave unspecified for true when serialising. + */ + enabled: boolean; +} + +export interface SerializedActionWithAllocation { + allocate?: AllocateAction; + migrate?: MigrateAction; +} + +export interface SearchableSnapshotAction { + snapshot_repository: string; + /** + * We do not configure this value in the UI as it is an advanced setting that will + * not suit the vast majority of cases. + */ + force_merge_index?: boolean; +} + +export interface RolloverAction { + max_age?: string; + max_docs?: number; + max_primary_shard_size?: string; + max_primary_shard_docs?: number; + /** + * @deprecated This will be removed in versions 8+ of the stack + */ + max_size?: string; +} + +export interface SerializedHotPhase extends SerializedPhase { + actions: { + rollover?: RolloverAction; + forcemerge?: ForcemergeAction; + readonly?: {}; + shrink?: ShrinkAction; + downsample?: DownsampleAction; + + set_priority?: SetPriorityAction; + /** + * Only available on enterprise license + */ + searchable_snapshot?: SearchableSnapshotAction; + }; +} + +export interface SerializedWarmPhase extends SerializedPhase { + actions: { + allocate?: AllocateAction; + shrink?: ShrinkAction; + forcemerge?: ForcemergeAction; + readonly?: {}; + downsample?: DownsampleAction; + set_priority?: SetPriorityAction; + migrate?: MigrateAction; + }; +} + +export interface SerializedColdPhase extends SerializedPhase { + actions: { + freeze?: {}; + readonly?: {}; + downsample?: DownsampleAction; + allocate?: AllocateAction; + set_priority?: SetPriorityAction; + migrate?: MigrateAction; + /** + * Only available on enterprise license + */ + searchable_snapshot?: SearchableSnapshotAction; + }; +} + +export interface SerializedFrozenPhase extends SerializedPhase { + actions: { + /** + * Only available on enterprise license + */ + searchable_snapshot?: SearchableSnapshotAction; + }; +} + +export interface SerializedDeletePhase extends SerializedPhase { + actions: { + wait_for_snapshot?: { + policy: string; + }; + delete?: { + delete_searchable_snapshot?: boolean; + }; + }; +} + +export interface AllocateAction { + number_of_replicas?: number; + include?: {}; + exclude?: {}; + require?: { + [attribute: string]: string; + }; +} + +export interface ShrinkAction { + number_of_shards?: number; + max_primary_shard_size?: string; + allow_write_after_shrink?: boolean; +} + +export interface ForcemergeAction { + max_num_segments: number; + // only accepted value for index_codec + index_codec?: 'best_compression'; +} + +export interface DownsampleAction { + fixed_interval: string; +} + +export interface SetPriorityAction { + priority: number | null; +} + +export interface CommonPhaseSettings { + phaseEnabled: boolean; +} + +export interface PhaseWithMinAge { + selectedMinimumAge: string; + selectedMinimumAgeUnits: string; +} + +export interface DeletePhase extends CommonPhaseSettings, PhaseWithMinAge { + waitForSnapshotPolicy: string; +} diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json new file mode 100644 index 0000000000000..8e9142a838322 --- /dev/null +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "react" + ] + }, + "include": [ + "**/*.ts", + "**/*.tsx" + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/core-application-browser", + "@kbn/utility-types", + "@kbn/share-plugin", + ] +} From f1b51e5709722401b86414cfd903bb88825a8b55 Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 8 Nov 2024 03:59:40 +0000 Subject: [PATCH 5/7] [CI] Auto-commit changed files from 'node scripts/build_plugin_list_docs' --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c448417ef6ba6..73a670d145347 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -766,7 +766,7 @@ x-pack/examples/triggers_actions_ui_example @elastic/response-ops x-pack/examples/ui_actions_enhanced_examples @elastic/appex-sharedux x-pack/packages/ai-infra/inference-common @elastic/appex-ai-infra x-pack/packages/ai-infra/product-doc-artifact-builder @elastic/appex-ai-infra -x-pack/packages/index-lifecycle-management @elastic/kibana-management +x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared @elastic/kibana-management x-pack/packages/index-management/index_management_shared_types @elastic/kibana-management x-pack/packages/kbn-ai-assistant @elastic/search-kibana x-pack/packages/kbn-ai-assistant-common @elastic/search-kibana From eeba05ccda5a1b9776728a2944b50c218d588b7d Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 8 Nov 2024 04:18:18 +0000 Subject: [PATCH 6/7] [CI] Auto-commit changed files from 'node scripts/notice' --- .../index_lifecycle_management_common_shared/tsconfig.json | 3 --- x-pack/plugins/index_lifecycle_management/tsconfig.json | 1 + yarn.lock | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json index 8e9142a838322..12a691a15cc4f 100644 --- a/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json +++ b/x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared/tsconfig.json @@ -16,8 +16,5 @@ "target/**/*" ], "kbn_references": [ - "@kbn/core-application-browser", - "@kbn/utility-types", - "@kbn/share-plugin", ] } diff --git a/x-pack/plugins/index_lifecycle_management/tsconfig.json b/x-pack/plugins/index_lifecycle_management/tsconfig.json index 7c3913fcae1bd..08346dcdc2d35 100644 --- a/x-pack/plugins/index_lifecycle_management/tsconfig.json +++ b/x-pack/plugins/index_lifecycle_management/tsconfig.json @@ -41,6 +41,7 @@ "@kbn/react-kibana-context-render", "@kbn/unsaved-changes-prompt", "@kbn/shared-ux-table-persist", + "@kbn/index-lifecycle-management-common-shared", ], "exclude": [ "target/**/*", diff --git a/yarn.lock b/yarn.lock index c36471f9003a9..e8570ce981f36 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5324,11 +5324,11 @@ version "0.0.0" uid "" -"@kbn/index-lifecycle-management-plugin@link:x-pack/plugins/index_lifecycle_management": +"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared": version "0.0.0" uid "" -"@kbn/index-lifecycle-management-common-shared@link:x-pack/packages/index-lifecycle-management/index_lifecycle_management_common_shared": +"@kbn/index-lifecycle-management-plugin@link:x-pack/plugins/index_lifecycle_management": version "0.0.0" uid "" From 4bbce0f6b1ba82de6cc46227606cc72c417d340a Mon Sep 17 00:00:00 2001 From: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 8 Nov 2024 04:18:55 +0000 Subject: [PATCH 7/7] [CI] Auto-commit changed files from 'node scripts/yarn_deduplicate' --- .../plugins/observability_solution/synthetics/tsconfig.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/observability_solution/synthetics/tsconfig.json b/x-pack/plugins/observability_solution/synthetics/tsconfig.json index 5df6d4257b4e9..267298a234271 100644 --- a/x-pack/plugins/observability_solution/synthetics/tsconfig.json +++ b/x-pack/plugins/observability_solution/synthetics/tsconfig.json @@ -18,7 +18,6 @@ "@kbn/observability-plugin", "@kbn/fleet-plugin", "@kbn/unified-search-plugin", - "@kbn/index-lifecycle-management-plugin", "@kbn/i18n", "@kbn/core", "@kbn/config-schema", @@ -105,7 +104,8 @@ "@kbn/slo-plugin", "@kbn/ebt-tools", "@kbn/alerting-types", - "@kbn/core-chrome-browser" + "@kbn/core-chrome-browser", + "@kbn/index-lifecycle-management-common-shared" ], "exclude": ["target/**/*"] }