Update ILM UI to support presence of searchable snapshot options (#68047)
This commit is contained in:
parent
a9b2d50e76
commit
efcc2bf6b7
7 changed files with 75 additions and 22 deletions
|
@ -270,7 +270,9 @@ export const getLifecycle = (state) => {
|
|||
if (phaseName === PHASE_DELETE) {
|
||||
accum[phaseName].actions = {
|
||||
...accum[phaseName].actions,
|
||||
delete: {},
|
||||
delete: {
|
||||
...accum[phaseName].actions.delete,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ const warmPhaseSchema = schema.maybe(
|
|||
actions: schema.object({
|
||||
set_priority: setPrioritySchema,
|
||||
unfollow: unfollowSchema,
|
||||
read_only: schema.maybe(schema.object({})), // Readonly has no options
|
||||
readonly: schema.maybe(schema.object({})), // Readonly has no options
|
||||
allocate: allocateSchema,
|
||||
shrink: schema.maybe(
|
||||
schema.object({
|
||||
|
@ -91,6 +91,11 @@ const coldPhaseSchema = schema.maybe(
|
|||
unfollow: unfollowSchema,
|
||||
allocate: allocateSchema,
|
||||
freeze: schema.maybe(schema.object({})), // Freeze has no options
|
||||
searchable_snapshot: schema.maybe(
|
||||
schema.object({
|
||||
snapshot_repository: schema.string(),
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
@ -104,7 +109,11 @@ const deletePhaseSchema = schema.maybe(
|
|||
policy: schema.string(),
|
||||
})
|
||||
),
|
||||
delete: schema.maybe(schema.object({})), // Delete has no options
|
||||
delete: schema.maybe(
|
||||
schema.object({
|
||||
delete_searchable_snapshot: schema.maybe(schema.boolean()),
|
||||
})
|
||||
),
|
||||
}),
|
||||
})
|
||||
);
|
||||
|
|
|
@ -4,21 +4,22 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { getRandomString } from './lib';
|
||||
import { INDEX_TEMPLATE_PATTERN_PREFIX } from './constants';
|
||||
|
||||
export const getPolicyPayload = ({ name = getRandomString() } = {}) => ({
|
||||
export const getPolicyPayload = (name) => ({
|
||||
name,
|
||||
phases: {
|
||||
hot: {
|
||||
min_age: '1d',
|
||||
actions: {
|
||||
set_priority: {
|
||||
priority: 100,
|
||||
},
|
||||
unfollow: {},
|
||||
rollover: {
|
||||
max_age: '30d',
|
||||
max_size: '50gb',
|
||||
},
|
||||
set_priority: {
|
||||
priority: 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
warm: {
|
||||
|
@ -26,6 +27,26 @@ export const getPolicyPayload = ({ name = getRandomString() } = {}) => ({
|
|||
set_priority: {
|
||||
priority: 50,
|
||||
},
|
||||
unfollow: {},
|
||||
readonly: {},
|
||||
allocate: {
|
||||
number_of_replicas: 5,
|
||||
include: {
|
||||
a: 'a',
|
||||
},
|
||||
exclude: {
|
||||
b: 'b',
|
||||
},
|
||||
require: {
|
||||
c: 'c',
|
||||
},
|
||||
},
|
||||
shrink: {
|
||||
number_of_shards: 1,
|
||||
},
|
||||
forcemerge: {
|
||||
max_num_segments: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
cold: {
|
||||
|
@ -34,12 +55,34 @@ export const getPolicyPayload = ({ name = getRandomString() } = {}) => ({
|
|||
set_priority: {
|
||||
priority: 0,
|
||||
},
|
||||
unfollow: {},
|
||||
allocate: {
|
||||
number_of_replicas: 5,
|
||||
include: {
|
||||
a: 'a',
|
||||
},
|
||||
exclude: {
|
||||
b: 'b',
|
||||
},
|
||||
require: {
|
||||
c: 'c',
|
||||
},
|
||||
},
|
||||
freeze: {},
|
||||
searchable_snapshot: {
|
||||
snapshot_repository: 'backing_repo',
|
||||
},
|
||||
},
|
||||
},
|
||||
delete: {
|
||||
min_age: '10d',
|
||||
actions: {
|
||||
delete: {},
|
||||
wait_for_snapshot: {
|
||||
policy: 'policy',
|
||||
},
|
||||
delete: {
|
||||
delete_searchable_snapshot: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -29,7 +29,7 @@ export default function ({ getService }) {
|
|||
describe('policies', () => {
|
||||
it('should add a lifecycle policy to the index', async () => {
|
||||
// Create a policy
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('indices-test-policy');
|
||||
const { name: policyName } = policy;
|
||||
await createPolicy(policy);
|
||||
|
||||
|
@ -52,7 +52,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should remove a lifecycle policy from an index', async () => {
|
||||
// Create a policy
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('remove-test-policy');
|
||||
const { name: policyName } = policy;
|
||||
await createPolicy(policy);
|
||||
|
||||
|
@ -77,7 +77,7 @@ export default function ({ getService }) {
|
|||
describe('index management extension', () => {
|
||||
it('should have an endpoint to retry a policy for an index that is in the ERROR step', async () => {
|
||||
// Create a policy
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('extension-test-policy');
|
||||
const { name: policyName } = policy;
|
||||
await createPolicy(policy);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
import { API_BASE_PATH, DEFAULT_POLICY_NAME } from './constants';
|
||||
import { getPolicyPayload } from './fixtures';
|
||||
import { getPolicyNames } from './lib';
|
||||
|
||||
export const registerHelpers = ({ supertest }) => {
|
||||
|
@ -14,7 +13,7 @@ export const registerHelpers = ({ supertest }) => {
|
|||
? supertest.get(`${API_BASE_PATH}/policies?withIndices=true`)
|
||||
: supertest.get(`${API_BASE_PATH}/policies`);
|
||||
|
||||
const createPolicy = (policy = getPolicyPayload()) => {
|
||||
const createPolicy = (policy) => {
|
||||
return supertest.post(`${API_BASE_PATH}/policies`).set('kbn-xsrf', 'xxx').send(policy);
|
||||
};
|
||||
|
||||
|
|
|
@ -32,9 +32,7 @@ export default function ({ getService }) {
|
|||
after(() => Promise.all([cleanUpEsResources(), cleanUpPolicies()]));
|
||||
|
||||
describe('list', () => {
|
||||
// Disabled as the underline ES API has changed. Need to investigate
|
||||
// Opened issue: https://github.com/elastic/kibana/issues/62778
|
||||
it.skip('should have a default policy to manage the Watcher history indices', async () => {
|
||||
it('should have a default policy to manage the Watcher history indices', async () => {
|
||||
const { body } = await loadPolicies().expect(200);
|
||||
const policy = body.find((policy) => policy.name === DEFAULT_POLICY_NAME);
|
||||
|
||||
|
@ -50,7 +48,9 @@ export default function ({ getService }) {
|
|||
delete: {
|
||||
min_age: '7d',
|
||||
actions: {
|
||||
delete: {},
|
||||
delete: {
|
||||
delete_searchable_snapshot: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -61,7 +61,7 @@ export default function ({ getService }) {
|
|||
|
||||
it('should add the indices linked to the policies', async () => {
|
||||
// Create a policy
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('link-test-policy');
|
||||
const { name: policyName } = policy;
|
||||
await createPolicy(policy);
|
||||
|
||||
|
@ -78,7 +78,7 @@ export default function ({ getService }) {
|
|||
|
||||
describe('create', () => {
|
||||
it('should create a lifecycle policy', async () => {
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('create-test-policy');
|
||||
const { name } = policy;
|
||||
|
||||
// Load current policies
|
||||
|
@ -96,7 +96,7 @@ export default function ({ getService }) {
|
|||
|
||||
describe('delete', () => {
|
||||
it('should delete the policy created', async () => {
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('delete-test-policy');
|
||||
const { name } = policy;
|
||||
|
||||
// Create new policy
|
||||
|
|
|
@ -51,7 +51,7 @@ export default function ({ getService }) {
|
|||
describe('update', () => {
|
||||
it('should add a policy to a template', async () => {
|
||||
// Create policy
|
||||
const policy = getPolicyPayload();
|
||||
const policy = getPolicyPayload('template-test-policy');
|
||||
const { name: policyName } = policy;
|
||||
await createPolicy(policy);
|
||||
|
||||
|
|
Loading…
Reference in a new issue