Skip to content
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

Merged
merged 62 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
b2c509c
wip
jloleysens Aug 24, 2020
51f8ebc
Revert "wip"
jloleysens Aug 24, 2020
579d003
Revert "Revert "wip""
jloleysens Aug 25, 2020
723db09
Refactor to using EUI button group component
jloleysens Aug 25, 2020
f844efc
WIP: moved form UX more in line with EUI
jloleysens Aug 27, 2020
f51a081
Refactor UI to reflect custom-ness of "Custom" and "None" options
jloleysens Aug 27, 2020
a97f6b7
server side changes for getting node data
jloleysens Aug 27, 2020
c6e7f91
double opt-in
jloleysens Aug 27, 2020
174a82d
Merge branch 'master' of github.com:elastic/kibana into ilm/data-tier…
jloleysens Aug 31, 2020
520b167
Refactored data tier allocation type
jloleysens Aug 31, 2020
89da532
Some refacoring, but main point is to add warning detection for
jloleysens Aug 31, 2020
bda6d0a
Merge branch 'master' into ilm/data-tiers-for-710
elasticmachine Sep 3, 2020
4f54d5b
fix i18n
jloleysens Sep 3, 2020
78e64ce
fix type issue with deafult policies missing allocation type
jloleysens Sep 3, 2020
5a6dc06
remove "undefined" as option for setting phase data
jloleysens Sep 3, 2020
bba846e
Create referentially stable data setter for all phases - prevent infi…
jloleysens Sep 3, 2020
17a4d95
fix type issue
jloleysens Sep 3, 2020
afba9f0
refactor data -> nodesData
jloleysens Sep 3, 2020
a736c65
refactor cold phase for data tiers
jloleysens Sep 3, 2020
2790121
refactor frozen phase for data tiers
jloleysens Sep 3, 2020
93a02b2
fixed existing tests for warm section
jloleysens Sep 3, 2020
b0a9b20
restored existing test coverage for cold phase and added test coverag…
jloleysens Sep 3, 2020
2302a1d
fix api integration test
jloleysens Sep 3, 2020
91d06ca
remove unused translations
jloleysens Sep 3, 2020
b052ce7
Merge branch 'master' into ilm/data-tiers-for-710
elasticmachine Sep 4, 2020
fcb2eaa
slight UX update to turning on custom attribute allocation
jloleysens Sep 4, 2020
806c4e3
added scss file for data tier advanced section and other style
jloleysens Sep 4, 2020
ecea8fc
added tests for new warning
jloleysens Sep 4, 2020
4e3bf56
Merge branch 'master' into ilm/data-tiers-for-710
elasticmachine Sep 7, 2020
8b1f1dd
Merge branch 'master' of github.com:elastic/kibana into ilm/data-tier…
jloleysens Sep 8, 2020
9ff986d
fix types
jloleysens Sep 8, 2020
1a75f5f
added correct copy for cold and frozen phases
jloleysens Sep 8, 2020
a608425
Merge branch 'master' into ilm/data-tiers-for-710
elasticmachine Sep 9, 2020
a9cd4f7
fix types and i18n
jloleysens Sep 9, 2020
ac58f77
implement copy feedback
jloleysens Sep 9, 2020
021da15
added spacer after the enable data tier allocation switch
jloleysens Sep 9, 2020
567ce64
refactor to super select
jloleysens Sep 10, 2020
4170364
fix replicas copy
jloleysens Sep 10, 2020
06ebb97
update phase serialization for cold and frozen
jloleysens Sep 10, 2020
d7d5313
Refactor so that logic determining warnings lives together
jloleysens Sep 10, 2020
41ae883
tier -> phase
jloleysens Sep 10, 2020
d782706
Added some much needed policy serialization test coverage
jloleysens Sep 10, 2020
a3fbe8d
fix import paths and added required file header
jloleysens Sep 10, 2020
baacace
fix existing test coverage
jloleysens Sep 10, 2020
28145f2
refine copy for data tier allocation recommended option
jloleysens Sep 10, 2020
02509e1
fix showing warning for no node attrs
jloleysens Sep 10, 2020
50d99be
Merge branch 'master' of github.com:elastic/kibana into ilm/data-tier…
jloleysens Sep 14, 2020
dbbd4c9
fix inverted warning logic 🤦🏼‍♂️
jloleysens Sep 14, 2020
96b1209
fix typing
jloleysens Sep 14, 2020
d91a960
implement CJs copy feedback
jloleysens Sep 14, 2020
835333b
fix i18n
jloleysens Sep 14, 2020
4acba5f
remove unused or invalid translations
jloleysens Sep 14, 2020
c0b8c1e
provide ability to not alter original policy
jloleysens Sep 15, 2020
83ac6b9
do not alter the original policy in the serilalization process
jloleysens Sep 15, 2020
4146ba2
Merge branch 'master' of github.com:elastic/kibana into ilm/data-tier…
jloleysens Sep 16, 2020
8d0d46b
fix jest tests
jloleysens Sep 16, 2020
d695e95
Remove duplicate type and refactor NodeRole to NodeDataRole
jloleysens Sep 16, 2020
36e4a45
added comment to "false" typing
jloleysens Sep 16, 2020
50a9651
revised and refactored copy based on feedback
jloleysens Sep 16, 2020
8a69d28
address copy feedback
jloleysens Sep 17, 2020
14fbf8c
update kibana schema to allow migrate: { enabled: false }
jloleysens Sep 17, 2020
e604dd6
Merge branch 'master' into ilm/data-tiers-for-710
elasticmachine Sep 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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
Expand Up @@ -40,6 +40,8 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => {
};
};

