-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ILM] Data tiers for 7.10 #76126
[ILM] Data tiers for 7.10 #76126
Changes from 52 commits
b2c509c
51f8ebc
579d003
723db09
f844efc
f51a081
a97f6b7
c6e7f91
174a82d
520b167
89da532
bda6d0a
4f54d5b
78e64ce
5a6dc06
bba846e
17a4d95
afba9f0
a736c65
2790121
93a02b2
b0a9b20
2302a1d
91d06ca
b052ce7
fcb2eaa
806c4e3
ecea8fc
4e3bf56
8b1f1dd
9ff986d
1a75f5f
a608425
a9cd4f7
ac58f77
021da15
567ce64
4170364
06ebb97
d7d5313
41ae883
d782706
a3fbe8d
baacace
28145f2
02509e1
50d99be
dbbd4c9
96b1209
d91a960
835333b
4acba5f
c0b8c1e
83ac6b9
4146ba2
8d0d46b
d695e95
36e4a45
50a9651
8a69d28
14fbf8c
e604dd6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { init as initHttpRequests } from './http_requests'; | ||
|
||
export type EditPolicySetup = ReturnType<typeof setup>; | ||
|
||
export const setup = () => { | ||
const { httpRequestsMockHelpers, server } = initHttpRequests(); | ||
|
||
const setupNodeListResponse = ( | ||
response: Record<string, any> = { | ||
nodesByAttributes: { 'attribute:true': ['node1'] }, | ||
nodesByRoles: { data: ['node1'] }, | ||
} | ||
) => { | ||
httpRequestsMockHelpers.setNodesListResponse(response); | ||
}; | ||
|
||
return { | ||
http: { | ||
setupNodeListResponse, | ||
httpRequestsMockHelpers, | ||
server, | ||
}, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import * as editPolicyHelpers from './edit_policy'; | ||
|
||
export { HttpRequestMockHelpers, init } from './http_requests'; | ||
|
||
export { editPolicyHelpers }; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export type NodeRole = 'data' | 'data_hot' | 'data_warm' | 'data_cold' | 'data_frozen'; | ||
|
||
export interface ListNodesRouteResponse { | ||
nodesByAttributes: { [attributePair: string]: string[] }; | ||
nodesByRoles: { [role in NodeRole]?: string[] }; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,7 @@ export interface SerializedWarmPhase extends SerializedPhase { | |
set_priority?: { | ||
priority: number | null; | ||
}; | ||
migrate?: { enabled: boolean }; | ||
}; | ||
} | ||
|
||
|
@@ -69,6 +70,7 @@ export interface SerializedColdPhase extends SerializedPhase { | |
set_priority?: { | ||
priority: number | null; | ||
}; | ||
migrate?: { enabled: boolean }; | ||
}; | ||
} | ||
|
||
|
@@ -79,6 +81,7 @@ export interface SerializedFrozenPhase extends SerializedPhase { | |
set_priority?: { | ||
priority: number | null; | ||
}; | ||
migrate?: { enabled: boolean }; | ||
}; | ||
} | ||
|
||
|
@@ -100,6 +103,9 @@ export interface AllocateAction { | |
require?: { | ||
[attribute: string]: string; | ||
}; | ||
migrate?: { | ||
enabled: false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it was, :). The default will be for enabled to be true so the only reason to ever specify this at the moment is to turn migration off. I will add a comment to that effect 👍 |
||
}; | ||
} | ||
|
||
export interface Policy { | ||
|
@@ -122,9 +128,23 @@ export interface PhaseWithMinAge { | |
selectedMinimumAgeUnits: string; | ||
} | ||
|
||
/** | ||
* Different types of allocation markers we use in deserialized policies. | ||
* | ||
* default - use data tier based data allocation based on node roles -- this is ES best practice mode. | ||
* custom - use node_attrs to allocate data to specific nodes | ||
* none - do not move data anywhere when entering a phase | ||
*/ | ||
export type DataTierAllocationType = 'default' | 'custom' | 'none'; | ||
|
||
export interface PhaseWithAllocationAction { | ||
selectedNodeAttrs: string; | ||
selectedReplicaCount: string; | ||
/** | ||
* A string value indicating allocation type. If unspecified we assume the user | ||
* wants to use default allocation. | ||
*/ | ||
dataTierAllocationType: DataTierAllocationType; | ||
} | ||
|
||
export interface PhaseWithIndexPriority { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { NodeRole, ListNodesRouteResponse, PhaseWithAllocation } from '../../../../common/types'; | ||
|
||
/** | ||
* Given a phase and current node roles, determine whether the phase | ||
* can use default data tier allocation. | ||
* | ||
* This can only be checked for phases that have an allocate action. | ||
*/ | ||
export const isPhaseDefaultDataAllocationCompatible = ( | ||
phase: PhaseWithAllocation, | ||
nodesByRoles: ListNodesRouteResponse['nodesByRoles'] | ||
): boolean => { | ||
// The 'data' role covers all node roles, so if we have at least one node with the data role | ||
// we can use default allocation. | ||
if (nodesByRoles.data?.length) { | ||
return true; | ||
} | ||
|
||
// Otherwise we need to check whether a node role for the specific phase exists | ||
if (nodesByRoles[`data_${phase}` as NodeRole]?.length) { | ||
return true; | ||
} | ||
|
||
// Otherwise default allocation has nowhere to allocate new shards to in this phase. | ||
return false; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { DataTierAllocationType, AllocateAction } from '../../../../common/types'; | ||
|
||
/** | ||
* Determine what deserialized state the policy config represents. | ||
* | ||
* See {@DataTierAllocationType} for more information. | ||
*/ | ||
export const determineDataTierAllocationType = ( | ||
allocateAction?: AllocateAction | ||
): DataTierAllocationType => { | ||
if (!allocateAction) { | ||
return 'default'; | ||
} | ||
|
||
if (allocateAction.migrate?.enabled === false) { | ||
return 'none'; | ||
} | ||
|
||
if ( | ||
(allocateAction.require && Object.keys(allocateAction.require).length) || | ||
(allocateAction.include && Object.keys(allocateAction.include).length) || | ||
(allocateAction.exclude && Object.keys(allocateAction.exclude).length) | ||
) { | ||
return 'custom'; | ||
} | ||
|
||
return 'default'; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export * from './determine_allocation_type'; | ||
|
||
export * from './check_phase_compatibility'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export * from './data_tiers'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't look like this file is being used anywhere? |
||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { i18n } from '@kbn/i18n'; | ||
import React, { FunctionComponent, useState } from 'react'; | ||
import { EuiButtonEmpty, EuiText } from '@elastic/eui'; | ||
|
||
const i18nTexts = { | ||
showAdvancedLabel: i18n.translate('xpack.indexLifecycleMgmt.advancedSection.showSectionLabel', { | ||
defaultMessage: 'Show advanced settings', | ||
}), | ||
hideAdvancedLabel: i18n.translate('xpack.indexLifecycleMgmt.advancedSection.hideSectionLabel', { | ||
defaultMessage: 'Hide advanced settings', | ||
}), | ||
}; | ||
|
||
export const AdvancedSectionLayout: FunctionComponent = ({ children }) => { | ||
const [isShowingSection, setIsShowingSection] = useState(false); | ||
|
||
return ( | ||
<> | ||
<EuiButtonEmpty | ||
data-test-subj="advancedAllocationSettingsButton" | ||
flush="left" | ||
size="s" | ||
iconSide="right" | ||
iconType={isShowingSection ? 'arrowDown' : 'arrowRight'} | ||
onClick={() => { | ||
setIsShowingSection((v) => !v); | ||
}} | ||
> | ||
<EuiText size="s"> | ||
{isShowingSection ? i18nTexts.hideAdvancedLabel : i18nTexts.showAdvancedLabel} | ||
</EuiText> | ||
</EuiButtonEmpty> | ||
{isShowingSection ? children : null} | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.indexLifecycleManagement__phase__dataTierAllocation { | ||
&__controlSection { | ||
background-color: $euiColorLightestShade; | ||
padding-top: $euiSizeM; | ||
padding-left: $euiSizeM; | ||
padding-right: $euiSizeM; | ||
padding-bottom: $euiSizeM; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need both
NodeRole
andDataTierNodeRole
(looks like they contain the same values)?