export type HttpRequestMockHelpers = ReturnType<typeof registerHttpRequestMockHelpers>;

export const init = () => {
const server = sinon.fakeServer.create();

Expand Down
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 };
12 changes: 12 additions & 0 deletions x-pack/plugins/index_lifecycle_management/common/types/api.ts
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 NodeDataRole = 'data' | 'data_hot' | 'data_warm' | 'data_cold' | 'data_frozen';

export interface ListNodesRouteResponse {
nodesByAttributes: { [attributePair: string]: string[] };
nodesByRoles: { [role in NodeDataRole]?: string[] };
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export * from './api';

export * from './policies';
26 changes: 26 additions & 0 deletions x-pack/plugins/index_lifecycle_management/common/types/policies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import { Index as IndexInterface } from '../../../index_management/common/types';

export type PhaseWithAllocation = 'warm' | 'cold' | 'frozen';

export interface SerializedPolicy {
name: string;
phases: Phases;
Expand Down Expand Up @@ -62,6 +64,7 @@ export interface SerializedWarmPhase extends SerializedPhase {
set_priority?: {
priority: number | null;
};
migrate?: { enabled: boolean };
};
}

Expand All @@ -72,6 +75,7 @@ export interface SerializedColdPhase extends SerializedPhase {
set_priority?: {
priority: number | null;
};
migrate?: { enabled: boolean };
};
}

Expand All @@ -82,6 +86,7 @@ export interface SerializedFrozenPhase extends SerializedPhase {
set_priority?: {
priority: number | null;
};
migrate?: { enabled: boolean };
};
}

Expand All @@ -103,6 +108,13 @@ export interface AllocateAction {
require?: {
[attribute: string]: string;
};
migrate?: {
/**
* If enabled is ever set it will only be set to `false` because the default value
* for this is `true`. Rather leave unspecified for true.
*/
enabled: false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was setting false here intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 {
Expand All @@ -125,9 +137,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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const defaultNewWarmPhase: WarmPhase = {
selectedReplicaCount: '',
warmPhaseOnRollover: true,
phaseIndexPriority: '50',
dataTierAllocationType: 'default',
};

export const defaultNewColdPhase: ColdPhase = {
Expand All @@ -48,6 +49,7 @@ export const defaultNewColdPhase: ColdPhase = {
selectedReplicaCount: '',
freezeEnabled: false,
phaseIndexPriority: '0',
dataTierAllocationType: 'default',
};

export const defaultNewFrozenPhase: FrozenPhase = {
Expand All @@ -58,6 +60,7 @@ export const defaultNewFrozenPhase: FrozenPhase = {
selectedReplicaCount: '',
freezeEnabled: false,
phaseIndexPriority: '0',
dataTierAllocationType: 'default',
};

export const defaultNewDeletePhase: DeletePhase = {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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 {
NodeDataRole,
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 NodeDataRole]?.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,9 @@
.indexLifecycleManagement__phase__dataTierAllocation {
&__controlSection {
background-color: $euiColorLightestShade;
padding-top: $euiSizeM;
padding-left: $euiSizeM;
padding-right: $euiSizeM;
padding-bottom: $euiSizeM;
}
}
Loading